dongju.jeong Posted February 20, 2019 Share Posted February 20, 2019 int clearNode( const char * name ) Clears a cache of a given node. Arguments const char * name - Path to the *.node file. Return value 1 if the cache is cleared successfully; otherwise, 0. Example) ObjectMeshStaticPtr node1 = ObjectMeshStatic::cast(NodeReference::cast(node)->getReference()); … //node1 editing........ World::get()->clearNode(node); // <------- it's mean that The Nordreference returns to the state of before editing?? Link to comment
fox Posted February 20, 2019 Share Posted February 20, 2019 Hi Dongju, Caching of nodes is used to speed up loading process, if a node was added to cache during loading operation, the next time when you try to load it from the file you'll simply get a clone of a cached node, instead of parsing the *.node file and retrieving data once again. Nodes are added to cache on loading, when the second argument of loadNode() is set to 1 (default value): World::get()->loadNode("mynode.node",1); When you call clearNode() the node will be removed from cache, and the next time you try to load it the *.node file will be parsed again to get node's data. So, it has nothing to do with restoring the initial state of a NodeReference after modifying it. When you modify a NodeReference via code, the corresponding *.node file actually remains unchanged until you call World::get()->saveNode() (the same way as you would click Apply when modifying an instance of a NodeReference in the Editor). After saving your changes to a *.node file, you won't get your initial state back. Thank you! 1 Link to comment
dongju.jeong Posted February 20, 2019 Author Share Posted February 20, 2019 thank you for your answer. then, What is the function same as pressing the Cancel button after editing? Pressing Cancel in the editor returns to the original state. Link to comment
silent Posted February 20, 2019 Share Posted February 20, 2019 dongju.jeong There is no magic methods for this :) You can just make a copy of your node (backup) when you first open it and if changes will be discarded you can simply restore it from backup. 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
dongju.jeong Posted February 20, 2019 Author Share Posted February 20, 2019 I understand thank you. Link to comment
Recommended Posts