Hi everyone,
I've searched the archive and API, but can't seem to figure this out: I want to get
references to all named Shape nodes in a VRML file which includes Shapes in any
inlined files. My code to do this is below, and I've attached two sample .wrl files
(jlink2.wrl) is the parent file.
It seems like Scene.getNamedObjects() does not recognise named objects in inlined
files, but does recognise the name of the Inline node (as a Group).
If anyone could tell me how to get around this I would really appreciate it. Thanks!
josh
public void showNodeNames(Scene theScene)
{
Enumeration list = theScene.getNamedObjects().keys();
// Go through the enumeration list
while (list.hasMoreElements()) {
String shapeName = (String) list.nextElement();
Node node = (Node) theScene.getNamedObjects().get(shapeName);
System.err.println(shapeName + " is a " + node.getClass());
}
// extra test for the included files... look for "joint2" which is in jlink3.wrl
if (theScene.getNamedObjects().get("joint2") == null)
System.out.println("joint2 not found!");
else
System.out.println("joint 2 found");
}
When I try this with jlink2.wrl, joint2 is not found. With jlink3.wrl, it is found.
----------------------------------------------------
Joshua L. Richmond, BASc, MSc.
Systems Engineering (R&D)
MD Robotics
9445 Airport Rd, Brampton, ON, Canada
(905) 790-2800 x4332
-----------------------------------------------------
jlink3.wrl
jlink2.wrl
BEGIN:VCARD
VERSION:2.1
X-GWTYPE:USER
FN:Josh Richmond
TEL;WORK:4332
EMAIL;WORK;PREF;NGW:[EMAIL PROTECTED]
N:Richmond;Josh
X-GWUSERID:JRICHMON
END:VCARD