[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [x3d-public] NullPointerException when loading scene with script node



Also, it seems that the problem was only the "eventIn" instead of "inputOnly", while "javascript" works just as well as "ecmascript" (that is, with Xj3D M10).

George


----- Original Message ----- From: "Alan Hudson" <giles@yumetech.com>
To: "George Anastassakis" <anastas@unipi.gr>
Cc: <x3d-public@web3d.org>
Sent: Wednesday, March 22, 2006 9:54 PM
Subject: Re: [x3d-public] NullPointerException when loading scene with script node



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




------------------------------------------------------------------------- for list subscription/unsubscription, go to http://www.web3d.org/cgi-bin/public_list_signup/lwgate/listsavail.html