@needle-tools/engine 4.4.2 → 4.4.3-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/needle-engine.bundle.js +36 -23
- package/dist/needle-engine.bundle.light.js +36 -23
- package/dist/needle-engine.bundle.light.min.js +4 -4
- package/dist/needle-engine.bundle.light.umd.cjs +4 -4
- package/dist/needle-engine.bundle.min.js +4 -4
- package/dist/needle-engine.bundle.umd.cjs +55 -55
- package/lib/engine/engine_input.d.ts +10 -0
- package/lib/engine/engine_input.js +34 -5
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_license.js +1 -1
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine-components/SyncedTransform.js +1 -1
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/package.json +1 -1
- package/plugins/common/license.js +20 -10
- package/plugins/next/license.cjs +10 -4
- package/plugins/next/next.js +9 -1
- package/src/engine/engine_input.ts +47 -7
- package/src/engine/engine_license.ts +1 -1
- package/src/engine-components/SyncedTransform.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [4.4.3-beta] - 2025-04-28
|
|
8
|
+
- Add: Support for `getKeyDown`, `getKeyPressed` and `getKeyUp` to pass in key name to check the state of keyboard input, e.g. `context.getKeyDown(<key>)`
|
|
9
|
+
- Add: License validation for webpack (nextjs) via access token or teamid. The `needleNext` plugin does now handle the license for passed in team or access tokens.
|
|
10
|
+
For example the `next.config.js` can be modified like so `... }, { modules: { webpack }, license: {team: "needle"} })` to pass in the name of a team (or a Needle Cloud access token).
|
|
11
|
+
- Change: License checks will now read the `NEEDLE_CLOUD_TOKEN` environment variable if no access token is provided.
|
|
12
|
+
- Fix: SyncedTransform `fastmode` lerp
|
|
13
|
+
|
|
7
14
|
## [4.4.2] - 2025-04-24
|
|
8
15
|
- Fix: Vite license server timeout
|
|
9
16
|
- Fix: Vite `manualChunks` should not be declared if `rollupOutput.inlineDynamicImports` is set to true
|
|
@@ -1803,15 +1803,15 @@ function AC() {
|
|
|
1803
1803
|
return s || null;
|
|
1804
1804
|
}
|
|
1805
1805
|
const $0 = x("debugdefines");
|
|
1806
|
-
Mo('if(!globalThis[""4.4.
|
|
1806
|
+
Mo('if(!globalThis[""4.4.3-beta""]) globalThis[""4.4.3-beta""] = "0.0.0";');
|
|
1807
1807
|
Mo('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
1808
|
-
Mo('if(!globalThis[""
|
|
1808
|
+
Mo('if(!globalThis[""Mon Apr 28 2025 23:14:12 GMT+0700 (Indochina Time)""]) globalThis[""Mon Apr 28 2025 23:14:12 GMT+0700 (Indochina Time)""] = "unknown";');
|
|
1809
1809
|
Mo('if(!globalThis[""npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd""]) globalThis[""npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd""] = "unknown";');
|
|
1810
|
-
Mo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.4.
|
|
1810
|
+
Mo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.4.3-beta";');
|
|
1811
1811
|
Mo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
1812
|
-
Mo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "
|
|
1812
|
+
Mo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Apr 28 2025 23:14:12 GMT+0700 (Indochina Time)";');
|
|
1813
1813
|
Mo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd";');
|
|
1814
|
-
const Nn = "4.4.
|
|
1814
|
+
const Nn = "4.4.3-beta", vg = "undefined", W0 = "Mon Apr 28 2025 23:14:12 GMT+0700 (Indochina Time)";
|
|
1815
1815
|
$0 && console.log(`Engine version: ${Nn} (generator: ${vg})
|
|
1816
1816
|
Project built at ${W0}`);
|
|
1817
1817
|
const fd = "npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd", yo = "needle_isActiveInHierarchy", sa = "builtin_components", pd = "needle_editor_guid";
|
|
@@ -2470,24 +2470,36 @@ class HC {
|
|
|
2470
2470
|
if (e)
|
|
2471
2471
|
return e[e.length - 1];
|
|
2472
2472
|
}
|
|
2473
|
-
getKeyDown() {
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2473
|
+
getKeyDown(t) {
|
|
2474
|
+
if (t !== void 0)
|
|
2475
|
+
return this.isKeyDown(t);
|
|
2476
|
+
for (const e in this.keysPressed) {
|
|
2477
|
+
const i = this.keysPressed[e];
|
|
2478
|
+
if (i.startFrame === this.context.time.frameCount)
|
|
2479
|
+
return i.key;
|
|
2478
2480
|
}
|
|
2479
2481
|
return null;
|
|
2480
2482
|
}
|
|
2481
|
-
getKeyPressed() {
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2483
|
+
getKeyPressed(t) {
|
|
2484
|
+
if (t !== void 0)
|
|
2485
|
+
return this.isKeyPressed(t);
|
|
2486
|
+
for (const e in this.keysPressed) {
|
|
2487
|
+
const i = this.keysPressed[e];
|
|
2488
|
+
if (i.pressed)
|
|
2489
|
+
return i.key;
|
|
2490
|
+
}
|
|
2491
|
+
return null;
|
|
2492
|
+
}
|
|
2493
|
+
getKeyUp(t) {
|
|
2494
|
+
if (t !== void 0)
|
|
2495
|
+
return this.isKeyUp(t);
|
|
2496
|
+
for (const e in this.keysPressed) {
|
|
2497
|
+
const i = this.keysPressed[e];
|
|
2498
|
+
return i.pressed === !1 && i.frame === this.context.time.frameCount;
|
|
2486
2499
|
}
|
|
2487
2500
|
return null;
|
|
2488
2501
|
}
|
|
2489
2502
|
isKeyDown(t) {
|
|
2490
|
-
var i;
|
|
2491
2503
|
if (!this.context.application.isVisible || !this.context.application.hasFocus)
|
|
2492
2504
|
return !1;
|
|
2493
2505
|
const e = this.getCodeForCommonKeyName(t);
|
|
@@ -2497,10 +2509,10 @@ class HC {
|
|
|
2497
2509
|
return !0;
|
|
2498
2510
|
return !1;
|
|
2499
2511
|
}
|
|
2500
|
-
|
|
2512
|
+
const i = this.keysPressed[t];
|
|
2513
|
+
return i ? i.startFrame === this.context.time.frameCount && i.pressed : !1;
|
|
2501
2514
|
}
|
|
2502
2515
|
isKeyUp(t) {
|
|
2503
|
-
var i;
|
|
2504
2516
|
if (!this.context.application.isVisible || !this.context.application.hasFocus)
|
|
2505
2517
|
return !1;
|
|
2506
2518
|
const e = this.getCodeForCommonKeyName(t);
|
|
@@ -2510,10 +2522,10 @@ class HC {
|
|
|
2510
2522
|
return !0;
|
|
2511
2523
|
return !1;
|
|
2512
2524
|
}
|
|
2513
|
-
|
|
2525
|
+
const i = this.keysPressed[t];
|
|
2526
|
+
return i ? i.frame === this.context.time.frameCount && i.pressed === !1 : !1;
|
|
2514
2527
|
}
|
|
2515
2528
|
isKeyPressed(t) {
|
|
2516
|
-
var i;
|
|
2517
2529
|
if (!this.context.application.isVisible || !this.context.application.hasFocus)
|
|
2518
2530
|
return !1;
|
|
2519
2531
|
const e = this.getCodeForCommonKeyName(t);
|
|
@@ -2523,7 +2535,8 @@ class HC {
|
|
|
2523
2535
|
return !0;
|
|
2524
2536
|
return !1;
|
|
2525
2537
|
}
|
|
2526
|
-
|
|
2538
|
+
const i = this.keysPressed[t];
|
|
2539
|
+
return i && i.pressed || !1;
|
|
2527
2540
|
}
|
|
2528
2541
|
// utility helper for mapping common names to actual codes; e.g. "Shift" -> "ShiftLeft" and "ShiftRight" or "a" -> "KeyA"
|
|
2529
2542
|
getCodeForCommonKeyName(t) {
|
|
@@ -11768,7 +11781,7 @@ function Tm(s) {
|
|
|
11768
11781
|
padding-left: 30px;
|
|
11769
11782
|
`;
|
|
11770
11783
|
if (Ms === "edu")
|
|
11771
|
-
console.log("%c
|
|
11784
|
+
console.log("%c This project is supported by Needle for Education – https://needle.tools", t);
|
|
11772
11785
|
else
|
|
11773
11786
|
return;
|
|
11774
11787
|
const e = document.createElement("div");
|
|
@@ -15364,7 +15377,7 @@ class Ds extends I {
|
|
|
15364
15377
|
(e.distanceTo(this.lastPosition) > l || i.angleTo(this.lastRotation) > l || n.distanceTo(this.lastScale) > l) && (this._model.hasOwnership ? this._needsUpdate = !0 : (eo && console.log(this.guid, "reset because not owned but", this.gameObject.name, this.lastPosition), this.worldPosition = this.lastPosition, e.copy(this.lastPosition), this.worldQuaternion = this.lastRotation, i.copy(this.lastRotation), this.gameObject.scale.copy(this.lastScale), yn.markDirty(this.gameObject, !0), this._needsUpdate = !1));
|
|
15365
15378
|
}
|
|
15366
15379
|
if (this._model && !this._model.hasOwnership && this._model.isOwned && this._receivedDataBefore) {
|
|
15367
|
-
const l = this._receivedFastUpdate || this.fastMode ? 0.
|
|
15380
|
+
const l = this._receivedFastUpdate || this.fastMode ? 0.5 : 0.3;
|
|
15368
15381
|
let c = !1;
|
|
15369
15382
|
if (this.interpolatePosition && this._targetPosition) {
|
|
15370
15383
|
const h = this.worldPosition;
|
|
@@ -1803,15 +1803,15 @@ function AC() {
|
|
|
1803
1803
|
return s || null;
|
|
1804
1804
|
}
|
|
1805
1805
|
const $0 = x("debugdefines");
|
|
1806
|
-
Mo('if(!globalThis[""4.4.
|
|
1806
|
+
Mo('if(!globalThis[""4.4.3-beta""]) globalThis[""4.4.3-beta""] = "0.0.0";');
|
|
1807
1807
|
Mo('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
1808
|
-
Mo('if(!globalThis[""
|
|
1808
|
+
Mo('if(!globalThis[""Mon Apr 28 2025 23:14:25 GMT+0700 (Indochina Time)""]) globalThis[""Mon Apr 28 2025 23:14:25 GMT+0700 (Indochina Time)""] = "unknown";');
|
|
1809
1809
|
Mo('if(!globalThis[""npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd""]) globalThis[""npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd""] = "unknown";');
|
|
1810
|
-
Mo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.4.
|
|
1810
|
+
Mo('globalThis["__NEEDLE_ENGINE_VERSION__"] = "4.4.3-beta";');
|
|
1811
1811
|
Mo('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
1812
|
-
Mo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "
|
|
1812
|
+
Mo('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Mon Apr 28 2025 23:14:25 GMT+0700 (Indochina Time)";');
|
|
1813
1813
|
Mo('globalThis["__NEEDLE_PUBLIC_KEY__"] = "npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd";');
|
|
1814
|
-
const Nn = "4.4.
|
|
1814
|
+
const Nn = "4.4.3-beta", vg = "undefined", W0 = "Mon Apr 28 2025 23:14:25 GMT+0700 (Indochina Time)";
|
|
1815
1815
|
$0 && console.log(`Engine version: ${Nn} (generator: ${vg})
|
|
1816
1816
|
Project built at ${W0}`);
|
|
1817
1817
|
const fd = "npk_ad8e492e31253a2800d563522e42a7311d0d7b766ac4ec1f64d3b425f06eacbd", yo = "needle_isActiveInHierarchy", sa = "builtin_components", pd = "needle_editor_guid";
|
|
@@ -2470,24 +2470,36 @@ class HC {
|
|
|
2470
2470
|
if (e)
|
|
2471
2471
|
return e[e.length - 1];
|
|
2472
2472
|
}
|
|
2473
|
-
getKeyDown() {
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2473
|
+
getKeyDown(t) {
|
|
2474
|
+
if (t !== void 0)
|
|
2475
|
+
return this.isKeyDown(t);
|
|
2476
|
+
for (const e in this.keysPressed) {
|
|
2477
|
+
const i = this.keysPressed[e];
|
|
2478
|
+
if (i.startFrame === this.context.time.frameCount)
|
|
2479
|
+
return i.key;
|
|
2478
2480
|
}
|
|
2479
2481
|
return null;
|
|
2480
2482
|
}
|
|
2481
|
-
getKeyPressed() {
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2483
|
+
getKeyPressed(t) {
|
|
2484
|
+
if (t !== void 0)
|
|
2485
|
+
return this.isKeyPressed(t);
|
|
2486
|
+
for (const e in this.keysPressed) {
|
|
2487
|
+
const i = this.keysPressed[e];
|
|
2488
|
+
if (i.pressed)
|
|
2489
|
+
return i.key;
|
|
2490
|
+
}
|
|
2491
|
+
return null;
|
|
2492
|
+
}
|
|
2493
|
+
getKeyUp(t) {
|
|
2494
|
+
if (t !== void 0)
|
|
2495
|
+
return this.isKeyUp(t);
|
|
2496
|
+
for (const e in this.keysPressed) {
|
|
2497
|
+
const i = this.keysPressed[e];
|
|
2498
|
+
return i.pressed === !1 && i.frame === this.context.time.frameCount;
|
|
2486
2499
|
}
|
|
2487
2500
|
return null;
|
|
2488
2501
|
}
|
|
2489
2502
|
isKeyDown(t) {
|
|
2490
|
-
var i;
|
|
2491
2503
|
if (!this.context.application.isVisible || !this.context.application.hasFocus)
|
|
2492
2504
|
return !1;
|
|
2493
2505
|
const e = this.getCodeForCommonKeyName(t);
|
|
@@ -2497,10 +2509,10 @@ class HC {
|
|
|
2497
2509
|
return !0;
|
|
2498
2510
|
return !1;
|
|
2499
2511
|
}
|
|
2500
|
-
|
|
2512
|
+
const i = this.keysPressed[t];
|
|
2513
|
+
return i ? i.startFrame === this.context.time.frameCount && i.pressed : !1;
|
|
2501
2514
|
}
|
|
2502
2515
|
isKeyUp(t) {
|
|
2503
|
-
var i;
|
|
2504
2516
|
if (!this.context.application.isVisible || !this.context.application.hasFocus)
|
|
2505
2517
|
return !1;
|
|
2506
2518
|
const e = this.getCodeForCommonKeyName(t);
|
|
@@ -2510,10 +2522,10 @@ class HC {
|
|
|
2510
2522
|
return !0;
|
|
2511
2523
|
return !1;
|
|
2512
2524
|
}
|
|
2513
|
-
|
|
2525
|
+
const i = this.keysPressed[t];
|
|
2526
|
+
return i ? i.frame === this.context.time.frameCount && i.pressed === !1 : !1;
|
|
2514
2527
|
}
|
|
2515
2528
|
isKeyPressed(t) {
|
|
2516
|
-
var i;
|
|
2517
2529
|
if (!this.context.application.isVisible || !this.context.application.hasFocus)
|
|
2518
2530
|
return !1;
|
|
2519
2531
|
const e = this.getCodeForCommonKeyName(t);
|
|
@@ -2523,7 +2535,8 @@ class HC {
|
|
|
2523
2535
|
return !0;
|
|
2524
2536
|
return !1;
|
|
2525
2537
|
}
|
|
2526
|
-
|
|
2538
|
+
const i = this.keysPressed[t];
|
|
2539
|
+
return i && i.pressed || !1;
|
|
2527
2540
|
}
|
|
2528
2541
|
// utility helper for mapping common names to actual codes; e.g. "Shift" -> "ShiftLeft" and "ShiftRight" or "a" -> "KeyA"
|
|
2529
2542
|
getCodeForCommonKeyName(t) {
|
|
@@ -11768,7 +11781,7 @@ function Tm(s) {
|
|
|
11768
11781
|
padding-left: 30px;
|
|
11769
11782
|
`;
|
|
11770
11783
|
if (Rs === "edu")
|
|
11771
|
-
console.log("%c
|
|
11784
|
+
console.log("%c This project is supported by Needle for Education – https://needle.tools", t);
|
|
11772
11785
|
else
|
|
11773
11786
|
return;
|
|
11774
11787
|
const e = document.createElement("div");
|
|
@@ -15364,7 +15377,7 @@ class js extends I {
|
|
|
15364
15377
|
(e.distanceTo(this.lastPosition) > l || i.angleTo(this.lastRotation) > l || n.distanceTo(this.lastScale) > l) && (this._model.hasOwnership ? this._needsUpdate = !0 : (eo && console.log(this.guid, "reset because not owned but", this.gameObject.name, this.lastPosition), this.worldPosition = this.lastPosition, e.copy(this.lastPosition), this.worldQuaternion = this.lastRotation, i.copy(this.lastRotation), this.gameObject.scale.copy(this.lastScale), yn.markDirty(this.gameObject, !0), this._needsUpdate = !1));
|
|
15365
15378
|
}
|
|
15366
15379
|
if (this._model && !this._model.hasOwnership && this._model.isOwned && this._receivedDataBefore) {
|
|
15367
|
-
const l = this._receivedFastUpdate || this.fastMode ? 0.
|
|
15380
|
+
const l = this._receivedFastUpdate || this.fastMode ? 0.5 : 0.3;
|
|
15368
15381
|
let c = !1;
|
|
15369
15382
|
if (this.interpolatePosition && this._targetPosition) {
|
|
15370
15383
|
const h = this.worldPosition;
|