OK I will add proper checks to such situation.
I think I will commit the fix as well. If you say you did not have problems with hanging maybe I did something wrong.
If there are problems - they will be reported quite fast I belive
Thanks for the reply.
Perhaps you believed that the test application was hanging because it did not open a viewport. But thatās normal behavior for a headless app.
@sgold said: Perhaps you believed that the test application was hanging because it did not open a viewport. But that's normal behavior for a headless app.
Yes that was it
@nehon no need to check anything now.
Sorry, my mistake.
But I added non-existing animation to the blender key as you suggested and I did not have an exception.
Instead I got a warning logged by AnimationHelper:
Mar 04, 2014 3:09:08 PM com.jme3.scene.plugins.blender.animations.AnimationHelper applyAnimations
WARNING: Cannot find animation named: aaa.
Could you update to the latest version and try again ? Or maybe post your code again and Iā'll try it out.
Sorry I didnāt have time to look into that, Iām glad you fixed it.
@Kaelthas said: But I added non-existing animation to the blender key as you suggested and I did not have an exception. Instead I got a warning logged by AnimationHelper:Mar 04, 2014 3:09:08 PM com.jme3.scene.plugins.blender.animations.AnimationHelper applyAnimations
WARNING: Cannot find animation named: aaa.Could you update to the latest version and try again ? Or maybe post your code again and Iā'll try it out.
Thank you, @Kaelthas, for looking into this.
I updated to rev 11068, and now I see the warning you described. So thatās taken care of.
However, I notice that if the nodeName passed to addSkeletonAnimation() is invalid, the bone animation seems to get silently ignored. Perhaps a diagnostic message is needed for that case.
@sgold
Animations are applied after the object is loaded. If you add animation of an object that does not exist it will never be taken care of - so no warning will appear.
I could of course add some checks at the end of the loading process, but I think it is unnecessary. Not seeing an animation in your node is a good warning by itself
After updating to the latest nightly build (140319) I am getting this stacktrace when trying to load a blender model that worked before.
[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at com.jme3.animation.SkeletonControl.cloneForSpatial(SkeletonControl.java:375)
at com.jme3.scene.Spatial.clone(Spatial.java:1185)
at com.jme3.scene.Node.clone(Node.java:565)
at com.jme3.scene.Node.clone(Node.java:60)
at com.jme3.scene.Spatial.clone(Spatial.java:1172)
at com.jme3.scene.Node.clone(Node.java:565)
at com.jme3.scene.Node.clone(Node.java:60)
at com.jme3.scene.Spatial.clone(Spatial.java:1172)
at com.jme3.scene.Node.clone(Node.java:565)
at com.jme3.scene.Node.clone(Node.java:60)
at com.jme3.scene.Spatial.clone(Spatial.java:1214)
at com.jme3.scene.Spatial.clone(Spatial.java:66)
at com.jme3.asset.CloneableAssetProcessor.createClone(CloneableAssetProcessor.java:48)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:327)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:374)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:378)
at spaceworld.UFOSpaceWorld.simpleInitApp(UFOSpaceWorld.java:228)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Unknown Source)[/java]
What I tried to run was
[java] BlenderKey blenderKey = new BlenderKey(
āobjects/creatures/alien/alien.mesh.xmlā);
Spatial alien = (Spatial) assetManager
.loadModel(āobjects/creatures/alien/alienmodel.blendā);[/java]
Do you think anything can be done about it?
What are you doing with blenderKey, if anything? I thought the idea was to pass the BlenderKey to loadModel() in place of a path string.
@sgold said: What are you doing with blenderKey, if anything? I thought the idea was to pass the BlenderKey to loadModel() in place of a path string.
I used to blenderKey to load the model but then the texture did not appear, so I loaded it with the .blend file instead. But even if I comment out the blenderkey the stracktrace will be the same. I think that Iām using a model with no animation. Iām not very skilled with blender and I wonder if itās possible to load the model somehow, since I could load other models with the updated jme3.
I could run code to load another model:
[java] Spatial spaceStationSpatial = assetManager
.loadModel(āSpaceStation.blendā);[/java]
So maybe I could try and convert the models with the jme IDE? Iām currently using Eclipse.
I do remember something about models with a skeleton will need at least one animation. I thought maybe it was fixed but I superstitiously add animations to anything with a skeleton now so I wouldnāt know for sure personally.
I believe the NPE youāre seeing means thereās a skeleton (what Blender calls an āarmatureā) in your alien model. Get rid of the armature and it should import just like your other models. To find the armature, I recommend using the Outliner editor in Blender.
Or if your alien is intended to have an armature, then provide it with some animations (what Blender calls āactionsā) and import like so:
[java]
BlenderKey key = new BlenderKey(āobjects/creatures/alien/alienmodel.blendā);
key.addSkeletonAnimation(āalienā, ācollapseā);
Spatial model = assetManager.loadModel(key);
[/java]
You could of course write an app in Eclipse to do the import for you, but it would invoke the same importer code and youād get the same NPE.
I donāt know how to do an animation and after I removed the armature in Blender then I still get NPE. When I try and open the model in the jme IDE then it prints warnings and crashes. Is there no simple way? This is what happened:
[java] BlenderKey blenderKey = new BlenderKey(
āobjects/creatures/alien/alienmodel.blendā);
Spatial alien = (Spatial) assetManager
.loadModel(blenderKey);[/java]
[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.NullPointerException
at com.jme3.animation.SkeletonControl.cloneForSpatial(SkeletonControl.java:375)
at com.jme3.scene.Spatial.clone(Spatial.java:1185)
at com.jme3.scene.Node.clone(Node.java:565)
at com.jme3.scene.Node.clone(Node.java:60)
at com.jme3.scene.Spatial.clone(Spatial.java:1172)
at com.jme3.scene.Node.clone(Node.java:565)
at com.jme3.scene.Node.clone(Node.java:60)
at com.jme3.scene.Spatial.clone(Spatial.java:1172)
at com.jme3.scene.Node.clone(Node.java:565)
at com.jme3.scene.Node.clone(Node.java:60)
at com.jme3.scene.Spatial.clone(Spatial.java:1214)
at com.jme3.scene.Spatial.clone(Spatial.java:66)
at com.jme3.asset.CloneableAssetProcessor.createClone(CloneableAssetProcessor.java:48)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:327)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:374)[/java]
Did I forget something in blender when I removed the armature?
The stack track suggests that JME is trying to load a model asset with a skeleton/armature. Maybe itās loading some other model than the one you removed the armature from.
At some point, weāll need to see the .blend file in order to understand whatās happening.
Not sure where I should put this, so putting it here:
Tools/OgreXml/install Ogre Blender xml in the sdk asks the user to point to the blender scripts directory. Only worked for me when I moved the created python file to the addons directory. So I guess the window should ask to be pointed towards the scripts/addons directory instead.
Please create a new thread at
http://hub.jmonkeyengine.org/forum/board/troubleshooting/jmonkeyplatform/
regarding your SDK issue.
@niklasro said: Thanks for the replies. The alienmodel.blend if you could have a look at it.
The alien.blend file you pointed me to includes an armature named ārigā. Loading the model with a ātrunkā build of JME3 (checked out from Google Code Archive - Long-term storage for Google Code Project Hosting.) gave an NPE in SkeletonControl.java:375.
After I deleted the armature in Blender, I was able to load the model and view it with no difficulty.
I thought you said you had removed the armature?
Ok, now it works. I first deleted the armature node but I didnāt realize that I also had to delete another node in Blender. Now the model appears in the scene! Thanks a lot for all the help. 8)