open inventor copyContents()
-
Hallo,
ich möchte ein node in Openinventor kopieren. Im Netz habe ich die copy Methode gefunden, welche dann copyContents() aufruft.
A.10 The copyContents() Method
The copy() method defined for SoNode creates a copy of an instance of a node. It invokes the virtual copyContents() method. If your node has no data other than fields and public children, then the copyContents() methods defined for SoNode and SoGroup should suffice.
However, if you have extra instance data in your node that needs to be copied, you have to override the copyContents() method. For example, if the Pyramid node class defined earlier contained a private integer member variable called count (for some private reason), the copyContents() method would look like this:
void Pyramid::copyContents(const SoFieldContainer *fromFC, SbBool copyConnections) { // Copy the usual stuff by calling the base class method. SoShape::copyContents(fromFC, copyConnections); // Copy the "count" field explicitly. count = ((Pyramid *)fromFC)->count; }Was ist hier der SoFieldContainer und copyConnections? Wie und Wo muss ich den in meinen Baum einhägen? Ich versteh das Beispiel leider nicht. Warum funktioniert meinKnoten->copy nicht?
Hat das schon mal jemend benutzt, bin für jede Hilfe dankbar!
vg