@dcl/ecs 7.3.16-6313983963.commit-01f87ad → 7.3.16-6315152803.commit-5f2bd57
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/components/extended/Animator.d.ts +6 -6
- package/dist/components/extended/Animator.js +9 -9
- package/dist/components/generated/pb/decentraland/sdk/components/animator.gen.d.ts +0 -2
- package/dist/components/generated/pb/decentraland/sdk/components/animator.gen.js +1 -18
- package/dist-cjs/components/extended/Animator.d.ts +6 -6
- package/dist-cjs/components/extended/Animator.js +9 -9
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/animator.gen.d.ts +0 -2
- package/dist-cjs/components/generated/pb/decentraland/sdk/components/animator.gen.js +1 -18
- package/package.json +2 -2
|
@@ -10,29 +10,29 @@ export interface AnimatorComponentDefinitionExtended extends LastWriteWinElement
|
|
|
10
10
|
*
|
|
11
11
|
* Get a `mutable` version of animator clip
|
|
12
12
|
* @param entity - entity with Animator component
|
|
13
|
-
* @param
|
|
13
|
+
* @param clipName - the field `clip` of the component
|
|
14
14
|
* @returns the clip or fails if it isn't found
|
|
15
15
|
*/
|
|
16
|
-
getClip(entity: Entity,
|
|
16
|
+
getClip(entity: Entity, clipName: string): PBAnimationState;
|
|
17
17
|
/**
|
|
18
18
|
* @public
|
|
19
19
|
*
|
|
20
20
|
* Get a `mutable` version of animator clip
|
|
21
21
|
* @param entity - entity with Animator component
|
|
22
|
-
* @param
|
|
22
|
+
* @param clipName - the field `clip` of the component
|
|
23
23
|
* @returns the clip or null if it isn't found
|
|
24
24
|
*/
|
|
25
|
-
getClipOrNull(entity: Entity,
|
|
25
|
+
getClipOrNull(entity: Entity, clipName: string): PBAnimationState | null;
|
|
26
26
|
/**
|
|
27
27
|
* @public
|
|
28
28
|
*
|
|
29
29
|
* Set playing=true the animation `$name`
|
|
30
30
|
* @param entity - entity with Animator component
|
|
31
|
-
* @param
|
|
31
|
+
* @param clipName - animation name
|
|
32
32
|
* @param resetCursor - the animation starts at 0 or continues from the current cursor position
|
|
33
33
|
* @returns true in successful playing, false if it doesn't find the Animator or clip
|
|
34
34
|
*/
|
|
35
|
-
playSingleAnimation(entity: Entity,
|
|
35
|
+
playSingleAnimation(entity: Entity, clipName: string, resetCursor?: boolean): boolean;
|
|
36
36
|
/**
|
|
37
37
|
* @public
|
|
38
38
|
*
|
|
@@ -4,33 +4,33 @@ export function defineAnimatorComponent(engine) {
|
|
|
4
4
|
/**
|
|
5
5
|
* @returns The tuple [animator, clip]
|
|
6
6
|
*/
|
|
7
|
-
function getClipAndAnimator(entity,
|
|
7
|
+
function getClipAndAnimator(entity, clipName) {
|
|
8
8
|
const anim = theComponent.getMutableOrNull(entity);
|
|
9
9
|
if (!anim)
|
|
10
10
|
return [null, null];
|
|
11
|
-
const state = anim.states.find((item) => item.
|
|
11
|
+
const state = anim.states.find((item) => item.clip === clipName);
|
|
12
12
|
if (!state)
|
|
13
13
|
return [anim, null];
|
|
14
14
|
return [anim, state];
|
|
15
15
|
}
|
|
16
16
|
return {
|
|
17
17
|
...theComponent,
|
|
18
|
-
getClipOrNull(entity,
|
|
19
|
-
const [_, state] = getClipAndAnimator(entity,
|
|
18
|
+
getClipOrNull(entity, clipName) {
|
|
19
|
+
const [_, state] = getClipAndAnimator(entity, clipName);
|
|
20
20
|
return state;
|
|
21
21
|
},
|
|
22
|
-
getClip(entity,
|
|
23
|
-
const [animator, state] = getClipAndAnimator(entity,
|
|
22
|
+
getClip(entity, clipName) {
|
|
23
|
+
const [animator, state] = getClipAndAnimator(entity, clipName);
|
|
24
24
|
if (!animator) {
|
|
25
25
|
throw new Error(`There is no Animator found in the entity ${entity}`);
|
|
26
26
|
}
|
|
27
27
|
if (!state) {
|
|
28
|
-
throw new Error(`The Animator component of ${entity} has no the state ${
|
|
28
|
+
throw new Error(`The Animator component of ${entity} has no the state ${clipName}`);
|
|
29
29
|
}
|
|
30
30
|
return state;
|
|
31
31
|
},
|
|
32
|
-
playSingleAnimation(entity,
|
|
33
|
-
const [animator, state] = getClipAndAnimator(entity,
|
|
32
|
+
playSingleAnimation(entity, clipName, shouldReset = true) {
|
|
33
|
+
const [animator, state] = getClipAndAnimator(entity, clipName);
|
|
34
34
|
if (!animator || !state)
|
|
35
35
|
return false;
|
|
36
36
|
// Reset all other animations
|
|
@@ -19,8 +19,6 @@ export interface PBAnimator {
|
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
export interface PBAnimationState {
|
|
22
|
-
/** the identifier for this animation, to use in scene code */
|
|
23
|
-
name: string;
|
|
24
22
|
/** the animation path in the `files` array of the scene manifest */
|
|
25
23
|
clip: string;
|
|
26
24
|
/** whether this animation is currently playing */
|
|
@@ -40,15 +40,7 @@ export var PBAnimator;
|
|
|
40
40
|
PBAnimator.decode = decode;
|
|
41
41
|
})(PBAnimator || (PBAnimator = {}));
|
|
42
42
|
function createBasePBAnimationState() {
|
|
43
|
-
return {
|
|
44
|
-
name: "",
|
|
45
|
-
clip: "",
|
|
46
|
-
playing: undefined,
|
|
47
|
-
weight: undefined,
|
|
48
|
-
speed: undefined,
|
|
49
|
-
loop: undefined,
|
|
50
|
-
shouldReset: undefined,
|
|
51
|
-
};
|
|
43
|
+
return { clip: "", playing: undefined, weight: undefined, speed: undefined, loop: undefined, shouldReset: undefined };
|
|
52
44
|
}
|
|
53
45
|
/**
|
|
54
46
|
* @public
|
|
@@ -56,9 +48,6 @@ function createBasePBAnimationState() {
|
|
|
56
48
|
export var PBAnimationState;
|
|
57
49
|
(function (PBAnimationState) {
|
|
58
50
|
function encode(message, writer = _m0.Writer.create()) {
|
|
59
|
-
if (message.name !== "") {
|
|
60
|
-
writer.uint32(10).string(message.name);
|
|
61
|
-
}
|
|
62
51
|
if (message.clip !== "") {
|
|
63
52
|
writer.uint32(18).string(message.clip);
|
|
64
53
|
}
|
|
@@ -87,12 +76,6 @@ export var PBAnimationState;
|
|
|
87
76
|
while (reader.pos < end) {
|
|
88
77
|
const tag = reader.uint32();
|
|
89
78
|
switch (tag >>> 3) {
|
|
90
|
-
case 1:
|
|
91
|
-
if (tag !== 10) {
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
message.name = reader.string();
|
|
95
|
-
continue;
|
|
96
79
|
case 2:
|
|
97
80
|
if (tag !== 18) {
|
|
98
81
|
break;
|
|
@@ -10,29 +10,29 @@ export interface AnimatorComponentDefinitionExtended extends LastWriteWinElement
|
|
|
10
10
|
*
|
|
11
11
|
* Get a `mutable` version of animator clip
|
|
12
12
|
* @param entity - entity with Animator component
|
|
13
|
-
* @param
|
|
13
|
+
* @param clipName - the field `clip` of the component
|
|
14
14
|
* @returns the clip or fails if it isn't found
|
|
15
15
|
*/
|
|
16
|
-
getClip(entity: Entity,
|
|
16
|
+
getClip(entity: Entity, clipName: string): PBAnimationState;
|
|
17
17
|
/**
|
|
18
18
|
* @public
|
|
19
19
|
*
|
|
20
20
|
* Get a `mutable` version of animator clip
|
|
21
21
|
* @param entity - entity with Animator component
|
|
22
|
-
* @param
|
|
22
|
+
* @param clipName - the field `clip` of the component
|
|
23
23
|
* @returns the clip or null if it isn't found
|
|
24
24
|
*/
|
|
25
|
-
getClipOrNull(entity: Entity,
|
|
25
|
+
getClipOrNull(entity: Entity, clipName: string): PBAnimationState | null;
|
|
26
26
|
/**
|
|
27
27
|
* @public
|
|
28
28
|
*
|
|
29
29
|
* Set playing=true the animation `$name`
|
|
30
30
|
* @param entity - entity with Animator component
|
|
31
|
-
* @param
|
|
31
|
+
* @param clipName - animation name
|
|
32
32
|
* @param resetCursor - the animation starts at 0 or continues from the current cursor position
|
|
33
33
|
* @returns true in successful playing, false if it doesn't find the Animator or clip
|
|
34
34
|
*/
|
|
35
|
-
playSingleAnimation(entity: Entity,
|
|
35
|
+
playSingleAnimation(entity: Entity, clipName: string, resetCursor?: boolean): boolean;
|
|
36
36
|
/**
|
|
37
37
|
* @public
|
|
38
38
|
*
|
|
@@ -7,33 +7,33 @@ function defineAnimatorComponent(engine) {
|
|
|
7
7
|
/**
|
|
8
8
|
* @returns The tuple [animator, clip]
|
|
9
9
|
*/
|
|
10
|
-
function getClipAndAnimator(entity,
|
|
10
|
+
function getClipAndAnimator(entity, clipName) {
|
|
11
11
|
const anim = theComponent.getMutableOrNull(entity);
|
|
12
12
|
if (!anim)
|
|
13
13
|
return [null, null];
|
|
14
|
-
const state = anim.states.find((item) => item.
|
|
14
|
+
const state = anim.states.find((item) => item.clip === clipName);
|
|
15
15
|
if (!state)
|
|
16
16
|
return [anim, null];
|
|
17
17
|
return [anim, state];
|
|
18
18
|
}
|
|
19
19
|
return {
|
|
20
20
|
...theComponent,
|
|
21
|
-
getClipOrNull(entity,
|
|
22
|
-
const [_, state] = getClipAndAnimator(entity,
|
|
21
|
+
getClipOrNull(entity, clipName) {
|
|
22
|
+
const [_, state] = getClipAndAnimator(entity, clipName);
|
|
23
23
|
return state;
|
|
24
24
|
},
|
|
25
|
-
getClip(entity,
|
|
26
|
-
const [animator, state] = getClipAndAnimator(entity,
|
|
25
|
+
getClip(entity, clipName) {
|
|
26
|
+
const [animator, state] = getClipAndAnimator(entity, clipName);
|
|
27
27
|
if (!animator) {
|
|
28
28
|
throw new Error(`There is no Animator found in the entity ${entity}`);
|
|
29
29
|
}
|
|
30
30
|
if (!state) {
|
|
31
|
-
throw new Error(`The Animator component of ${entity} has no the state ${
|
|
31
|
+
throw new Error(`The Animator component of ${entity} has no the state ${clipName}`);
|
|
32
32
|
}
|
|
33
33
|
return state;
|
|
34
34
|
},
|
|
35
|
-
playSingleAnimation(entity,
|
|
36
|
-
const [animator, state] = getClipAndAnimator(entity,
|
|
35
|
+
playSingleAnimation(entity, clipName, shouldReset = true) {
|
|
36
|
+
const [animator, state] = getClipAndAnimator(entity, clipName);
|
|
37
37
|
if (!animator || !state)
|
|
38
38
|
return false;
|
|
39
39
|
// Reset all other animations
|
|
@@ -19,8 +19,6 @@ export interface PBAnimator {
|
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
21
|
export interface PBAnimationState {
|
|
22
|
-
/** the identifier for this animation, to use in scene code */
|
|
23
|
-
name: string;
|
|
24
22
|
/** the animation path in the `files` array of the scene manifest */
|
|
25
23
|
clip: string;
|
|
26
24
|
/** whether this animation is currently playing */
|
|
@@ -46,15 +46,7 @@ var PBAnimator;
|
|
|
46
46
|
PBAnimator.decode = decode;
|
|
47
47
|
})(PBAnimator = exports.PBAnimator || (exports.PBAnimator = {}));
|
|
48
48
|
function createBasePBAnimationState() {
|
|
49
|
-
return {
|
|
50
|
-
name: "",
|
|
51
|
-
clip: "",
|
|
52
|
-
playing: undefined,
|
|
53
|
-
weight: undefined,
|
|
54
|
-
speed: undefined,
|
|
55
|
-
loop: undefined,
|
|
56
|
-
shouldReset: undefined,
|
|
57
|
-
};
|
|
49
|
+
return { clip: "", playing: undefined, weight: undefined, speed: undefined, loop: undefined, shouldReset: undefined };
|
|
58
50
|
}
|
|
59
51
|
/**
|
|
60
52
|
* @public
|
|
@@ -62,9 +54,6 @@ function createBasePBAnimationState() {
|
|
|
62
54
|
var PBAnimationState;
|
|
63
55
|
(function (PBAnimationState) {
|
|
64
56
|
function encode(message, writer = minimal_1.default.Writer.create()) {
|
|
65
|
-
if (message.name !== "") {
|
|
66
|
-
writer.uint32(10).string(message.name);
|
|
67
|
-
}
|
|
68
57
|
if (message.clip !== "") {
|
|
69
58
|
writer.uint32(18).string(message.clip);
|
|
70
59
|
}
|
|
@@ -93,12 +82,6 @@ var PBAnimationState;
|
|
|
93
82
|
while (reader.pos < end) {
|
|
94
83
|
const tag = reader.uint32();
|
|
95
84
|
switch (tag >>> 3) {
|
|
96
|
-
case 1:
|
|
97
|
-
if (tag !== 10) {
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
message.name = reader.string();
|
|
101
|
-
continue;
|
|
102
85
|
case 2:
|
|
103
86
|
if (tag !== 18) {
|
|
104
87
|
break;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.3.16-
|
|
4
|
+
"version": "7.3.16-6315152803.commit-5f2bd57",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/ecs/issues",
|
|
7
7
|
"files": [
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
},
|
|
34
34
|
"types": "./dist/index.d.ts",
|
|
35
35
|
"typings": "./dist/index.d.ts",
|
|
36
|
-
"commit": "
|
|
36
|
+
"commit": "5f2bd57b531ce41777a066b594fed4385cd3d034"
|
|
37
37
|
}
|