ObjToJme Modification

Below is a code snippet from the ObjToJme Class. Does anybody know how to change the code "temp" + i so that it names the child object whatever material its grouped by? I dont like how it names it temp0, temp1, etc. Would be way easier to manipulate the texture if i knew what the name of the spatial was that was bound to a texture. I tried but don't really understand how it works.



TriMesh thisMesh = new TriMesh(thisSet.objName == null ? "temp" + i : thisSet.objName);
Vector3f[] vert = new Vector3f[thisSet.sets.size()];
Vector3f[] norm = new Vector3f[vert.length];
Vector2f[] text = new Vector2f[vert.length];
boolean hasNorm = false, hasTex = false;



Rob

Hmm,looks like it tries to use the object name and only uses "temp-n" if no objectName is provided.

The question is how the .obj-file is created. I know if you export an scene from blender you have different

options. So if you use the default export (Blender Objects as OBJ:"keep vert order") the object name is not provided. You have to choose "Objects" and then the objectname is exported as well (and might work then)

Hey ttrocha,



I can't see how it can ever have an object name because it actually splits whatever objects there are into multiple sub objects depending on what material is applied to what polygon. Example.



House .OBJ uses 2 textures. 1 roof texture and 1 base texture. The obj importer splits this object into 2 objects called temp0 and temp1. I want to name those objects roof and base instead of temp.


Ok. First I can only repeat my post. Don't know if you know that:

TriMesh thisMesh = new TriMesh(thisSet.objName == null ? "temp" + i : thisSet.objName);



is equal to


TriMesh thisMesh;

if (thisSet.objName==null)
{
trimesh = new TriMesh("temp" + i);
}
else
{
trimesh = new TriMesh(thisSet.objName);
}


Second to clarify: Where did you get the .obj-from? Did you create it on your own? If you export it the right way you have "o OBJ_NAME"-tags in your .obj file (which is used for setting the object-name). Well, if you have two materials the mesh is split into 2 objects. Problems is that both subobjects will have the same name. But you can access them like this:

List<TriMesh> l = r.descendantMatches(TriMesh.class,"obj-name");



To pack both togehter you can attach them to a new node.



3ds max obj exporter. Can't see anywhere to set object name to output. Wanted to name each sub object after the material its created from so that i can alter the texture from JME. If they are both called the same, wont be able to distinguish between them. If i want to change the roof tiles texture. wont know which object is which.



So is there no way to name these tri-mesh's after the material they are created from?