mrudul.mahurkar Posted May 12 Posted May 12 (edited) Hi Team, i am using unigine editor 2.18, i want to make a node readonly like no rename should happen , no delete should perform, node should not be moved.. basically it will be good if no context menu appears on rightclick. how to achieve that. do i need to do something to widgettree ? or node ? any api? Edited May 12 by mrudul.mahurkar
K.Wagrez Posted May 12 Posted May 12 I will add a few questions and context on this: User should still be able to see the 3D node in the Hierarchy window, select it and see its parameters User should be able to select the node and focus it Is there an easy way to mix the read-only constraint with these interactions ? The nodes are actually generated, named and placed by a plugin, and we don't want the user to risk conflicting with it.
silent Posted May 12 Posted May 12 Hello! There is an option that can 'lock' node and make so you can't change the transformations of the node itself: You can lock node position by specifying it ID In the world file, something like this: <world version="2.18.0.1"> <data> <user/> <unigine_editor> <body> <node_extensions> <node_ext id="995460272" flags="3"/> </node_extensions> </body> </unigine_editor> </data> However, there is no such abstraction from the engine / editor API that will allow you to block any other action with the node, including the ability to delete it (via context menu or via hotkeys) or rename. While it may be technically possible to customize this behavior, doing so would require deep knowledge of Qt and extensive usage of 3rd party tools such as GammaRay to inspect and work with the Editor’s internal implementation. Because this approach is quite complex, we generally would not recommend going down this path with custom Qt changes. Since there is no direct way to forbid these changes, you can implement some kind of logic that will try to restore node changes if they were made. Something like that: // ... NodePtr const_node; int const_node_id = const_node->getID(); // ... if (Unigine::Node::isNode(const_node_id)) { const_node->setName(...); const_node->setWorldTransform(...); // ...other params? } else { const_node = restoreNode(...); // implement some restoration logic inside this method const_node_id = const_node->getID(); } Hope that helps. Thank you! 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts