George Anastassakis wrote:
Hello all
I'm trying to load a scene with a Shape and a Script node but I cannot
get it right. The file is:
#X3D V3.0 utf8
PROFILE Immersive
DEF s Shape {
appearance Appearance { }
geometry Box { }
}
DEF sc Script {
eventIn SFTime test
this is not valid X3D. it must be inputOnly
url "javascript: function test(value) { }"
}
this should be ecmascript:
Of course, the Script node does nothing but I'm just trying to get it to
load. The code I use is the following:
Properties props = new Properties();
x3dComp = BrowserFactory.createX3DComponent(props);
Browser browser = x3dComp.getBrowser();
contentPane.add((JPanel) x3dComp.getImplementation());
X3DScene scene = browser.createX3DFromURL(new String[] {"test.wrl"});
this needs to be an X3D file, not a VRML file.
browser.replaceWorld(scene);
The createX3DFromURL call generates a NullPointerException, which seems
to be caused by line 302 in SAIBrowser.java (scene is null?):
301: VRMLScene scene=theBrowserImpl.createX3DFromURL(url);
302: VRMLExecutionSpace space = (VRMLExecutionSpace)scene.getRootNode();
However, if I change the header to "#VRML V2.0 utf8" and remove the
PROFILE statement, Xj3D Browser does load the file but my code does not.
your mixing specs. make sure you either do things completely VRML or X3D.
I guess I must be doing something really stupid here but I can't figure
out what. Any help?
--
Alan Hudson
President Yumetech, Inc. www.yumetech.com
President Web3D Consortium www.web3d.org
206 340 8900
-------------------------------------------------------------------------
for list subscription/unsubscription,
go to
http://www.web3d.org/cgi-bin/public_list_signup/lwgate/listsavail.html