I’ve read and searched (yes, earned multiple free prizes with the code “bananapie”), but so far I’m not able to save a material I create in code. I just don’t understand, sorry.
Using com.jme3.material.Material.write results in NPE:
It is possible to generate an identical J3M file using Java code, by using the classes in the
com.jme3.material package. Specifics of the API will not be provided in this document.
This is not an intended usage behavior? I’m doing an import of another model + material format. And I could really use this. Any help?
Sorry, I thought that I was just using it wrong and the stack trace would be irrelevant then. Here you go:
java.lang.NullPointerException
at com.jme3.export.binary.BinaryOutputCapsule.write(BinaryOutputCapsule.java:437)
at com.jme3.export.binary.BinaryOutputCapsule.writeAlias(BinaryOutputCapsule.java:396)
at com.jme3.export.binary.BinaryOutputCapsule.write(BinaryOutputCapsule.java:240)
at com.jme3.material.Material.write(Material.java:1124)
at toniarts.opendungeonkeeper.tools.convert.KmfModelLoader.load(KmfModelLoader.java:208)
at toniarts.opendungeonkeeper.tools.convert.AssetsConverter.convertModel(AssetsConverter.java:260)
at toniarts.opendungeonkeeper.tools.convert.AssetsConverter.convertModels(AssetsConverter.java:207)
at toniarts.opendungeonkeeper.tools.convert.AssetsConverter.convertAssets(AssetsConverter.java:114)
at toniarts.opendungeonkeeper.setup.DKConverter$Converter.run(DKConverter.java:220)
@tonihele said:
Sorry, I thought that I was just using it wrong and the stack trace would be irrelevant then. Here you go:
Yes, well… if anyone ever complains that you included too much information in a post you have a right to smack them… but too little information is very annoying. Without the stack trace, I would have had to read your code, turn it over in my head a hundred times, hope to spot the random glitch since I can’t run it myself, etc… where as NPEs are the SINGLE EASIEST EXCEPTION to track down.
You don’t create a j3m (text) file when you export a material this way, you get a binary file for which you have to explicitly add a binary loader and a new file extension.
@normen said:
You don't create a j3m (text) file when you export a material this way, you get a binary file for which you have to explicitly add a binary loader and a new file extension.
Oh yes, now I think I understand that both ways I described are not correct ways. Binary and XML are completely different from the text file. Sorry @pspeed for my incomplete posting. What I think I want is the text file. So that it would be editable with the JME SDK. Is there a way to easily achieve this? Or is this even smart thing to do?