Dear Mike,
First of all, thank You very much for Your explanation and help and suggestions about my question.
I have a "need" about having an ignore-like node method, because my 3D applications build the scene graph in dinamic mode, that is to say the application reads a configuration file containing informations about show the 3D scene, for every different final customer;
so in some cases, i need to turn off a node or more than one (and it isn't always the same one), instead of rebuild that part of the scene graph that is complicated and expensive.
I did not think about the ram cost and how IvTune implement on the fly this type of action/method, so excuse me again: I thought it was a node built in flag.
I hope i succeded to explain my reasons about this strange question.
I'll try to use Your code snippet in order to have smart "ignore node" method using the SoSwitch node, as You suggested.
I'll thank You again for Your precious help and suggestions.
Best Regards,
Vincenzo
P.S.: I imagine that "SoIgnoredNodeProxy" is declared on the fly in IvTune to modify dinamically the loaded scene graph;
please can i put another question? The massive SoSwitch use can slow my scene graph traversal? Do i have to set some flags to speed up the traversal action? Thank You in advance
Announcement
Collapse
No announcement yet.
A simple question about "Set ignored" or "Ignore node" IVTune feature
Collapse
X
-
Originally posted by [email protected]Dear Mike,
Please, i know that this question is a silly one, but i'd like to know if there is a way to "turn off" a node in a scene graph using a "Ignore Node" feature like, instead of putting on every node a SoSwitch or there is a pragmatic or clever technique to simulate/implement this behavior.
No, it's not a silly question. It's not even an unusual question. :-) We have discussed adding an 'ignored' field in the SoNode class, so any node could be easily ignored. That would have some value, but also some cost. One cost is memory. We are very reluctant to add any new member in SoNode because that memory is multiplied by the total number of nodes in the scene graph, which can be very large for some applications.
I would be interested to understand the actual use-case where you need to "turn off" aribitrary nodes in the scene graph. I ask because, in most applications, it's only necessary to allow the user to turn off "objects". An object may be a part or a sub-part or whatever, but usually it's an SoSeparator because it is rendered by a set of nodes. Some applications do not have a huge number of objects, so it is practical to "preemptively" install SoSwitch nodes to control their visibility. If that is not practical, the next best strategy IMO is to dynamically replace the node with a node that allows controlling visibility, e.g. SoSwitch.
You could do something like this (not actually tested). SoSwitch 'whichChild' is -1 by default. So after calling this function the node is no longer traversed, but still exists and the 'ignore' can be undone.
Code:void ignoreNode( SoGroup* parent, SoNode* node ) { auto theSwitch = new SoSwitch(); theSwitch->addChild( node ); parent->replaceChild( node, theSwitch ); }
Code:void ignoreNode( SoGroup* parent, SoNode* node ) { auto proxy = new SoIgnoredNodeProxy( node ); parent->replaceChild( node, proxy ); }
MikeLeave a comment:
-
A simple question about "Set ignored" or "Ignore node" IVTune feature
Dear Mike,
Please, i know that this question is a silly one, but i'd like to know if there is a way to "turn off" a node in a scene graph using a "Ignore Node" feature like, instead of putting on every node a SoSwitch or there is a pragmatic or clever technique to simulate/implement this behavior.
if You need more information, please don't hesitate to ask.
Best Regards,
VincenzoTags: None
Leave a comment: