I'm having issues with the MD5importer. I had everything working when I had them on separate JointControllers but then I realized that such was redundant and that their was a better way to do it so i decided to create a single JontController to Control the modelNode however I'm having issues with .setFading Command I get this error
Oct 26, 2008 10:35:47 AM com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException
SEVERE: Main game loop broken by uncaught exception
java.lang.NoSuchMethodError: com.model.md5.controller.JointController.setFading(Ljava/lang/String;FZ)V
at com.tps1.RandomCharacter.CubeController.update(CubeController.java:105)
at com.jme.scene.Spatial.updateWorldData(Spatial.java:540)
at com.jme.scene.Node.updateWorldData(Node.java:383)
at com.jme.scene.Spatial.updateGeometricState(Spatial.java:516)
at com.jmex.game.state.BasicGameState.update(BasicGameState.java:71)
at com.jmex.game.state.GameStateNode.update(GameStateNode.java:71)
at com.jmex.game.StandardGame.update(StandardGame.java:353)
at com.jmex.game.StandardGame.run(StandardGame.java:225)
at java.lang.Thread.run(Thread.java:619)
It only happens when I press S and realized it was because walk is default so when I pressed A to walk nothing would happen.
/**
Now we need some explanations. First, I'm using a bunch of enums for the different actions. This is not required for the GameControl system, it works with Strings. But enums have some nice properties compared to Strings: They are real classes, you can use them in switch statements and you can never spell them wrong, because the compiler will warn you. Using Strings as
it seems that you have some problems with ur custom UnifiedModelLoader. it doesnt seem likely the error u r getting has anything to do with the importer itself.
i would sugguest take a look at ur controller UML, there might be some inheritance error there.
public class UnifiedModelLoader{
/*
* This method opens a model in various format evaluating the extension
* In case in the same directory is already presents the same model in jbin format loads it
* Otherways load the model and save a jbin copy for the next time.
*
* Attention : in case the original model is changed you'll have to delete the jbin one the reload it.
*/
//Create a path to locate Textures
static String texturepath ;
/**
* @author Kyle Williams
* @description Loads a model file from a URL and saves it as a jbin for quicker loading
* @param modelFile is the file path
* @return loadedFile is the model created
*/
public static Node loadModel (String modelFile){
ModelNode loadedModel = null;
FormatConverter formatConverter = null;
ByteArrayOutputStream BO = new ByteArrayOutputStream();
String modelFormat = modelFile.substring(modelFile.lastIndexOf(".") + 1, modelFile.length());
String modelBinary = modelFile.substring(0, modelFile.lastIndexOf(".") + 1) + "jbin";
URL modelURL = Main.class.getClassLoader().getResource(modelBinary);
//Finds texture path using stored binary location
texturepath = modelFile;
//verify the presence of the jbin model
if ((modelURL == null)&&(!modelFormat.equals("md5mesh"))){
//evaluate the format
if (modelFormat.equals("3ds")){
formatConverter = new MaxToJme();
} else if (modelFormat.equals("md2")){
formatConverter = new Md2ToJme();
} else if (modelFormat.equals("md3")){
formatConverter = new Md3ToJme();
} else if (modelFormat.equals("ms3d")){
formatConverter = new MilkToJme();
} else if (modelFormat.equals("ase")){
formatConverter = new AseToJme();
} else if (modelFormat.equals("obj")){
formatConverter = new ObjToJme();
}
formatConverter.setProperty("mtllib", modelURL);
//save the jbin format
BinaryExporter.getInstance().save((Savable)loadedModel, new File("src/"+modelBinary));
} catch (IOException e) {
e.printStackTrace();
return null;
}
System.out.println("Saved model successfully n Loading Model");
}else if ((modelURL == null)&&(modelFormat.equals("md5mesh"))){ //Loads md5 model
try {
loadedModel = body;
//save the jbin format
BinaryExporter.getInstance().save((Savable)loadedModel, new File("src/"+modelBinary));
} catch (IOException e) {e.printStackTrace();
return null;}
System.out.println("Saved md5 model successfully n Loading Model");
*/
//temporary load until ready to create the jbin
return body;
}else{
try {
//load the jbin format
loadedModel = (ModelNode) BinaryImporter.getInstance().load(modelURL.openStream());
} catch (IOException e) {
return null;
}
System.out.println("Loaded model successfully");
}
/**
* @author Kyle Williams
* @description Creates a to Controller to load animations
* @param AnimationName is the name the user wants to give the animation
* @param animationpath is the URL of the aniamtion
* @param modelNode2 is the original model
* @return animate is the new animation created
*/
public static JointController doMd5Animation(Node modelNode2){
//Loads the animation from a file and assign it a name
JointController animate= new JointController(((ModelNode) modelNode2).getJoints());
//by setting it to 1 means setting it to RT_WRAP
animate.setRepeatType(1);
((ModelNode) modelNode2).addController(animate);
MD5Importer.getInstance().cleanup();
return animate;
}
public static JointAnimation doMd5Animate(String animationName, URL animationpath){
//Loads the animation from a file and assign it a name
try {
MD5Importer.getInstance().loadAnim(animationpath, animationName);
} catch (IOException e) {
System.out.println("Error....Loading Animation");
e.printStackTrace();
}
JointAnimation animation = MD5Importer.getInstance().getAnimation();
MD5Importer.getInstance().cleanup();
well thx to duenez I was able to figure out the issue. The problem wasn't with the code it was with the class that it compiled apparently it was out of sync