Hi,
I’v always relied on the same code to convert my models from xml to j3o. (code at bottom)
But now it has stopped working… I only get the mesh, no animations are able to run. It leaves no error when trying to run an animation either.
I know it’s only this model thats causing the problem because I still have the old character.j3o left and it works if I use that one instead of the new one.
I recently started using blender 2.6 instead of 2.49 and I just got the export OGRE working. I looked into the character.mesh.xml and character.skeleton.xml and found no defects. They look as they’ve always looked as far as I can see. It does however export two more files: character.mesh and character.skeleton (no xml in the end).
Here is my convert code:
[java]
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.jme3.app.SimpleApplication;
import com.jme3.asset.plugins.FileLocator;
import com.jme3.export.binary.BinaryExporter;
import com.jme3.scene.Spatial;
public class MainClass extends SimpleApplication{
public static void main(String[] args){
new MainClass().start();
}
public MainClass(){
Logger.getLogger("").setLevel(Level.OFF);
this.showSettings = false;
}
private static String source = "C:/Users/Andreas/Desktop/EXPORT/";
File folder = new File(source);
private static String name = "character";
@Override
public void simpleInitApp() {
assetManager.registerLocator(MainClass.source, FileLocator.class.getName());
if (name != null){
Spatial model = assetManager.loadModel(name+".mesh.xml");
BinaryExporter ex = BinaryExporter.getInstance();
File f = new File(source+name+".j3o");
try {
ex.save(model, f);
System.out.println("------------------------------------");
System.out.println("File "+name+" was successfully converted to j3o.");
System.out.println("Path to j3o: "+source+name+".j3o");
System.out.println("------------------------------------");
this.stop();
} catch (IOException e) {
e.printStackTrace();
}
} else {
String[] list = getContent();
for (String name : list) {
if (name != null) {
try {
Spatial model = assetManager.loadModel(name);
BinaryExporter ex = BinaryExporter.getInstance();
File f = new File(source+name+".j3o");
ex.save(model, f);
System.out.println("------------------------------------");
System.out.println("File "+name+" was successfully converted to j3o.");
System.out.println("Path to j3o: "+source+name+".j3o");
System.out.println("------------------------------------");
this.stop();
} catch (IOException e) {
System.out.println("------------------------------------");
System.out.println("File "+name+" was NOT converted to j3o.");
System.out.println("Path to file: "+source+name);
System.out.println("------------------------------------");
}
}
}
}
}
public String[] getContent(){
File[] listOfFiles = folder.listFiles();
String[] list = new String[listOfFiles.length];
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
if (listOfFiles[i].getName().endsWith(".mesh.xml")) {
System.out.println("File " + listOfFiles[i].getName());
list[i] = listOfFiles[i].getName();
} else {
System.out.println("NOT mesh.xml File " + listOfFiles[i].getName());
list[i] = null;
}
} else if (listOfFiles[i].isDirectory()) {
System.out.println("Directory " + listOfFiles[i].getName());
list[i] = null;
}
}
return list;
}
}[/java]
All help appreciated.