@dcl/ecs 7.27.1-34244650155.commit-6b7c358 → 7.27.1-34408294078.commit-b42ad9d
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.
|
@@ -16,17 +16,22 @@ import * as components from '../components';
|
|
|
16
16
|
*/
|
|
17
17
|
export function cyclicParentingChecker(engine) {
|
|
18
18
|
const Transform = components.Transform(engine);
|
|
19
|
+
// Reused by every walk: the checker is synchronous, so only one is ever in
|
|
20
|
+
// flight. A cycle anywhere above the entity has to end the walk, not only one
|
|
21
|
+
// the entity is part of, otherwise the ancestors repeat forever.
|
|
22
|
+
const visited = new Set();
|
|
19
23
|
return () => {
|
|
20
24
|
for (const entity of Transform.dirtyIterator()) {
|
|
25
|
+
visited.clear();
|
|
26
|
+
visited.add(entity);
|
|
21
27
|
let transform = Transform.getOrNull(entity);
|
|
22
28
|
while (transform && transform.parent) {
|
|
23
|
-
if (transform.parent
|
|
29
|
+
if (visited.has(transform.parent)) {
|
|
24
30
|
console.error(`There is a cyclic parent with entity ${entity}`);
|
|
25
31
|
break;
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
33
|
+
visited.add(transform.parent);
|
|
34
|
+
transform = Transform.getOrNull(transform.parent);
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
};
|
|
@@ -42,17 +42,22 @@ const components = __importStar(require("../components"));
|
|
|
42
42
|
*/
|
|
43
43
|
function cyclicParentingChecker(engine) {
|
|
44
44
|
const Transform = components.Transform(engine);
|
|
45
|
+
// Reused by every walk: the checker is synchronous, so only one is ever in
|
|
46
|
+
// flight. A cycle anywhere above the entity has to end the walk, not only one
|
|
47
|
+
// the entity is part of, otherwise the ancestors repeat forever.
|
|
48
|
+
const visited = new Set();
|
|
45
49
|
return () => {
|
|
46
50
|
for (const entity of Transform.dirtyIterator()) {
|
|
51
|
+
visited.clear();
|
|
52
|
+
visited.add(entity);
|
|
47
53
|
let transform = Transform.getOrNull(entity);
|
|
48
54
|
while (transform && transform.parent) {
|
|
49
|
-
if (transform.parent
|
|
55
|
+
if (visited.has(transform.parent)) {
|
|
50
56
|
console.error(`There is a cyclic parent with entity ${entity}`);
|
|
51
57
|
break;
|
|
52
58
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
59
|
+
visited.add(transform.parent);
|
|
60
|
+
transform = Transform.getOrNull(transform.parent);
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/ecs",
|
|
3
3
|
"description": "Decentraland ECS",
|
|
4
|
-
"version": "7.27.1-
|
|
4
|
+
"version": "7.27.1-34408294078.commit-b42ad9d",
|
|
5
5
|
"author": "DCL",
|
|
6
6
|
"bugs": "https://github.com/decentraland/ecs/issues",
|
|
7
7
|
"files": [
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"dependencies": {},
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
36
|
"typings": "./dist/index.d.ts",
|
|
37
|
-
"commit": "
|
|
37
|
+
"commit": "b42ad9d34df95c6eca43a979e5d2255114246548"
|
|
38
38
|
}
|