forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity.js
More file actions
788 lines (696 loc) · 25.1 KB
/
Copy pathentity.js
File metadata and controls
788 lines (696 loc) · 25.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
import { Debug } from '../core/debug.js';
import { guid } from '../core/guid.js';
import { GraphNode } from '../scene/graph-node.js';
import { getApplication } from './globals.js';
/**
* @import { AnimComponent } from './components/anim/component.js'
* @import { AnimationComponent } from './components/animation/component.js'
* @import { AppBase } from './app-base.js'
* @import { AudioListenerComponent } from './components/audio-listener/component.js'
* @import { ButtonComponent } from './components/button/component.js'
* @import { CameraComponent } from './components/camera/component.js'
* @import { CollisionComponent } from './components/collision/component.js'
* @import { Component } from './components/component.js'
* @import { ElementComponent } from './components/element/component.js'
* @import { GSplatComponent } from './components/gsplat/component.js'
* @import { LayoutChildComponent } from './components/layout-child/component.js'
* @import { LayoutGroupComponent } from './components/layout-group/component.js'
* @import { LightComponent } from './components/light/component.js'
* @import { ModelComponent } from './components/model/component.js'
* @import { ParticleSystemComponent } from './components/particle-system/component.js'
* @import { RenderComponent } from './components/render/component.js'
* @import { RigidBodyComponent } from './components/rigid-body/component.js'
* @import { ScreenComponent } from './components/screen/component.js'
* @import { ScriptComponent } from './components/script/component.js'
* @import { ScriptType } from './script/script-type.js'
* @import { ScrollViewComponent } from './components/scroll-view/component.js'
* @import { ScrollbarComponent } from './components/scrollbar/component.js'
* @import { SoundComponent } from './components/sound/component.js'
* @import { SpriteComponent } from './components/sprite/component.js'
*/
/**
* @param {Component} a - First object with `order` property.
* @param {Component} b - Second object with `order` property.
* @returns {number} A number indicating the relative position.
*/
const cmpStaticOrder = (a, b) => a.constructor.order - b.constructor.order;
/**
* @param {Array<Component>} arr - Array to be sorted in place where each element contains
* an object with a static `order` property.
* @returns {Array<Component>} In place sorted array.
*/
const sortStaticOrder = arr => arr.sort(cmpStaticOrder);
/**
* @type {GraphNode[]}
*/
const _enableList = [];
/**
* @type {Array<Array<Component>>}
*/
const tmpPool = [];
const getTempArray = () => {
return tmpPool.pop() ?? [];
};
/**
* @param {Array<Component>} a - Array to return back to pool.
*/
const releaseTempArray = (a) => {
a.length = 0;
tmpPool.push(a);
};
/**
* The Entity is a core primitive of a PlayCanvas application. Generally speaking, any object in
* your application will be represented by an Entity, along with a set of {@link Component}s. Each
* component enables a particular capability. For example, the {@link RenderComponent} enables an
* entity to render a 3D model, and the {@link ScriptComponent} enables an entity to run code that
* implements custom behavior.
*
* Entity is a subclass of {@link GraphNode} which allows entities to form a tree-like hierarchy
* (based on parent/child relationships). The root of the entity hierarchy can be queried with
* {@link AppBase#root}. Entities inherit a 3D transform from {@link GraphNode} which allows them
* to be positioned, rotated and scaled.
*/
class Entity extends GraphNode {
/**
* Fired after the entity is destroyed.
*
* @event
* @example
* entity.on('destroy', (e) => {
* console.log(`Entity ${e.name} has been destroyed`);
* });
*/
static EVENT_DESTROY = 'destroy';
/**
* Gets the {@link AnimComponent} attached to this entity.
*
* @type {AnimComponent|undefined}
* @readonly
*/
anim;
/**
* Gets the {@link AnimationComponent} attached to this entity.
*
* @type {AnimationComponent|undefined}
* @readonly
*/
animation;
/**
* Gets the {@link AudioListenerComponent} attached to this entity.
*
* @type {AudioListenerComponent|undefined}
* @readonly
*/
audiolistener;
/**
* Gets the {@link ButtonComponent} attached to this entity.
*
* @type {ButtonComponent|undefined}
* @readonly
*/
button;
/**
* Gets the {@link CameraComponent} attached to this entity.
*
* @type {CameraComponent|undefined}
* @readonly
*/
camera;
/**
* Gets the {@link CollisionComponent} attached to this entity.
*
* @type {CollisionComponent|undefined}
* @readonly
*/
collision;
/**
* Gets the {@link ElementComponent} attached to this entity.
*
* @type {ElementComponent|undefined}
* @readonly
*/
element;
/**
* Gets the {@link GSplatComponent} attached to this entity.
*
* @type {GSplatComponent|undefined}
* @readonly
*/
gsplat;
/**
* Gets the {@link LayoutChildComponent} attached to this entity.
*
* @type {LayoutChildComponent|undefined}
* @readonly
*/
layoutchild;
/**
* Gets the {@link LayoutGroupComponent} attached to this entity.
*
* @type {LayoutGroupComponent|undefined}
* @readonly
*/
layoutgroup;
/**
* Gets the {@link LightComponent} attached to this entity.
*
* @type {LightComponent|undefined}
* @readonly
*/
light;
/**
* Gets the {@link ModelComponent} attached to this entity.
*
* @type {ModelComponent|undefined}
* @readonly
*/
model;
/**
* Gets the {@link ParticleSystemComponent} attached to this entity.
*
* @type {ParticleSystemComponent|undefined}
* @readonly
*/
particlesystem;
/**
* Gets the {@link RenderComponent} attached to this entity.
*
* @type {RenderComponent|undefined}
* @readonly
*/
render;
/**
* Gets the {@link RigidBodyComponent} attached to this entity.
*
* @type {RigidBodyComponent|undefined}
* @readonly
*/
rigidbody;
/**
* Gets the {@link ScreenComponent} attached to this entity.
*
* @type {ScreenComponent|undefined}
* @readonly
*/
screen;
/**
* Gets the {@link ScriptComponent} attached to this entity.
*
* @type {ScriptComponent|undefined}
* @readonly
*/
script;
/**
* Gets the {@link ScrollbarComponent} attached to this entity.
*
* @type {ScrollbarComponent|undefined}
* @readonly
*/
scrollbar;
/**
* Gets the {@link ScrollViewComponent} attached to this entity.
*
* @type {ScrollViewComponent|undefined}
* @readonly
*/
scrollview;
/**
* Gets the {@link SoundComponent} attached to this entity.
*
* @type {SoundComponent|undefined}
* @readonly
*/
sound;
/**
* Gets the {@link SpriteComponent} attached to this entity.
*
* @type {SpriteComponent|undefined}
* @readonly
*/
sprite;
/**
* Component storage.
*
* @type {Object<string, Component>}
* @ignore
*/
c = {};
/**
* @type {AppBase}
* @private
*/
_app;
/**
* Used by component systems to speed up destruction.
*
* @type {boolean}
* @ignore
*/
_destroying = false;
/**
* @type {string|null}
* @private
*/
_guid = null;
/**
* Used to differentiate between the entities of a template root instance, which have it set to
* true, and the cloned instance entities (set to false).
*
* @type {boolean}
* @ignore
*/
_template = false;
/**
* Create a new Entity.
*
* @param {string} [name] - The non-unique name of the entity, default is "Untitled".
* @param {AppBase} [app] - The application the entity belongs to, default is the current
* application.
* @example
* const entity = new pc.Entity();
*
* // Add a Component to the Entity
* entity.addComponent('camera', {
* fov: 45,
* nearClip: 1,
* farClip: 10000
* });
*
* // Add the Entity into the scene graph
* app.root.addChild(entity);
*
* // Move the entity
* entity.translate(10, 0, 0);
*
* // Or translate it by setting its position directly
* const p = entity.getPosition();
* entity.setPosition(p.x + 10, p.y, p.z);
*
* // Change the entity's rotation in local space
* const e = entity.getLocalEulerAngles();
* entity.setLocalEulerAngles(e.x, e.y + 90, e.z);
*
* // Or use rotateLocal
* entity.rotateLocal(0, 90, 0);
*/
constructor(name, app = getApplication()) {
super(name);
Debug.assert(app, 'Could not find current application');
this._app = app;
}
/**
* Create a new component and add it to the entity. Use this to add functionality to the entity
* like rendering a model, playing sounds and so on.
*
* @param {string} type - The name of the component to add. Valid strings are:
*
* - "anim" - see {@link AnimComponent}
* - "animation" - see {@link AnimationComponent}
* - "audiolistener" - see {@link AudioListenerComponent}
* - "button" - see {@link ButtonComponent}
* - "camera" - see {@link CameraComponent}
* - "collision" - see {@link CollisionComponent}
* - "element" - see {@link ElementComponent}
* - "gsplat" - see {@link GSplatComponent}
* - "layoutchild" - see {@link LayoutChildComponent}
* - "layoutgroup" - see {@link LayoutGroupComponent}
* - "light" - see {@link LightComponent}
* - "model" - see {@link ModelComponent}
* - "particlesystem" - see {@link ParticleSystemComponent}
* - "render" - see {@link RenderComponent}
* - "rigidbody" - see {@link RigidBodyComponent}
* - "screen" - see {@link ScreenComponent}
* - "script" - see {@link ScriptComponent}
* - "scrollbar" - see {@link ScrollbarComponent}
* - "scrollview" - see {@link ScrollViewComponent}
* - "sound" - see {@link SoundComponent}
* - "sprite" - see {@link SpriteComponent}
*
* @param {object} [data] - The initialization data for the specific component type. Refer to
* each specific component's API reference page for details on valid values for this parameter.
* @returns {Component|null} The new Component that was attached to the entity or null if there
* was an error.
* @example
* const entity = new pc.Entity();
*
* // Add a light component with default properties
* entity.addComponent("light");
*
* // Add a camera component with some specified properties
* entity.addComponent("camera", {
* fov: 45,
* clearColor: new pc.Color(1, 0, 0)
* });
*/
addComponent(type, data) {
const system = this._app.systems[type];
if (!system) {
Debug.error(`addComponent: System '${type}' doesn't exist`);
return null;
}
if (this.c[type]) {
Debug.warn(`addComponent: Entity already has '${type}' component`);
return null;
}
return system.addComponent(this, data);
}
/**
* Remove a component from the Entity.
*
* @param {string} type - The name of the Component type.
* @example
* const entity = new pc.Entity();
* entity.addComponent("light"); // add new light component
*
* entity.removeComponent("light"); // remove light component
*/
removeComponent(type) {
const system = this._app.systems[type];
if (!system) {
Debug.error(`removeComponent: System '${type}' doesn't exist`);
return;
}
if (!this.c[type]) {
Debug.warn(`removeComponent: Entity doesn't have '${type}' component`);
return;
}
system.removeComponent(this);
}
/**
* Search the entity and all of its descendants for the first component of specified type.
*
* @param {string} type - The name of the component type to retrieve.
* @returns {Component} A component of specified type, if the entity or any of its descendants
* has one. Returns undefined otherwise.
* @example
* // Get the first found light component in the hierarchy tree that starts with this entity
* const light = entity.findComponent("light");
*/
findComponent(type) {
const entity = this.findOne(entity => entity.c?.[type]);
return entity && entity.c[type];
}
/**
* Search the entity and all of its descendants for all components of specified type.
*
* @param {string} type - The name of the component type to retrieve.
* @returns {Component[]} All components of specified type in the entity or any of its
* descendants. Returns empty array if none found.
* @example
* // Get all light components in the hierarchy tree that starts with this entity
* const lights = entity.findComponents("light");
*/
findComponents(type) {
return this.find(entity => entity.c?.[type]).map(entity => entity.c[type]);
}
/**
* Search the entity and all of its descendants for the first script instance of specified type.
*
* @param {string|typeof ScriptType} nameOrType - The name or type of {@link ScriptType}.
* @returns {ScriptType|undefined} A script instance of specified type, if the entity or any of
* its descendants has one. Returns undefined otherwise.
* @example
* // Get the first found "playerController" instance in the hierarchy tree that starts with this entity
* const controller = entity.findScript("playerController");
*/
findScript(nameOrType) {
const entity = this.findOne(node => node.c?.script?.has(nameOrType));
return entity?.c.script.get(nameOrType);
}
/**
* Search the entity and all of its descendants for all script instances of specified type.
*
* @param {string|typeof ScriptType} nameOrType - The name or type of {@link ScriptType}.
* @returns {ScriptType[]} All script instances of specified type in the entity or any of its
* descendants. Returns empty array if none found.
* @example
* // Get all "playerController" instances in the hierarchy tree that starts with this entity
* const controllers = entity.findScripts("playerController");
*/
findScripts(nameOrType) {
const entities = this.find(node => node.c?.script?.has(nameOrType));
return entities.map(entity => entity.c.script.get(nameOrType));
}
/**
* Get the GUID value for this Entity.
*
* @returns {string} The GUID of the Entity.
* @ignore
*/
getGuid() {
// if the guid hasn't been set yet then set it now before returning it
if (!this._guid) {
this.setGuid(guid.create());
}
return this._guid;
}
/**
* Set the GUID value for this Entity. Note that it is unlikely that you should need to change
* the GUID value of an Entity at run-time. Doing so will corrupt the graph this Entity is in.
*
* @param {string} guid - The GUID to assign to the Entity.
* @ignore
*/
setGuid(guid) {
// remove current guid from entityIndex
const index = this._app._entityIndex;
if (this._guid) {
delete index[this._guid];
}
// add new guid to entityIndex
this._guid = guid;
index[this._guid] = this;
}
/**
* @param {GraphNode} node - The node to update.
* @param {boolean} enabled - Enable or disable the node.
* @protected
*/
_notifyHierarchyStateChanged(node, enabled) {
let enableFirst = false;
if (node === this && _enableList.length === 0) {
enableFirst = true;
}
node._beingEnabled = true;
node._onHierarchyStateChanged(enabled);
if (node._onHierarchyStatePostChanged) {
_enableList.push(node);
}
const c = node._children;
for (let i = 0, len = c.length; i < len; i++) {
if (c[i]._enabled) {
this._notifyHierarchyStateChanged(c[i], enabled);
}
}
node._beingEnabled = false;
if (enableFirst) {
// do not cache the length here, as enableList may be added to during loop
for (let i = 0; i < _enableList.length; i++) {
_enableList[i]._onHierarchyStatePostChanged();
}
_enableList.length = 0;
}
}
/**
* @param {boolean} enabled - Enable or disable the node.
* @protected
*/
_onHierarchyStateChanged(enabled) {
super._onHierarchyStateChanged(enabled);
const components = this._getSortedComponents();
for (let i = 0; i < components.length; i++) {
const component = components[i];
if (component.enabled) {
if (enabled) {
component.onEnable();
} else {
component.onDisable();
}
}
}
releaseTempArray(components);
}
/** @private */
_onHierarchyStatePostChanged() {
// post enable all the components
const components = this._getSortedComponents();
for (let i = 0; i < components.length; i++) {
components[i].onPostStateChange();
}
releaseTempArray(components);
}
/**
* Find a descendant of this entity with the GUID.
*
* @param {string} guid - The GUID to search for.
* @returns {Entity|null} The entity with the matching GUID or null if no entity is found.
*/
findByGuid(guid) {
if (this._guid === guid) return this;
const e = this._app._entityIndex[guid];
if (e && (e === this || e.isDescendantOf(this))) {
return e;
}
return null;
}
/**
* Destroy the entity and all of its descendants. First, all of the entity's components are
* disabled and then removed. Then, the entity is removed from the hierarchy. This is then
* repeated recursively for all descendants of the entity.
*
* The last thing the entity does is fire the `destroy` event.
*
* @example
* const firstChild = this.entity.children[0];
* firstChild.destroy(); // destroy child and all of its descendants
*/
destroy() {
this._destroying = true;
// Disable all enabled components first
for (const name in this.c) {
this.c[name].enabled = false;
}
// Remove all components
for (const name in this.c) {
this.c[name].system.removeComponent(this);
}
super.destroy();
// remove from entity index
if (this._guid) {
delete this._app._entityIndex[this._guid];
}
this._destroying = false;
}
/**
* Create a deep copy of the Entity. Duplicate the full Entity hierarchy, with all Components
* and all descendants. Note, this Entity is not in the hierarchy and must be added manually.
*
* @returns {this} A new Entity which is a deep copy of the original.
* @example
* const e = this.entity.clone();
*
* // Add clone as a sibling to the original
* this.entity.parent.addChild(e);
*/
clone() {
const duplicatedIdsMap = {};
const clone = this._cloneRecursively(duplicatedIdsMap);
duplicatedIdsMap[this.getGuid()] = clone;
resolveDuplicatedEntityReferenceProperties(this, this, clone, duplicatedIdsMap);
return clone;
}
_getSortedComponents() {
const components = this.c;
const sortedArray = getTempArray();
let needSort = 0;
for (const type in components) {
if (components.hasOwnProperty(type)) {
const component = components[type];
needSort |= component.constructor.order !== 0;
sortedArray.push(component);
}
}
if (needSort && sortedArray.length > 1) {
sortStaticOrder(sortedArray);
}
return sortedArray;
}
/**
* @param {Object<string, Entity>} duplicatedIdsMap - A map of original entity GUIDs to cloned
* entities.
* @returns {this} A new Entity which is a deep copy of the original.
* @private
*/
_cloneRecursively(duplicatedIdsMap) {
/** @type {this} */
const clone = new this.constructor(undefined, this._app);
super._cloneInternal(clone);
for (const type in this.c) {
const component = this.c[type];
component.system.cloneComponent(this, clone);
}
for (let i = 0; i < this._children.length; i++) {
const oldChild = this._children[i];
if (oldChild instanceof Entity) {
const newChild = oldChild._cloneRecursively(duplicatedIdsMap);
clone.addChild(newChild);
duplicatedIdsMap[oldChild.getGuid()] = newChild;
}
}
return clone;
}
}
/**
* When an entity that has properties that contain references to other entities within its subtree
* is duplicated, the expectation of the user is likely that those properties will be updated to
* point to the corresponding entities within the newly-created duplicate subtree.
*
* To handle this, we need to search for properties that refer to entities within the old
* duplicated structure, find their newly-cloned partners within the new structure, and update the
* references accordingly. This function implements that requirement.
*
* @param {Entity} oldSubtreeRoot - The root of the duplicated entity subtree that is being
* resolved.
* @param {Entity} oldEntity - The entity within the old duplicated subtree that is being resolved.
* @param {Entity} newEntity - The entity within the new duplicated subtree that is being resolved.
* @param {Object<string, Entity>} duplicatedIdsMap - A map of original entity GUIDs to cloned
* entities.
* @private
*/
function resolveDuplicatedEntityReferenceProperties(oldSubtreeRoot, oldEntity, newEntity, duplicatedIdsMap) {
if (oldEntity instanceof Entity) {
const components = oldEntity.c;
// Handle component properties
for (const componentName in components) {
const component = components[componentName];
const entityProperties = component.system.getPropertiesOfType('entity');
for (let i = 0, len = entityProperties.length; i < len; i++) {
const propertyDescriptor = entityProperties[i];
const propertyName = propertyDescriptor.name;
const oldEntityReferenceId = component[propertyName];
const entityIsWithinOldSubtree = !!oldSubtreeRoot.findByGuid(oldEntityReferenceId);
if (entityIsWithinOldSubtree) {
const newEntityReferenceId = duplicatedIdsMap[oldEntityReferenceId].getGuid();
if (newEntityReferenceId) {
newEntity.c[componentName][propertyName] = newEntityReferenceId;
} else {
Debug.warn('Could not find corresponding entity id when resolving duplicated entity references');
}
}
}
}
// Handle entity script attributes
if (components.script) {
newEntity.script.resolveDuplicatedEntityReferenceProperties(components.script, duplicatedIdsMap);
}
// Handle entity render attributes
if (components.render) {
newEntity.render.resolveDuplicatedEntityReferenceProperties(components.render, duplicatedIdsMap);
}
// Handle entity button attributes
if (components.button) {
newEntity.button.resolveDuplicatedEntityReferenceProperties(components.button, duplicatedIdsMap);
}
// Handle entity scrollview attributes
if (components.scrollview) {
newEntity.scrollview.resolveDuplicatedEntityReferenceProperties(components.scrollview, duplicatedIdsMap);
}
// Handle entity scrollbar attributes
if (components.scrollbar) {
newEntity.scrollbar.resolveDuplicatedEntityReferenceProperties(components.scrollbar, duplicatedIdsMap);
}
// Handle entity anim attributes
if (components.anim) {
newEntity.anim.resolveDuplicatedEntityReferenceProperties(components.anim, duplicatedIdsMap);
}
// Recurse into children. Note that we continue to pass in the same `oldSubtreeRoot`, in
// order to correctly handle cases where a child has an entity reference field that points
// to a parent or other ancestor that is still within the duplicated subtree.
const _old = oldEntity.children.filter(e => e instanceof Entity);
const _new = newEntity.children.filter(e => e instanceof Entity);
for (let i = 0, len = _old.length; i < len; i++) {
resolveDuplicatedEntityReferenceProperties(oldSubtreeRoot, _old[i], _new[i], duplicatedIdsMap);
}
}
}
export { Entity };