Skip to main content

Adding/Removing Node Children

1 reply [Last post]
ddiggler
Offline
Joined: 2008-05-19

Hello All,

I have an issue with adding/removing Children of a Group(s) and writing-out to an external file that I hope someone can help me with. I have tried about everything and have had no success - please any hints or ideas would be great:)

I have a main BranchGroup that has a set of attached myShape Objects (extended Shape3D Class) where each myShape Object has an embedded BranchGroup Object (called "anchor"). When I remove a particular myShape Object I store it in a HashMap such that the KEY is the Parent Group of the "anchor" (assumed to have myShape attached to it) - I call detach on the anchor after storing a reference to its PARENT Group. I can then just reattach the myShape using the PARENT reference.

Everything works well unless there is a detached myShape whose parent is a TransformGroup. I am storing a Collection of Objects that are used latter to create a set of JTrees and the Collection of Objects are Serializable. When the Parent is a TransformGroup I get a NotSerializableException.

Has anyone tried to attach/detach Shape3D Objects via a BranchGroup on a TransformGroup Object and did you get this same problem? If so how did you solve it? I can seem to find no reason for the exception and really need some kind of hint.

Thanks all.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ddiggler
Offline
Joined: 2008-05-19

Oops. I found the problem. Not Java3D, it was a bug on my behalf - a Class Object was being serialized via another Class Object. I just marked it as transcient and the problem was fixed.

Sorry.