Skip to main content

set capabilities on a loaded universe

1 reply [Last post]
Joined: 2010-04-22

Hi all,

I'm loading an Universe using the SceneGraphStreamReader from a file.
The code looks like this :

URL url=new URL(getCodeBase().toString()+j3d_File);
InputStream input_stream = url.openStream();
SceneGraphStreamReader reader = new SceneGraphStreamReader(input_stream);

It works fine. The problem is that I want to change the capabilities of some BranchGroups before they are made live. I want to add new components to those groups.
Is there a way to load the universe, change capabilities, add new things and then set it to the canvas3D? So I can see it modified


Reply viewing options

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

Reading the JavaDocs for the SceneGraphStreamReader Class here:

It seems as though when the Universe file is read in, it will automatically add the BranchGroups and everything else to the Universe BEFORE returning.
My suggestion to you then would be either:
Create your own SceneGraphStreamReader where you only return the root of the SceneGraph with out adding it to anything
You simply save the universe with the capabilities set to ALLOW_CHILDREN_EXTEND, and anything else you need(maybe ALLOW_TRANSFORM_WRITE). Then the next time you read it in, you can make the changes without Java3D complaining.

Hope this helps,
-- Rob