node.ts 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. import { Scene } from "scene";
  2. import { Nullable } from "types";
  3. import { Matrix } from "Maths/math";
  4. import { Engine } from "Engines/engine";
  5. import { IBehaviorAware, Behavior } from "Behaviors/behavior";
  6. import { serialize } from "Misc/decorators";
  7. import { Observable, Observer } from "Misc/observable";
  8. declare type Animatable = import("Animations/animatable").Animatable;
  9. declare type AnimationPropertiesOverride = import("Animations/animationPropertiesOverride").AnimationPropertiesOverride;
  10. declare type Animation = import("Animations/animation").Animation;
  11. declare type AnimationRange = import("Animations/animation").AnimationRange;
  12. declare type AbstractMesh = import("Meshes/abstractMesh").AbstractMesh;
  13. /**
  14. * Defines how a node can be built from a string name.
  15. */
  16. export type NodeConstructor = (name: string, scene: Scene, options?: any) => () => Node;
  17. /**
  18. * Node is the basic class for all scene objects (Mesh, Light, Camera.)
  19. */
  20. export class Node implements IBehaviorAware<Node> {
  21. /** @hidden */
  22. public static _AnimationRangeFactory = (name: string, from: number, to: number): AnimationRange => {
  23. throw "AnimationRange needs to be imported from animation before being created.";
  24. }
  25. private static _NodeConstructors: { [key: string]: any } = {};
  26. /**
  27. * Add a new node constructor
  28. * @param type defines the type name of the node to construct
  29. * @param constructorFunc defines the constructor function
  30. */
  31. public static AddNodeConstructor(type: string, constructorFunc: NodeConstructor) {
  32. this._NodeConstructors[type] = constructorFunc;
  33. }
  34. /**
  35. * Returns a node constructor based on type name
  36. * @param type defines the type name
  37. * @param name defines the new node name
  38. * @param scene defines the hosting scene
  39. * @param options defines optional options to transmit to constructors
  40. * @returns the new constructor or null
  41. */
  42. public static Construct(type: string, name: string, scene: Scene, options?: any): Nullable<() => Node> {
  43. let constructorFunc = this._NodeConstructors[type];
  44. if (!constructorFunc) {
  45. return null;
  46. }
  47. return constructorFunc(name, scene, options);
  48. }
  49. /**
  50. * Gets or sets the name of the node
  51. */
  52. @serialize()
  53. public name: string;
  54. /**
  55. * Gets or sets the id of the node
  56. */
  57. @serialize()
  58. public id: string;
  59. /**
  60. * Gets or sets the unique id of the node
  61. */
  62. @serialize()
  63. public uniqueId: number;
  64. /**
  65. * Gets or sets a string used to store user defined state for the node
  66. */
  67. @serialize()
  68. public state = "";
  69. /**
  70. * Gets or sets an object used to store user defined information for the node
  71. */
  72. @serialize()
  73. public metadata: any = null;
  74. /**
  75. * For internal use only. Please do not use.
  76. */
  77. public reservedDataStore: any = null;
  78. /**
  79. * Gets or sets a boolean used to define if the node must be serialized
  80. */
  81. public doNotSerialize = false;
  82. /** @hidden */
  83. public _isDisposed = false;
  84. /**
  85. * Gets a list of Animations associated with the node
  86. */
  87. public animations = new Array<Animation>();
  88. protected _ranges: { [name: string]: Nullable<AnimationRange> } = {};
  89. /**
  90. * Callback raised when the node is ready to be used
  91. */
  92. public onReady: (node: Node) => void;
  93. private _isEnabled = true;
  94. private _isParentEnabled = true;
  95. private _isReady = true;
  96. /** @hidden */
  97. public _currentRenderId = -1;
  98. private _parentRenderId = -1;
  99. protected _childRenderId = -1;
  100. /** @hidden */
  101. public _waitingParentId: Nullable<string>;
  102. /** @hidden */
  103. public _scene: Scene;
  104. /** @hidden */
  105. public _cache: any;
  106. private _parentNode: Nullable<Node>;
  107. private _children: Node[];
  108. /** @hidden */
  109. public _worldMatrix = Matrix.Identity();
  110. /** @hidden */
  111. public _worldMatrixDeterminant = 0;
  112. /** @hidden */
  113. private _sceneRootNodesIndex = -1;
  114. /**
  115. * Gets a boolean indicating if the node has been disposed
  116. * @returns true if the node was disposed
  117. */
  118. public isDisposed(): boolean {
  119. return this._isDisposed;
  120. }
  121. /**
  122. * Gets or sets the parent of the node
  123. */
  124. public set parent(parent: Nullable<Node>) {
  125. if (this._parentNode === parent) {
  126. return;
  127. }
  128. const previousParentNode = this._parentNode;
  129. // Remove self from list of children of parent
  130. if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {
  131. var index = this._parentNode._children.indexOf(this);
  132. if (index !== -1) {
  133. this._parentNode._children.splice(index, 1);
  134. }
  135. if (!parent && !this._isDisposed) {
  136. this.addToSceneRootNodes();
  137. }
  138. }
  139. // Store new parent
  140. this._parentNode = parent;
  141. // Add as child to new parent
  142. if (this._parentNode) {
  143. if (this._parentNode._children === undefined || this._parentNode._children === null) {
  144. this._parentNode._children = new Array<Node>();
  145. }
  146. this._parentNode._children.push(this);
  147. if (!previousParentNode) {
  148. this.removeFromSceneRootNodes();
  149. }
  150. }
  151. // Enabled state
  152. this._syncParentEnabledState();
  153. }
  154. public get parent(): Nullable<Node> {
  155. return this._parentNode;
  156. }
  157. private addToSceneRootNodes() {
  158. if (this._sceneRootNodesIndex === -1) {
  159. this._sceneRootNodesIndex = this._scene.rootNodes.length;
  160. this._scene.rootNodes.push(this);
  161. }
  162. }
  163. private removeFromSceneRootNodes() {
  164. if (this._sceneRootNodesIndex !== -1) {
  165. const rootNodes = this._scene.rootNodes;
  166. const lastIdx = rootNodes.length - 1;
  167. rootNodes[this._sceneRootNodesIndex] = rootNodes[lastIdx];
  168. rootNodes[this._sceneRootNodesIndex]._sceneRootNodesIndex = this._sceneRootNodesIndex;
  169. this._scene.rootNodes.pop();
  170. this._sceneRootNodesIndex = -1;
  171. }
  172. }
  173. private _animationPropertiesOverride: Nullable<AnimationPropertiesOverride> = null;
  174. /**
  175. * Gets or sets the animation properties override
  176. */
  177. public get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride> {
  178. if (!this._animationPropertiesOverride) {
  179. return this._scene.animationPropertiesOverride;
  180. }
  181. return this._animationPropertiesOverride;
  182. }
  183. public set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>) {
  184. this._animationPropertiesOverride = value;
  185. }
  186. /**
  187. * Gets a string idenfifying the name of the class
  188. * @returns "Node" string
  189. */
  190. public getClassName(): string {
  191. return "Node";
  192. }
  193. /** @hidden */
  194. public readonly _isNode = true;
  195. /**
  196. * An event triggered when the mesh is disposed
  197. */
  198. public onDisposeObservable = new Observable<Node>();
  199. private _onDisposeObserver: Nullable<Observer<Node>>;
  200. /**
  201. * Sets a callback that will be raised when the node will be disposed
  202. */
  203. public set onDispose(callback: () => void) {
  204. if (this._onDisposeObserver) {
  205. this.onDisposeObservable.remove(this._onDisposeObserver);
  206. }
  207. this._onDisposeObserver = this.onDisposeObservable.add(callback);
  208. }
  209. /**
  210. * Creates a new Node
  211. * @param name the name and id to be given to this node
  212. * @param scene the scene this node will be added to
  213. * @param addToRootNodes the node will be added to scene.rootNodes
  214. */
  215. constructor(name: string, scene: Nullable<Scene> = null, addToRootNodes = true) {
  216. this.name = name;
  217. this.id = name;
  218. this._scene = <Scene>(scene || Engine.LastCreatedScene);
  219. this.uniqueId = this._scene.getUniqueId();
  220. this._initCache();
  221. if (addToRootNodes) {
  222. this.addToSceneRootNodes();
  223. }
  224. }
  225. /**
  226. * Gets the scene of the node
  227. * @returns a scene
  228. */
  229. public getScene(): Scene {
  230. return this._scene;
  231. }
  232. /**
  233. * Gets the engine of the node
  234. * @returns a Engine
  235. */
  236. public getEngine(): Engine {
  237. return this._scene.getEngine();
  238. }
  239. // Behaviors
  240. private _behaviors = new Array<Behavior<Node>>();
  241. /**
  242. * Attach a behavior to the node
  243. * @see http://doc.babylonjs.com/features/behaviour
  244. * @param behavior defines the behavior to attach
  245. * @param attachImmediately defines that the behavior must be attached even if the scene is still loading
  246. * @returns the current Node
  247. */
  248. public addBehavior(behavior: Behavior<Node>, attachImmediately = false): Node {
  249. var index = this._behaviors.indexOf(behavior);
  250. if (index !== -1) {
  251. return this;
  252. }
  253. behavior.init();
  254. if (this._scene.isLoading && !attachImmediately) {
  255. // We defer the attach when the scene will be loaded
  256. this._scene.onDataLoadedObservable.addOnce(() => {
  257. behavior.attach(this);
  258. });
  259. } else {
  260. behavior.attach(this);
  261. }
  262. this._behaviors.push(behavior);
  263. return this;
  264. }
  265. /**
  266. * Remove an attached behavior
  267. * @see http://doc.babylonjs.com/features/behaviour
  268. * @param behavior defines the behavior to attach
  269. * @returns the current Node
  270. */
  271. public removeBehavior(behavior: Behavior<Node>): Node {
  272. var index = this._behaviors.indexOf(behavior);
  273. if (index === -1) {
  274. return this;
  275. }
  276. this._behaviors[index].detach();
  277. this._behaviors.splice(index, 1);
  278. return this;
  279. }
  280. /**
  281. * Gets the list of attached behaviors
  282. * @see http://doc.babylonjs.com/features/behaviour
  283. */
  284. public get behaviors(): Behavior<Node>[] {
  285. return this._behaviors;
  286. }
  287. /**
  288. * Gets an attached behavior by name
  289. * @param name defines the name of the behavior to look for
  290. * @see http://doc.babylonjs.com/features/behaviour
  291. * @returns null if behavior was not found else the requested behavior
  292. */
  293. public getBehaviorByName(name: string): Nullable<Behavior<Node>> {
  294. for (var behavior of this._behaviors) {
  295. if (behavior.name === name) {
  296. return behavior;
  297. }
  298. }
  299. return null;
  300. }
  301. /**
  302. * Returns the latest update of the World matrix
  303. * @returns a Matrix
  304. */
  305. public getWorldMatrix(): Matrix {
  306. if (this._currentRenderId !== this._scene.getRenderId()) {
  307. this.computeWorldMatrix();
  308. }
  309. return this._worldMatrix;
  310. }
  311. /** @hidden */
  312. public _getWorldMatrixDeterminant(): number {
  313. return this._worldMatrixDeterminant;
  314. }
  315. /**
  316. * Returns directly the latest state of the mesh World matrix.
  317. * A Matrix is returned.
  318. */
  319. public get worldMatrixFromCache(): Matrix {
  320. return this._worldMatrix;
  321. }
  322. // override it in derived class if you add new variables to the cache
  323. // and call the parent class method
  324. /** @hidden */
  325. public _initCache() {
  326. this._cache = {};
  327. this._cache.parent = undefined;
  328. }
  329. /** @hidden */
  330. public updateCache(force?: boolean): void {
  331. if (!force && this.isSynchronized()) {
  332. return;
  333. }
  334. this._cache.parent = this.parent;
  335. this._updateCache();
  336. }
  337. // override it in derived class if you add new variables to the cache
  338. // and call the parent class method if !ignoreParentClass
  339. /** @hidden */
  340. public _updateCache(ignoreParentClass?: boolean): void {
  341. }
  342. // override it in derived class if you add new variables to the cache
  343. /** @hidden */
  344. public _isSynchronized(): boolean {
  345. return true;
  346. }
  347. /** @hidden */
  348. public _markSyncedWithParent() {
  349. if (this._parentNode) {
  350. this._parentRenderId = this._parentNode._childRenderId;
  351. }
  352. }
  353. /** @hidden */
  354. public isSynchronizedWithParent(): boolean {
  355. if (!this._parentNode) {
  356. return true;
  357. }
  358. if (this._parentRenderId !== this._parentNode._childRenderId) {
  359. return false;
  360. }
  361. return this._parentNode.isSynchronized();
  362. }
  363. /** @hidden */
  364. public isSynchronized(): boolean {
  365. if (this._cache.parent != this._parentNode) {
  366. this._cache.parent = this._parentNode;
  367. return false;
  368. }
  369. if (this._parentNode && !this.isSynchronizedWithParent()) {
  370. return false;
  371. }
  372. return this._isSynchronized();
  373. }
  374. /**
  375. * Is this node ready to be used/rendered
  376. * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)
  377. * @return true if the node is ready
  378. */
  379. public isReady(completeCheck = false): boolean {
  380. return this._isReady;
  381. }
  382. /**
  383. * Is this node enabled?
  384. * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true
  385. * @param checkAncestors indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors
  386. * @return whether this node (and its parent) is enabled
  387. */
  388. public isEnabled(checkAncestors: boolean = true): boolean {
  389. if (checkAncestors === false) {
  390. return this._isEnabled;
  391. }
  392. if (!this._isEnabled) {
  393. return false;
  394. }
  395. return this._isParentEnabled;
  396. }
  397. /** @hidden */
  398. protected _syncParentEnabledState() {
  399. this._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;
  400. if (this._children) {
  401. this._children.forEach((c) => {
  402. c._syncParentEnabledState(); // Force children to update accordingly
  403. });
  404. }
  405. }
  406. /**
  407. * Set the enabled state of this node
  408. * @param value defines the new enabled state
  409. */
  410. public setEnabled(value: boolean): void {
  411. this._isEnabled = value;
  412. this._syncParentEnabledState();
  413. }
  414. /**
  415. * Is this node a descendant of the given node?
  416. * The function will iterate up the hierarchy until the ancestor was found or no more parents defined
  417. * @param ancestor defines the parent node to inspect
  418. * @returns a boolean indicating if this node is a descendant of the given node
  419. */
  420. public isDescendantOf(ancestor: Node): boolean {
  421. if (this.parent) {
  422. if (this.parent === ancestor) {
  423. return true;
  424. }
  425. return this.parent.isDescendantOf(ancestor);
  426. }
  427. return false;
  428. }
  429. /** @hidden */
  430. public _getDescendants(results: Node[], directDescendantsOnly: boolean = false, predicate?: (node: Node) => boolean): void {
  431. if (!this._children) {
  432. return;
  433. }
  434. for (var index = 0; index < this._children.length; index++) {
  435. var item = this._children[index];
  436. if (!predicate || predicate(item)) {
  437. results.push(item);
  438. }
  439. if (!directDescendantsOnly) {
  440. item._getDescendants(results, false, predicate);
  441. }
  442. }
  443. }
  444. /**
  445. * Will return all nodes that have this node as ascendant
  446. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  447. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  448. * @return all children nodes of all types
  449. */
  450. public getDescendants(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): Node[] {
  451. var results = new Array<Node>();
  452. this._getDescendants(results, directDescendantsOnly, predicate);
  453. return results;
  454. }
  455. /**
  456. * Get all child-meshes of this node
  457. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
  458. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  459. * @returns an array of AbstractMesh
  460. */
  461. public getChildMeshes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): AbstractMesh[] {
  462. var results: Array<AbstractMesh> = [];
  463. this._getDescendants(results, directDescendantsOnly, (node: Node) => {
  464. return ((!predicate || predicate(node)) && ((<AbstractMesh>node).cullingStrategy !== undefined));
  465. });
  466. return results;
  467. }
  468. /**
  469. * Get all direct children of this node
  470. * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
  471. * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)
  472. * @returns an array of Node
  473. */
  474. public getChildren(predicate?: (node: Node) => boolean, directDescendantsOnly = true): Node[] {
  475. return this.getDescendants(directDescendantsOnly, predicate);
  476. }
  477. /** @hidden */
  478. public _setReady(state: boolean): void {
  479. if (state === this._isReady) {
  480. return;
  481. }
  482. if (!state) {
  483. this._isReady = false;
  484. return;
  485. }
  486. if (this.onReady) {
  487. this.onReady(this);
  488. }
  489. this._isReady = true;
  490. }
  491. /**
  492. * Get an animation by name
  493. * @param name defines the name of the animation to look for
  494. * @returns null if not found else the requested animation
  495. */
  496. public getAnimationByName(name: string): Nullable<Animation> {
  497. for (var i = 0; i < this.animations.length; i++) {
  498. var animation = this.animations[i];
  499. if (animation.name === name) {
  500. return animation;
  501. }
  502. }
  503. return null;
  504. }
  505. /**
  506. * Creates an animation range for this node
  507. * @param name defines the name of the range
  508. * @param from defines the starting key
  509. * @param to defines the end key
  510. */
  511. public createAnimationRange(name: string, from: number, to: number): void {
  512. // check name not already in use
  513. if (!this._ranges[name]) {
  514. this._ranges[name] = Node._AnimationRangeFactory(name, from, to);
  515. for (var i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {
  516. if (this.animations[i]) {
  517. this.animations[i].createRange(name, from, to);
  518. }
  519. }
  520. }
  521. }
  522. /**
  523. * Delete a specific animation range
  524. * @param name defines the name of the range to delete
  525. * @param deleteFrames defines if animation frames from the range must be deleted as well
  526. */
  527. public deleteAnimationRange(name: string, deleteFrames = true): void {
  528. for (var i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {
  529. if (this.animations[i]) {
  530. this.animations[i].deleteRange(name, deleteFrames);
  531. }
  532. }
  533. this._ranges[name] = null; // said much faster than 'delete this._range[name]'
  534. }
  535. /**
  536. * Get an animation range by name
  537. * @param name defines the name of the animation range to look for
  538. * @returns null if not found else the requested animation range
  539. */
  540. public getAnimationRange(name: string): Nullable<AnimationRange> {
  541. return this._ranges[name];
  542. }
  543. /**
  544. * Will start the animation sequence
  545. * @param name defines the range frames for animation sequence
  546. * @param loop defines if the animation should loop (false by default)
  547. * @param speedRatio defines the speed factor in which to run the animation (1 by default)
  548. * @param onAnimationEnd defines a function to be executed when the animation ended (undefined by default)
  549. * @returns the object created for this animation. If range does not exist, it will return null
  550. */
  551. public beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable<Animatable> {
  552. var range = this.getAnimationRange(name);
  553. if (!range) {
  554. return null;
  555. }
  556. return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);
  557. }
  558. /**
  559. * Serialize animation ranges into a JSON compatible object
  560. * @returns serialization object
  561. */
  562. public serializeAnimationRanges(): any {
  563. var serializationRanges = [];
  564. for (var name in this._ranges) {
  565. var localRange = this._ranges[name];
  566. if (!localRange) {
  567. continue;
  568. }
  569. var range: any = {};
  570. range.name = name;
  571. range.from = localRange.from;
  572. range.to = localRange.to;
  573. serializationRanges.push(range);
  574. }
  575. return serializationRanges;
  576. }
  577. /**
  578. * Computes the world matrix of the node
  579. * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
  580. * @returns the world matrix
  581. */
  582. public computeWorldMatrix(force?: boolean): Matrix {
  583. if (!this._worldMatrix) {
  584. this._worldMatrix = Matrix.Identity();
  585. }
  586. return this._worldMatrix;
  587. }
  588. /**
  589. * Releases resources associated with this node.
  590. * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
  591. * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
  592. */
  593. public dispose(doNotRecurse?: boolean, disposeMaterialAndTextures = false): void {
  594. this._isDisposed = true;
  595. if (!doNotRecurse) {
  596. const nodes = this.getDescendants(true);
  597. for (const node of nodes) {
  598. node.dispose(doNotRecurse, disposeMaterialAndTextures);
  599. }
  600. }
  601. if (!this.parent) {
  602. this.removeFromSceneRootNodes();
  603. } else {
  604. this.parent = null;
  605. }
  606. // Callback
  607. this.onDisposeObservable.notifyObservers(this);
  608. this.onDisposeObservable.clear();
  609. // Behaviors
  610. for (var behavior of this._behaviors) {
  611. behavior.detach();
  612. }
  613. this._behaviors = [];
  614. }
  615. /**
  616. * Parse animation range data from a serialization object and store them into a given node
  617. * @param node defines where to store the animation ranges
  618. * @param parsedNode defines the serialization object to read data from
  619. * @param scene defines the hosting scene
  620. */
  621. public static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void {
  622. if (parsedNode.ranges) {
  623. for (var index = 0; index < parsedNode.ranges.length; index++) {
  624. var data = parsedNode.ranges[index];
  625. node.createAnimationRange(data.name, data.from, data.to);
  626. }
  627. }
  628. }
  629. }