Blender import error

@Kaelthas

Hi, I get the following crash with one of my models. While I#m pretty 100% sure that the error itself lies in the model, I think the expected bahaviour would be to get the bland white default material, wich is also used when the image is not found.

java.lang.NullPointerException
	at com.jme3.scene.plugins.blender.textures.ImageUtils.merge(ImageUtils.java:84)
	at com.jme3.scene.plugins.blender.textures.CombinedTexture.flatten(CombinedTexture.java:209)
	at com.jme3.scene.plugins.blender.materials.MaterialContext.applyMaterial(MaterialContext.java:168)
	at com.jme3.scene.plugins.blender.meshes.MeshHelper.toMesh(MeshHelper.java:216)
	at com.jme3.scene.plugins.blender.objects.ObjectHelper.toObject(ObjectHelper.java:159)
	at com.jme3.scene.plugins.blender.BlenderModelLoader.load(BlenderModelLoader.java:69)
	at com.jme3.scene.plugins.blender.BlenderModelLoader.load(BlenderModelLoader.java:54)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:288)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:374)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:378)
	at de.visiongamestudios.compiler.CompileApplication.internalcompile(CompileApplication.java:262)
	at de.visiongamestudios.compiler.CompileApplication.access$4(CompileApplication.java:244)
	at de.visiongamestudios.compiler.CompileApplication$3.call(CompileApplication.java:211)
	at de.visiongamestudios.compiler.CompileApplication$3.call(CompileApplication.java:1)
	at com.jme3.app.AppTask.invoke(AppTask.java:142)
	at com.jme3.app.Application.runQueuedTasks(Application.java:583)
	at com.jme3.app.Application.update(Application.java:596)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:231)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
	at com.jme3.system.lwjgl.LwjglCanvas.runLoop(LwjglCanvas.java:229)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
	at java.lang.Thread.run(Thread.java:724)
Failure in models/land/vegetation/northern_veg3972/grass1.blend

Could you please post here the link to the model ?
I will take a look on it. The merging function gets null instead of one of the images it should merge, but I need to check why this happens at all :slight_smile:

@EmpirePhoenix
checkout to the latest version. It should be working now :slight_smile:

@Kaelthas: Why does the importer keep crashing, we said it should import what it manages to import and not crash because of some part of the process not working. Please catch these errors.

I know it shouldn’t crash. But bugs happen from time to time.
It was there for some time, but I hope it will work now. I did not add anything new to textures loading for some time.

As I understand norman more means something likea try{}Catch{Throwable somethingHappend} around everything. Not sure tho.

To be fair, this bug probably only happend because the model used here was quite fucked up, I never got something similar with a clean model.

I have just made a commit that makes the importer catch any kind of exception and throw it with a proper message as IOException from the ‘load’ method.

Hope it is wat you ment @normen :wink: