Pages

about my opensource eclipse java applications recently i'm studying GWT and Android

Thursday, January 31, 2008

mkhuman's .obj and jme

i'm afraid this is already have been solved.
but i had coudn'd ,that why i'm writing.

so when i read .obj which made by makehuman.
i need head's TriMesh,but 'node.getChild("head")' didnt work.
so i changed ObjToJme.class keep line usemtl's name.


I'm not sure this patch work or not,but it easy to explain what i changed.
### Eclipse Workspace Patch 1.0
#P jMonkeyEngine
Index: src/com/jmex/model/converters/ObjToJme.java
===================================================================
RCS file: /cvs/jme/src/com/jmex/model/converters/ObjToJme.java,v
retrieving revision 1.2
diff -u -r1.2 ObjToJme.java
--- src/com/jmex/model/converters/ObjToJme.java 21 Sep 2007 15:45:30 -0000 1.2
+++ src/com/jmex/model/converters/ObjToJme.java 1 Feb 2008 06:57:08 -0000
@@ -283,8 +283,13 @@
addMaterial(parts);
return;
} else if ("usemtl".equals(parts[0])) {
- if (materialNames.get(parts[1]) != null)
+
+ if (materialNames.get(parts[1]) != null){
+ //TODO
curGroup = materialNames.get(parts[1]);
+ //something special for makehuman
+ curGroup.name=parts[1];
+ }
else
setDefaultGroup();
return;
@@ -395,6 +400,14 @@
ArraySet thisMat = materialSets.get(curGroup);
if (thisMat.objName == null && curObjectName != null)
thisMat.objName = curObjectName;
+ //TODO
+ //something special for makehuman .obj file
+ if(thisMat.objName.equals("mesh.obj") && curGroup.name!=null){
+ thisMat.objName=curGroup.name;
+ }
+
+
+
IndexSet first = new IndexSet(parts[1]);
int firstIndex = thisMat.findSet(first);
IndexSet second = new IndexSet(parts[2]);
@@ -482,6 +495,8 @@
MaterialState m;
TextureState ts;
AlphaState as;
+ //TODO
+ String name;
}

/**