This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > August 2005 > protos+SAI





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author protos+SAI
nunomartins01

2005-08-09, 7:40 pm

Hello

I'm starting to use protos and I can't create an instance of a
proto using SAI...

I have a x3d file (teste.x3d) whit a declaration of a proto:

<Scene>
<ProtoDeclare name='Wall'>
<ProtoBody>
<Shape>
<Box size='10 2 0.1'/>
<Appearance>
<Material diffuseColor='0 0.6 1'/>
</Appearance>
</Shape>
</ProtoBody>
</ProtoDeclare>
<NavigationInfo type='"EXAMINE" "ANY"'/>
</Scene>

In my java, I load the "teste.x3d" and try to crate an instance of
the proto:

mainScene = x3dBrowser.createX3DFromURL(new String[] { "teste.x3d" });
x3dBrowser.replaceWorld(mainScene);

X3DNode obj = mainScene.createProto("Proto");
SFString name_proto = (SFString) (obj.getField("name"));
name_proto.setValue("Wall");
mainScene.addRootNode(obj);

But his must be wrong...

Shall I use CreateInstance or createProto is enough?

Thanks
Nuno

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews