Hi Artur,

>Date: Mon, 13 May 2002 15:27:36 +0200
>From: Artur Biesiadowski <[EMAIL PROTECTED]>
>Subject: [JAVA3D] Node cloning questions
>To: [EMAIL PROTECTED]
>MIME-version: 1.0
>Content-transfer-encoding: 7bit
>X-Accept-Language: en-us, en
>Delivered-to: [EMAIL PROTECTED]
>User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.9)
Gecko/20020311
>
>I'm in process of adding methods to allow cloning my own subclasses of
>Behavior/Shape3D. I have few questions:
>
>1) Is there any way to force duplication of one of NodeComponents ? I'm
>talking about Shape3D subclass. I would like to allow cloning of all
>components depending on duplication flag (for Appearance, Bounds etc),
>but I would like to _force_ duplication of geometry. Currently I'm
>thinking about allowing Shape3D to do it's work and then if duplicate
>flag is false (this would mean that geometry is copied by reference),
>just duplicate it by hand. Will it work ? Or maybe there is some easier
>way to do this ?

Passing forceDuplicate = true in
cloneTree(boolean forceDuplicate)
will duplicate all NodeComponents automatically.

If you only want part of them to clone, you have to do this
manually after cloneTree(false).


>
>2) In behaviors I'm keeping references to some transformgroups/shapes.
>If I'll copy them directly, they will point to original tree. Is there a
>way to point them automatically to corresponding nodes in new tree
>(clones of nodes they were pointing to previously) ? What will happen if
>node they point to is outside tree being copied at the moment ?
>

You can use the callback during cloneTree() to get the new
reference

  public void updateNodeReferences(NodeReferenceTable referenceTable)

  referenceTable.getNewObjectReference(oldReference);

DanglingReferenceException may throws otherwise.

Check out Section 7.2 from the Specification for details.

- Kelvin
---------------
Java 3D Team
Sun Microsystems Inc.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to