Ok
Thanks for the help! ;D ;D
Emil Alonzo
Ok
Thanks for the help! ;D ;D
Emil Alonzo
for(int i = 0; i < model.numChildren(); i++) {
System.out.println("name of child: " + model.getChild(i).getName());
}
returns nothing :(. is there away of getting the names
of the models i have set in my modeler? so i can add
tages in my models?
You know, I had a look at this, and the code is in there to support NamedObjects. I couldn’t be sure anything had actually been named in my test models.
Could you possibly shoot me over a 3DS model with something telling me what names should be turning up so that I can run some tests and hopefully give you a fixed version?
Cheers,
Kev
here u go:
http://www.topresultmate.com/xith3d/v1.3ds
should be 5 shapes nice and simple:
name: leftwing
name: vapor_1
name: vapor_0
name: front1
name: body
so rock and roll. i sort of got it to work changing your TSDModel class adding this:
public Iterator getObjectNames() {
return(objects.keySet().iterator());
}
its just i pulling the keys- all i need. but getting the name from a Group would be more rock and roll
if i want to get the location of a shape group in the world i would guess i would need to do this:
System.out.println("c: " + model.getNamedObject("vapor_0").getVworldBounds().getCenter().toString());
but i get 0f, 0f, 0f. but the object is moving
Might be worth printing the complete bounds out, it might be that the bounds arn’t updating as the object moves. However, if thats the case, and the original bounds are right (which I wouldn’t be sure of) then there may be a problem in the scenegraph, in that bounds wouldn’t be updating with transform group changes…
Kev
well looked into it and the:
model.getBounds.toString()
we get the bounds and location of the model OK. also the:
model.getVworldBounds().toString()
changes as exspected. it seem the children of the model are not getting updated. they are moving along in the scene ok. just there getBounds are al 0f, 0f, 0f 0f and there getVworldBounds() dont change from 0f, 0f, 0f 0f
model.getNamedObject("vapor_0").getVworldBounds().toString()
isnt working. maybe i should update my Xith3D to a newer version and try that…
ok at last i get my computer working again. sodding thing
and have the new CVS of Xith3d and JOGL and all that
other jazz. and bosh still get 0f,0f,0f, r0f from a nested
object bounds…
gurrr- stomp stomp
Test case? [want to take a look, because of bounds work fine for me]
Yuri
Here is a test case as requested:
http://www.topresultmate.com/xith3d/3ds-bounds-test.zip
i have added kevs 3ds src also because i changed his
TDSModel.java- just added a little bit of code that returns the
model names- makes life simpler…
im thinking of added a Texture Manager so models can
share the same textures. will do that and upload it
to so kev can pass his expert eye over it.
But theres nothing to amazing going on- i have build it
around kevs code to make it simpler to see whats
happening…
The main model.getVworldBounds is ok. but the children
just return 0s
i get this:
The main Model.getVworldVounds: BoundingSphere [-0.42404148,-0.18567085,-0.09359161 radius 12.151663]
Model: redBox getVworldBounds: BoundingSphere [0.0,0.0,0.0 radius 0.0]
Model: redBox2 getVworldBounds: BoundingSphere [0.0,0.0,0.0 radius 0.0]
Model: redBox1 getVworldBounds: BoundingSphere [0.0,0.0,0.0 radius 0.0]
The main Model is cool the kids are not so funky.
Hi,
After testing the case above, I found that named nodes are not added to the scene, and don’t have implicitly associated VWorld -> don’t have Vworld bounds.
I modified the test case to sidplay named note’s parents:
for(int i = 0; i < modelNames.length; i++) {
TransformGroup no = model.getNamedObject(modelNames[i]);
System.out.println("Model: " + modelNames[i] + " " + no + " " + no.getParent() + " getVworldBounds: " +
no.getVworldBounds());
}
and the result is:
The main Model.getVworldVounds: BoundingSphere [-0.42404148,-0.18567085,-0.09359161 radius 12.151663]
Model: redBox com.xith3d.scenegraph.TransformGroup@b02efa null getVworldBounds: BoundingSphere [0.0,0.0,0.0 radius 0.0]
Model: redBox2 com.xith3d.scenegraph.TransformGroup@dc57db null getVworldBounds: BoundingSphere [0.0,0.0,0.0 radius 0.0]
Model: redBox1 com.xith3d.scenegraph.TransformGroup@c24c0 null getVworldBounds: BoundingSphere [0.0,0.0,0.0 radius 0.0]
Please note null values in place where parent should be.
You should add nodes to the scene before requesting the Vworld bounds (they depend on Vworld transform).
So, result is following: this is not a bug in Xith3D bounds calculation code, but with the scene tested.
Yuri
i think the problem is in the getNamedObject call. seems
to be messed up. i can get the Bounds using the getChild(0).getParent()
and that works.
strange the getNamedObject returns an object. but it
nos nothing of the object.
kev where do u set the names of the objects? i cant
see that anywhere - i was going to just use:
modelPart.setName(“name”);
cant find it anywhere… i even looked under my bed!
The name is actually the key into a has map, I believe its actually done in NamedObjectProcessor with this:
context.objectTable.put(context.objectName, context.object);
Kev
well i tryed the hopeful:
context.object.setName("hello there");
but without joy when getting the Name from
the models children:
Enumeration e = model.getAllChildren();
System.out.println("model chcnt: " + model.numChildren());
while(e.hasMoreElements()) {
TransformGroup g = (TransformGroup)e.nextElement();
System.out.println("g: " + g.getName() + " gch: " + g.numChildren());
}
i get returned nothing but null when asking for the childs parent from the hashmap.
And no names from the scene graph. Strange because
its drawing the model ok. And its children.
i cant see why the hashmap objects cant see there parent node as Yuri points
out. All seems fine to me.
all very odd ???