Hi,
I exported a simple Quader which i konverted in a mesh. Then I modified the TestColladaLoading class
that they can load my dae File. But it didnt work, I always get:
09.12.2007 23:55:24 com.jmex.model.collada.ColladaImporter load
WARNING: Unable to load Collada file.
java.lang.IllegalArgumentException: InputStream cannot be null
The file is in the right directory.
I use ColladaMax 3.03 and Max 8.0. The unmodified TestColladaLoading class works perfect.
Also, I cant load the man.dae in Max I get the error: "[6376] Mesh has source with an unknown id"
and three other warnings.
I dont know what to do, to export a simple object from max and use it in jme :/.
Thanks for any help and sorry for my bad english :).
You should post the code where you create the InputStream from a path URL or String… There seem to be a problem with the opening of the file which has nothing to do with jME.
Also, sometimes exporters/importers don't work as well as expected.
/**
* Shows how to load a COLLADA file and apply an animation to it.
* @author Mark Powell
*
*/
public class TestStart extends SimpleGame {
AnimationController ac;
boolean boneOn = false;
public static void main(String[] args) {
TestStart app = new TestStart();
app.setDialogBehaviour(AbstractGame.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
protected void simpleUpdate() {
if( KeyBindingManager.getKeyBindingManager().isValidCommand( "bones", false ) ) {
boneOn = !boneOn;
}
}
protected void simpleRender() {
//If we want to display the skeleton use the BoneDebugger.
if(boneOn) {
BoneDebugger.drawBones(rootNode, display.getRenderer(), true);
}
}
protected void simpleInitGame() {
KeyBindingManager.getKeyBindingManager().set( "bones", KeyInput.KEY_SPACE );
//Our model is Z up so orient the camera properly.
cam.setAxes(new Vector3f(-1,0,0), new Vector3f(0,0,1), new Vector3f(0,1,0));
cam.setLocation(new Vector3f(0,-100,20));
input = new FirstPersonHandler( cam, 80,
1 );
//this stream points to the model itself.
InputStream mobboss = TestColladaLoading.class.getClassLoader()
.getResourceAsStream("jmetest/data/model/collada/quader.dae");
//this stream points to the animation file. Note: You don't necessarily
//have to split animations out into seperate files, this just helps.
//tell the importer to load the mob boss
ColladaImporter.load(mobboss, "model");
//we can then retrieve the skin from the importer as well as the skeleton
SkinNode sn = ColladaImporter.getSkinNode(ColladaImporter.getSkinNodeNames().get(0));
//clean up the importer as we are about to use it again.
ColladaImporter.cleanUp();
//attach the skeleton and the skin to the rootnode. Skeletons could possibly
//be used to update multiple skins, so they are seperate objects.
rootNode.attachChild(sn);
rootNode.updateGeometricState(0, true);
//all done clean up.
ColladaImporter.cleanUp();
lightState.detachAll();
PointLight pl = new PointLight();
pl.setAmbient(new ColorRGBA(0.5f,0.5f,0.5f,1));
pl.setDiffuse(new ColorRGBA(1,1,1,1));
pl.setLocation(new Vector3f(10,-50,20));
pl.setEnabled(true);
lightState.attach(pl);
}
}
I copied the quader.dae in "workspacejmesrcjmetestdatamodelcollada".
And I get a WARNING:
10.12.2007 00:41:16 com.jmex.model.collada.ExtraPluginManager processExtra
WARNUNG: Could not process extra of type: FCOLLADA
That comes not when i load men.dae.
Seems that you have the same problem as in this other thread:
http://www.jmonkeyengine.com/jmeforum/index.php?topic=6581.msg52378#msg52378
I use the complete jme, no jars. I have added it in my Projekt under Java Build Path -> Projects -> jme.
Is that a problem?
When I use:
try {
InputStream mobboss = new BufferedInputStream( new FileInputStream("quader.dae") );
ColladaImporter.load(mobboss, "model");
} catch( FileNotFoundException fnfe) {
fnfe.printStackTrace();
}
And copy the quader.dae and man.dae in my projekt path, the "man" works, an the "quader" not.
Edit:
I uploaded the quader.dae here: http://www.htw-dresden.de/~s52377/files/quader.DAE, can someone
test it with this file?
And as I say previously, I get an warning when I open the quader.dae:
10.12.2007 00:41:16 com.jmex.model.collada.ExtraPluginManager processExtra
WARNUNG: Could not process extra of type: FCOLLADA