@needle-tools/engine 3.35.1-beta → 3.35.1-beta.1
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/dist/needle-engine.js +32 -18
- package/dist/needle-engine.light.js +32 -18
- package/dist/needle-engine.light.min.js +2 -2
- package/dist/needle-engine.light.umd.cjs +2 -2
- package/dist/needle-engine.min.js +2 -2
- package/dist/needle-engine.umd.cjs +2 -2
- package/lib/engine-components/Animator.d.ts +19 -4
- package/lib/engine-components/Animator.js +32 -19
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AnimatorController.d.ts +10 -1
- package/lib/engine-components/AnimatorController.js +10 -1
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/package.json +1 -1
- package/src/engine-components/Animator.ts +32 -19
- package/src/engine-components/AnimatorController.ts +11 -2
package/dist/needle-engine.js
CHANGED
|
@@ -30203,13 +30203,13 @@ class Py {
|
|
|
30203
30203
|
}
|
|
30204
30204
|
r(Py, "eventListeners", /* @__PURE__ */ new Map());
|
|
30205
30205
|
const oT = IA("debugdefines");
|
|
30206
|
-
kE('if(!globalThis[""3.35.1-beta""]) globalThis[""3.35.1-beta""] = "0.0.0";');
|
|
30206
|
+
kE('if(!globalThis[""3.35.1-beta.1""]) globalThis[""3.35.1-beta.1""] = "0.0.0";');
|
|
30207
30207
|
kE('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
30208
|
-
kE('if(!globalThis[""Fri Mar 29 2024
|
|
30209
|
-
kE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.35.1-beta";');
|
|
30208
|
+
kE('if(!globalThis[""Fri Mar 29 2024 16:20:59 GMT+0100 (GMT+01:00)""]) globalThis[""Fri Mar 29 2024 16:20:59 GMT+0100 (GMT+01:00)""] = "unknown";');
|
|
30209
|
+
kE('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.35.1-beta.1";');
|
|
30210
30210
|
kE('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
30211
|
-
kE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Mar 29 2024
|
|
30212
|
-
const sC = "3.35.1-beta", HR = "undefined", sT = "Fri Mar 29 2024
|
|
30211
|
+
kE('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Mar 29 2024 16:20:59 GMT+0100 (GMT+01:00)";');
|
|
30212
|
+
const sC = "3.35.1-beta.1", HR = "undefined", sT = "Fri Mar 29 2024 16:20:59 GMT+0100 (GMT+01:00)";
|
|
30213
30213
|
oT && console.log(`Engine version: ${sC} (generator: ${HR})
|
|
30214
30214
|
Project built at ${sT}`);
|
|
30215
30215
|
const wa = "needle_isActiveInHierarchy", lQ = "builtin_components", Wp = "needle_editor_guid";
|
|
@@ -62651,7 +62651,11 @@ class Po {
|
|
|
62651
62651
|
r(this, "rootMotionHandler");
|
|
62652
62652
|
this.model = A, dI && console.log(this);
|
|
62653
62653
|
}
|
|
62654
|
-
/** Create an animatorcontroller
|
|
62654
|
+
/** Create an animatorcontroller. States are created from the clips array.
|
|
62655
|
+
* @param clips the clips to assign to the controller
|
|
62656
|
+
* @param options options to control the creation of the controller.
|
|
62657
|
+
* @returns the created animator controller
|
|
62658
|
+
*/
|
|
62655
62659
|
static createFromClips(A, e = { looping: !1, autoTransition: !0, transitionDuration: 0 }) {
|
|
62656
62660
|
const t = [];
|
|
62657
62661
|
for (let o = 0; o < A.length; o++) {
|
|
@@ -62763,6 +62767,7 @@ class Po {
|
|
|
62763
62767
|
isInTransition() {
|
|
62764
62768
|
return this._activeStates.length > 1;
|
|
62765
62769
|
}
|
|
62770
|
+
/** Set the speed of the animator controller. Larger values will make the animation play faster. */
|
|
62766
62771
|
setSpeed(A) {
|
|
62767
62772
|
this._speed = A;
|
|
62768
62773
|
}
|
|
@@ -63208,12 +63213,8 @@ class oI extends UA {
|
|
|
63208
63213
|
r(this, "keepAnimatorControllerStateOnDisable", !1);
|
|
63209
63214
|
r(this, "_parametersAreDirty", !1);
|
|
63210
63215
|
r(this, "_isDirty", !1);
|
|
63211
|
-
|
|
63212
|
-
|
|
63213
|
-
// this.SetSpeed(val)
|
|
63214
|
-
// }
|
|
63215
|
-
r(this, "speed", 1);
|
|
63216
|
-
r(this, "normalizedStartOffset", 0);
|
|
63216
|
+
r(this, "_speed", 1);
|
|
63217
|
+
r(this, "_normalizedStartOffset", 0);
|
|
63217
63218
|
r(this, "_animatorController", null);
|
|
63218
63219
|
// Why do we jump through hoops like this? It's because of the PlayableDirector and animation tracks
|
|
63219
63220
|
// they NEED to use the same mixer when binding/creating the animation clips
|
|
@@ -63243,17 +63244,25 @@ class oI extends UA {
|
|
|
63243
63244
|
var e;
|
|
63244
63245
|
return ((e = this.runtimeAnimatorController) == null ? void 0 : e.currentAction) || null;
|
|
63245
63246
|
}
|
|
63247
|
+
/** @returns {boolean} True if parameters have been changed */
|
|
63246
63248
|
get parametersAreDirty() {
|
|
63247
63249
|
return this._parametersAreDirty;
|
|
63248
63250
|
}
|
|
63251
|
+
/** @returns {boolean} True if the animator has been changed */
|
|
63249
63252
|
get isDirty() {
|
|
63250
63253
|
return this._isDirty;
|
|
63251
63254
|
}
|
|
63252
|
-
|
|
63253
|
-
/**@deprecated use play */
|
|
63255
|
+
/**@deprecated use play() */
|
|
63254
63256
|
Play(e, t = -1, i = Number.NEGATIVE_INFINITY, I = 0) {
|
|
63255
63257
|
this.play(e, t, i, I);
|
|
63256
63258
|
}
|
|
63259
|
+
/** Plays an animation on the animator
|
|
63260
|
+
* @param {string | number} name The name of the animation to play. Can also be the hash of the animation
|
|
63261
|
+
* @param {number} layer The layer to play the animation on. Default is -1
|
|
63262
|
+
* @param {number} normalizedTime The normalized time to start the animation at. Default is Number.NEGATIVE_INFINITY
|
|
63263
|
+
* @param {number} transitionDurationInSec The duration of the transition to the new animation. Default is 0
|
|
63264
|
+
* @returns {void}
|
|
63265
|
+
* */
|
|
63257
63266
|
play(e, t = -1, i = Number.NEGATIVE_INFINITY, I = 0) {
|
|
63258
63267
|
var o;
|
|
63259
63268
|
(o = this.runtimeAnimatorController) == null || o.play(e, t, i, I), this._isDirty = !0;
|
|
@@ -63262,6 +63271,7 @@ class oI extends UA {
|
|
|
63262
63271
|
Reset() {
|
|
63263
63272
|
this.reset();
|
|
63264
63273
|
}
|
|
63274
|
+
/** Resets the animatorcontroller */
|
|
63265
63275
|
reset() {
|
|
63266
63276
|
var e;
|
|
63267
63277
|
(e = this._animatorController) == null || e.reset(), this._isDirty = !0;
|
|
@@ -63349,6 +63359,7 @@ class oI extends UA {
|
|
|
63349
63359
|
IsInTransition() {
|
|
63350
63360
|
return this.isInTransition();
|
|
63351
63361
|
}
|
|
63362
|
+
/** @returns `true` if the animator is currently in a transition */
|
|
63352
63363
|
isInTransition() {
|
|
63353
63364
|
var e;
|
|
63354
63365
|
return ((e = this.runtimeAnimatorController) == null ? void 0 : e.isInTransition()) ?? !1;
|
|
@@ -63359,13 +63370,16 @@ class oI extends UA {
|
|
|
63359
63370
|
}
|
|
63360
63371
|
setSpeed(e) {
|
|
63361
63372
|
var t;
|
|
63362
|
-
e !== this.
|
|
63373
|
+
e !== this._speed && (Go && console.log("setSpeed", e), this._speed = e, ((t = this._animatorController) == null ? void 0 : t.animator) == this && this._animatorController.setSpeed(e));
|
|
63363
63374
|
}
|
|
63375
|
+
/** Will generate a random speed between the min and max values and set it to the animatorcontroller */
|
|
63364
63376
|
set minMaxSpeed(e) {
|
|
63365
|
-
|
|
63377
|
+
var t;
|
|
63378
|
+
this._speed = te.lerp(e.x, e.y, Math.random()), ((t = this._animatorController) == null ? void 0 : t.animator) == this && this._animatorController.setSpeed(this._speed);
|
|
63366
63379
|
}
|
|
63367
63380
|
set minMaxOffsetNormalized(e) {
|
|
63368
|
-
|
|
63381
|
+
var t;
|
|
63382
|
+
this._normalizedStartOffset = te.lerp(e.x, e.y, Math.random()), ((t = this.runtimeAnimatorController) == null ? void 0 : t.animator) == this && (this.runtimeAnimatorController.normalizedStartOffset = this._normalizedStartOffset);
|
|
63369
63383
|
}
|
|
63370
63384
|
awake() {
|
|
63371
63385
|
Go && console.log("ANIMATOR", this.name, this), this.gameObject && this.initializeRuntimeAnimatorController();
|
|
@@ -63374,7 +63388,7 @@ class oI extends UA {
|
|
|
63374
63388
|
const t = e || this.runtimeAnimatorController !== this._initializeWithRuntimeAnimatorController;
|
|
63375
63389
|
if (this.runtimeAnimatorController && t) {
|
|
63376
63390
|
const i = this.runtimeAnimatorController.clone();
|
|
63377
|
-
this._initializeWithRuntimeAnimatorController = i, i ? (console.assert(this.runtimeAnimatorController !== i), this.runtimeAnimatorController = i, console.assert(this.runtimeAnimatorController === i), this.runtimeAnimatorController.bind(this), this.runtimeAnimatorController.setSpeed(this.
|
|
63391
|
+
this._initializeWithRuntimeAnimatorController = i, i ? (console.assert(this.runtimeAnimatorController !== i), this.runtimeAnimatorController = i, console.assert(this.runtimeAnimatorController === i), this.runtimeAnimatorController.bind(this), this.runtimeAnimatorController.setSpeed(this._speed), this.runtimeAnimatorController.normalizedStartOffset = this._normalizedStartOffset) : console.warn("Could not clone animator controller", this.runtimeAnimatorController);
|
|
63378
63392
|
}
|
|
63379
63393
|
}
|
|
63380
63394
|
onDisable() {
|
|
@@ -30203,13 +30203,13 @@ class Vb {
|
|
|
30203
30203
|
}
|
|
30204
30204
|
h(Vb, "eventListeners", /* @__PURE__ */ new Map());
|
|
30205
30205
|
const SU = ne("debugdefines");
|
|
30206
|
-
tp('if(!globalThis[""3.35.1-beta""]) globalThis[""3.35.1-beta""] = "0.0.0";');
|
|
30206
|
+
tp('if(!globalThis[""3.35.1-beta.1""]) globalThis[""3.35.1-beta.1""] = "0.0.0";');
|
|
30207
30207
|
tp('if(!globalThis[""undefined""]) globalThis[""undefined""] = "unknown";');
|
|
30208
|
-
tp('if(!globalThis[""Fri Mar 29 2024
|
|
30209
|
-
tp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.35.1-beta";');
|
|
30208
|
+
tp('if(!globalThis[""Fri Mar 29 2024 16:21:06 GMT+0100 (GMT+01:00)""]) globalThis[""Fri Mar 29 2024 16:21:06 GMT+0100 (GMT+01:00)""] = "unknown";');
|
|
30209
|
+
tp('globalThis["__NEEDLE_ENGINE_VERSION__"] = "3.35.1-beta.1";');
|
|
30210
30210
|
tp('globalThis["__NEEDLE_ENGINE_GENERATOR__"] = "undefined";');
|
|
30211
|
-
tp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Mar 29 2024
|
|
30212
|
-
const ql = "3.35.1-beta", TT = "undefined", CU = "Fri Mar 29 2024
|
|
30211
|
+
tp('globalThis["__NEEDLE_PROJECT_BUILD_TIME__"] = "Fri Mar 29 2024 16:21:06 GMT+0100 (GMT+01:00)";');
|
|
30212
|
+
const ql = "3.35.1-beta.1", TT = "undefined", CU = "Fri Mar 29 2024 16:21:06 GMT+0100 (GMT+01:00)";
|
|
30213
30213
|
SU && console.log(`Engine version: ${ql} (generator: ${TT})
|
|
30214
30214
|
Project built at ${CU}`);
|
|
30215
30215
|
const sh = "needle_isActiveInHierarchy", Wd = "builtin_components", c0 = "needle_editor_guid";
|
|
@@ -62651,7 +62651,11 @@ class Lo {
|
|
|
62651
62651
|
h(this, "rootMotionHandler");
|
|
62652
62652
|
this.model = e, cr && console.log(this);
|
|
62653
62653
|
}
|
|
62654
|
-
/** Create an animatorcontroller
|
|
62654
|
+
/** Create an animatorcontroller. States are created from the clips array.
|
|
62655
|
+
* @param clips the clips to assign to the controller
|
|
62656
|
+
* @param options options to control the creation of the controller.
|
|
62657
|
+
* @returns the created animator controller
|
|
62658
|
+
*/
|
|
62655
62659
|
static createFromClips(e, t = { looping: !1, autoTransition: !0, transitionDuration: 0 }) {
|
|
62656
62660
|
const i = [];
|
|
62657
62661
|
for (let o = 0; o < e.length; o++) {
|
|
@@ -62763,6 +62767,7 @@ class Lo {
|
|
|
62763
62767
|
isInTransition() {
|
|
62764
62768
|
return this._activeStates.length > 1;
|
|
62765
62769
|
}
|
|
62770
|
+
/** Set the speed of the animator controller. Larger values will make the animation play faster. */
|
|
62766
62771
|
setSpeed(e) {
|
|
62767
62772
|
this._speed = e;
|
|
62768
62773
|
}
|
|
@@ -63208,12 +63213,8 @@ class Ks extends Te {
|
|
|
63208
63213
|
h(this, "keepAnimatorControllerStateOnDisable", !1);
|
|
63209
63214
|
h(this, "_parametersAreDirty", !1);
|
|
63210
63215
|
h(this, "_isDirty", !1);
|
|
63211
|
-
|
|
63212
|
-
|
|
63213
|
-
// this.SetSpeed(val)
|
|
63214
|
-
// }
|
|
63215
|
-
h(this, "speed", 1);
|
|
63216
|
-
h(this, "normalizedStartOffset", 0);
|
|
63216
|
+
h(this, "_speed", 1);
|
|
63217
|
+
h(this, "_normalizedStartOffset", 0);
|
|
63217
63218
|
h(this, "_animatorController", null);
|
|
63218
63219
|
// Why do we jump through hoops like this? It's because of the PlayableDirector and animation tracks
|
|
63219
63220
|
// they NEED to use the same mixer when binding/creating the animation clips
|
|
@@ -63243,17 +63244,25 @@ class Ks extends Te {
|
|
|
63243
63244
|
var t;
|
|
63244
63245
|
return ((t = this.runtimeAnimatorController) == null ? void 0 : t.currentAction) || null;
|
|
63245
63246
|
}
|
|
63247
|
+
/** @returns {boolean} True if parameters have been changed */
|
|
63246
63248
|
get parametersAreDirty() {
|
|
63247
63249
|
return this._parametersAreDirty;
|
|
63248
63250
|
}
|
|
63251
|
+
/** @returns {boolean} True if the animator has been changed */
|
|
63249
63252
|
get isDirty() {
|
|
63250
63253
|
return this._isDirty;
|
|
63251
63254
|
}
|
|
63252
|
-
|
|
63253
|
-
/**@deprecated use play */
|
|
63255
|
+
/**@deprecated use play() */
|
|
63254
63256
|
Play(t, i = -1, n = Number.NEGATIVE_INFINITY, r = 0) {
|
|
63255
63257
|
this.play(t, i, n, r);
|
|
63256
63258
|
}
|
|
63259
|
+
/** Plays an animation on the animator
|
|
63260
|
+
* @param {string | number} name The name of the animation to play. Can also be the hash of the animation
|
|
63261
|
+
* @param {number} layer The layer to play the animation on. Default is -1
|
|
63262
|
+
* @param {number} normalizedTime The normalized time to start the animation at. Default is Number.NEGATIVE_INFINITY
|
|
63263
|
+
* @param {number} transitionDurationInSec The duration of the transition to the new animation. Default is 0
|
|
63264
|
+
* @returns {void}
|
|
63265
|
+
* */
|
|
63257
63266
|
play(t, i = -1, n = Number.NEGATIVE_INFINITY, r = 0) {
|
|
63258
63267
|
var o;
|
|
63259
63268
|
(o = this.runtimeAnimatorController) == null || o.play(t, i, n, r), this._isDirty = !0;
|
|
@@ -63262,6 +63271,7 @@ class Ks extends Te {
|
|
|
63262
63271
|
Reset() {
|
|
63263
63272
|
this.reset();
|
|
63264
63273
|
}
|
|
63274
|
+
/** Resets the animatorcontroller */
|
|
63265
63275
|
reset() {
|
|
63266
63276
|
var t;
|
|
63267
63277
|
(t = this._animatorController) == null || t.reset(), this._isDirty = !0;
|
|
@@ -63349,6 +63359,7 @@ class Ks extends Te {
|
|
|
63349
63359
|
IsInTransition() {
|
|
63350
63360
|
return this.isInTransition();
|
|
63351
63361
|
}
|
|
63362
|
+
/** @returns `true` if the animator is currently in a transition */
|
|
63352
63363
|
isInTransition() {
|
|
63353
63364
|
var t;
|
|
63354
63365
|
return ((t = this.runtimeAnimatorController) == null ? void 0 : t.isInTransition()) ?? !1;
|
|
@@ -63359,13 +63370,16 @@ class Ks extends Te {
|
|
|
63359
63370
|
}
|
|
63360
63371
|
setSpeed(t) {
|
|
63361
63372
|
var i;
|
|
63362
|
-
t !== this.
|
|
63373
|
+
t !== this._speed && (Ao && console.log("setSpeed", t), this._speed = t, ((i = this._animatorController) == null ? void 0 : i.animator) == this && this._animatorController.setSpeed(t));
|
|
63363
63374
|
}
|
|
63375
|
+
/** Will generate a random speed between the min and max values and set it to the animatorcontroller */
|
|
63364
63376
|
set minMaxSpeed(t) {
|
|
63365
|
-
|
|
63377
|
+
var i;
|
|
63378
|
+
this._speed = et.lerp(t.x, t.y, Math.random()), ((i = this._animatorController) == null ? void 0 : i.animator) == this && this._animatorController.setSpeed(this._speed);
|
|
63366
63379
|
}
|
|
63367
63380
|
set minMaxOffsetNormalized(t) {
|
|
63368
|
-
|
|
63381
|
+
var i;
|
|
63382
|
+
this._normalizedStartOffset = et.lerp(t.x, t.y, Math.random()), ((i = this.runtimeAnimatorController) == null ? void 0 : i.animator) == this && (this.runtimeAnimatorController.normalizedStartOffset = this._normalizedStartOffset);
|
|
63369
63383
|
}
|
|
63370
63384
|
awake() {
|
|
63371
63385
|
Ao && console.log("ANIMATOR", this.name, this), this.gameObject && this.initializeRuntimeAnimatorController();
|
|
@@ -63374,7 +63388,7 @@ class Ks extends Te {
|
|
|
63374
63388
|
const i = t || this.runtimeAnimatorController !== this._initializeWithRuntimeAnimatorController;
|
|
63375
63389
|
if (this.runtimeAnimatorController && i) {
|
|
63376
63390
|
const n = this.runtimeAnimatorController.clone();
|
|
63377
|
-
this._initializeWithRuntimeAnimatorController = n, n ? (console.assert(this.runtimeAnimatorController !== n), this.runtimeAnimatorController = n, console.assert(this.runtimeAnimatorController === n), this.runtimeAnimatorController.bind(this), this.runtimeAnimatorController.setSpeed(this.
|
|
63391
|
+
this._initializeWithRuntimeAnimatorController = n, n ? (console.assert(this.runtimeAnimatorController !== n), this.runtimeAnimatorController = n, console.assert(this.runtimeAnimatorController === n), this.runtimeAnimatorController.bind(this), this.runtimeAnimatorController.setSpeed(this._speed), this.runtimeAnimatorController.normalizedStartOffset = this._normalizedStartOffset) : console.warn("Could not clone animator controller", this.runtimeAnimatorController);
|
|
63378
63392
|
}
|
|
63379
63393
|
}
|
|
63380
63394
|
onDisable() {
|