Detailed Description

Wrapping ones head around when, how, and why to create nodekits can be difficult in the beginning. When do you write a nodekit, and when do you write a custom node? It is easy to think in those terms in the beginning, but it is often not an either/or situation.

The concept of nodekits is to modularize useful, potentially repeated sub-structures you have in your scene graph as it approaches some level of complexity. They are especially useful if you might need to rearrange the structure of the sub-structure in the future, which you probably will.

On file, a nodekit is like a macro for the scene graph. The nodekit will not expose its internal structure, but when read in it will create the node structure internally. The node structure can even have optional parts that are only expanded if necessary.

A nodekit will give you access to its 'slots' in the internal structure through its fields. Only those fields should be the user interface for the nodekit, the rest of the substructure should be completely automatic, derived from those slot fields.

To return to the question on whether to implement a custom node or a nodekit, the answer is to think of what exactly is really custom about what you need to implement, and trim that down to the atomic level (but please stop trimming before you trim away all meaning). If there is nothing really custom in what you want to implement, then it is likely that implementing it as a nodekit is what you ought to do. However, if you do have to do somethingcustom that Coin doesn't support, then implement that part as a custom node, and then, if it seems worthwhile, implement the nodekit you need to bundle up this custom part with an auxiliary support structure to achieve what you set out to achieve.

For VRML97, you have something called PROTOs, which is something similar to nodekits, except they are not very accessible from C++, as opposed to nodekits.

Author

Generated automatically by Doxygen for Coin from the source code.