Skip to main content

A little doubt

1 reply [Last post]
Joined: 2007-04-11

I saw in a code, someone called the method cloneNodeComponent with a false argument. I wanted to find out what the purpose of the boolean variable. In Javadoc was written:
forceDuplicate - when set to true, causes the duplicateOnCloneTree flag to be ignored. When false, the value of each node's duplicateOnCloneTree variable determines whether NodeComponent data is duplicated or copied.

So, what's the difference between a variable to be copied or to be duplicated?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-06-07


'copied' is in MHO a misleading expression, better would be 'the NodeComponent object is referenced'.

Have a look at:

-> Cloning Subgraphs -> References to Node Component Objects

"When cloneTree reaches a leaf node, there are two possible actions for handling the leaf node's NodeComponent objects (such as Material, Texture, and so forth).

First, the cloned leaf node can reference the original leaf node's NodeComponent object-the NodeComponent object itself is not duplicated. Since the cloned leaf node shares the NodeComponent object with the original leaf node, changing the data in the NodeComponent object will effect a change in both nodes. This mode would also be used for objects that are read-only at run time.

Alternatively, the NodeComponent object can be duplicated, in which case the new leaf node would reference the duplicated object. This mode allows data referenced by the newly created leaf node to be modified without that modification affecting the original leaf node."