I am new here so it could be that the question is stupid but I have trying to load a model created with Blender 2.48
into JME (updated a only a few days ago) using the HottBJ (0.3d) jme-xml exporter in Blender as described on these pages. On JME side I used the XMLImporter also following the tuturials here.
It works fine to import the objects, they are all displayed correclty.
However, at two points strange behaviour occurs which I am unable to understand, so maybe you can help:
Objects (e.g. spheres) exported from Blender have the wrong bouding volumes when scaled in blender. The bounding
volume has the radius the Blender sphere has upon creation (e.g. 3.0). If I scale the objects in Blender ('s') and export
them the bounding volumes in JME are still '3.0'. Any JME updating of the model bounds will not correct this.
The code is kind of
// Loop over loaded model
List<Spatial> children = new LinkedList<Spatial>(n.getChildren());
for (Spatial child:children)
{
System.out.println("PBound for "+child.getClass()); => Gives TriMesh
child.setModelBound(new BoundingSphere()); => Without this the bound is NULL
child.updateModelBound();
parentNode.updateModelBound();
System.out.println(" IS "+child.getWorldBound()); => Gives wrong radius
}
// Model or world bounds result in the same
// A Manual sphere like this works fine
Sphere s = new Sphere("MSphere", 20, 20, 5);
s.setModelBound(new BoundingSphere());
s.setLocalTranslation(new Vector3f(0,0,5));
s.updateModelBound();
System.out.println("Bm="+s.getWorldBound());
A similar issue arises when putting (image) textures on the objects in blender. What I want is to
simply put a 'wall' texture around a sphere or cube. Nothing fancy.
I have been following all tuturials I could find on these webpages, e.g. creating the UV texture, the cube projected one
or a plain image.
Two possibilites arise:
a) Using e.g. the UV texture tuturial: The exporter refused to export the object
b) Just mapping a texture to the object (assign texture in blender from image). This texture will be loaded
in JME but it is shown very strange. I dont actually know what it is doing, but it looks as if the texture is
mini and repeated endlessly, ending up in a fuzzy jittering brown ball.
Funnily it is then also not possible to assign a texture created and loaded in JME to any object loaded from
the XMLImporter. Assigning a texture to a newly created object works fine though.
Apply your transform/scale changes in Blender after changing scale. Ctrl-A, I think. If you don't do this then the exporter will use the unscaled value;
How are you applying the uv map? Sounds like there is a problem in your setup in Blender – most likely with linking the map to the mesh.
Thank you for your answer. The first problem is indeed fixed. The second is described below in more detail.
Apply your transform/scale changes in Blender after changing scale. Ctrl-A, I think. If you don't do this then the exporter will use the unscaled value;
Ctrl-A does fix the scaling. I thought the exporter or blender would do this but I am ok with this workaround.
How are you applying the uv map? Sounds like there is a problem in your setup in Blender – most likely with linking the map to the mesh.
Sorry for finding this a few days after you posted – I've got competing priorities going on right now and so I'm sort of slow in the jME world right now.
I'm glad that # 1 was fixed.
As for # 2: If you run Blender from a console or command window and run the exporter you'll be able to see some error information about why the exporter is refusing the model w/applied uv map. If you do that, post the output here. Other than that, you can either post a link to your model and uv pic here, or pm me the info, and I'll take a look at it and see if I can determine what is wrong – in either your model or the documentation.
I'm also new here. . I'm having some problems with loading models with exported physics (jME Physics2).
Using blender and HottBj Exporter I exported some model. After that i loaded it in my code, added some Dynamic/StaticPhysicsNode and exported. But now, while trying to import that model with XMLImporter i'm getting this error
Sources of JME2 and jME Physics2 are up to date (taken today from svn). All tests inside jME2 and jME Physics 2 are working great. How can i do it correctly?? I will be grateful for help
As your issue has nothing to do with HottBJ, may I suggest that you open a new Topic, especially since ToM is still working the issue which is the proper subject of this topic?
To the matter at hand, you have the stack trace and you have the XML at-hand to view, so you can dig in and find out what it is that is expected but is not being stored.
Quote:
Hello
I'm also new here. . I'm having some problems with loading models with exported physics (jME Physics2).
Using blender and HottBj Exporter I exported some model. After that i loaded it in my code, added some Dynamic/StaticPhysicsNode and exported. But now, while trying to import that model with XMLImporter i'm getting this error
java.io.IOException: java.lang.NullPointerException
at com.jme.util.export.xml.DOMInputCapsule.readSavableArrayList(DOMInputCapsule.java:1143)
at com.jme.scene.Node.read(Node.java:674)...
I, and others, use relative texture resources constantly and don't need hard-coding to do it, let alone 30 lines of a custom resource ResourceLocator impl. See the API and source code for XMLImporter and you'll see that it adds its own relative ResourceLocator automatically. If that is not working for some situation, supply a test case and I'll fix it. Specifically, both the provided XmlWorld.java and XmlAnimator.java classes have been used hundreds of times to automatically pull in relative texture files with no extra resource locator work.
I don't see how it could be useful to other new people to post the "minimal Java part to load the HottBJ XML exporter from Blender", when "this method basically doesn't do anything it might work without".