WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Accessing Geodes with duplicate Names (https://forum.worldviz.com/showthread.php?t=4285)

Felix 07-05-2012 07:00 AM

Accessing Geodes with duplicate Names
 
Hi,
I have the following problem when loading an .IVE or .OSG file exported from a .3ds file:

Some nodes in the SceneGraph of the OSG file get the same Geode names assigned.

Which looks like this:
Node-1
- Geode-1
Node-2
- Geode-1

Now when using the Vizard API to access such a Geode like mentioned here: http://kb.worldviz.com/articles/1157 I run into trouble.

The documention of .getChild states
Quote:

If there are multiple scene graph nodes with the same name, then the first encountered node will be used.

Calling this command multiple times with the same name will return the same node3d object.
I can properly iterate over the names of the child nodes when doing a model.getChild('Node-1').getChildren() or model.getChild('Node-2').getChildren(). Here I can see, that each node in the SceneGraph indeed has it's own Geode but with the same name.

From what I understand, .getChildren() won't help either. So how do I access this Geode (Node-2, Geode-1 in the example..), since getChild only returns Node-1, Geode-1?

farshizzo 07-09-2012 09:40 AM

Have you tried the following?
Code:

model.getChild('Node-2').getChild('Geode-1')

Felix 07-11-2012 02:10 AM

Thanks for the reply..
Yeah, actually I tried that..
This returns a seemingly random instance of the Geode-1, which is not the Geode-1 I want..
I always look at the World Position of the Geode to distinguish them.
I can read the correct coordinates from the Vizard Inspector.

farshizzo 07-11-2012 09:53 AM

I'm not sure I understand what you mean by a "random instance". Is it a valid instance? Is the position of the instance different every time you run the script?

My guess is that both "Geode-1" nodes refer to the same instance. This means it will have multiple parents, and multiple global positions. So you are most likely getting the global position from the first parent ("Node-1").

In this case, the solution would be to insert a node below "Node-2", ensuring the path to the desired instance of "Geode-1". Try the following code:
Code:

geode = model.insertGroupBelow('Node-2')

Felix 07-12-2012 06:22 AM

Wow, thanks a lot.. That seems to be the solving line..


All times are GMT -7. The time now is 06:57 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC