[3.1] My Model importet from Blender has no AnimControl

I made a model by myself in Blender and it does not include the AnimControl in the JME.
I did not use IK or something weird. It is a simple animation with a simple model.

I am currently using the Alpha of JME 3.1

I itterated through all controls and childs, and there is no AnimControl to be found.

Are you exporting as a .blend file or a Ogre3D file? If it’s a Ogre file, print screen the options of the exporter.

Hi
Did you add armature modifier to your model ? If not take a look at here:

I added an armature modifier, and exported as .blend

Then … I have no clue … Sorry :confused:
I suggest to take a look at http://wiki.jmonkeyengine.org/doku.php/jme3:external:blender.
And if you get any error or warning when converting your .blend model to .j3o
please provide them here.

Edit : Also if it is possible . You can upload your model .So we can take a look at it. :grinning:

You can play the animation in Blender, I suppose?

I can play the animation in blender.
Converting it still caused an NPE.
Here is the download http://www.mediafire.com/download/mbwcdp3s0ulx658/Test.blend

I opened it in the JMonkeyEngine, and there is an AnimControl, but Playing the “Hi” animation doesn’t do nothing. I’m going know see that in Belnder.

BTW, when do you get a NullPointerException?

I tried the following

control = player.getControl(AnimControl.class);

might be that the tutorials are outdated

Well, in Blender at the NLA tracks, when I clicked in that symbol that looked like a snow icon, i saved it and opened in JME, and it worked. The animation was a little messed up, but It was playing. And, in this second time, there was a SkeletonControl. So, I don’t know what is happening…

You can right click the model in the Projetcs tab and select “View model” to view the model instead of running the game. You can also see how is your model structured.

I convert it to .j3o and played animation it plays correctly .

I can not see a snow symbol in the NLA tracks

by the way my SDK crashes, when opening the SceneComposer

Your SDK crashes when you try to open the SceneComposer? The SDK is probably corrupted. I suggest you to reinstall the SDK, since the SceneComposer is a REALLY HUGE help to create a game.

1 Like

Here it is… it works …


the problem is in your code when getting AnimControl
Try to do something like this to get the anim controller.
The code is a bit messy . but is understandable.

  player = (Node) assetManager.loadModel("Models/Test.j3o");
       // player.rotate(0, FastMath.DEG_TO_RAD * 180, 0);
        rootNode.attachChild(player);
        
        List<Spatial> sp =player.getChildren();
       int i=0;
        for(Spatial s : sp)
        { 
        i++;
        System.out.println(" Main for.. round:  "+i );
        
      
        addLodControl(s);
           
        }
    }
public void addLodControl( Spatial parent) {
    if (parent instanceof Node) {
         System.out.println("I AM Node .... Name:"+ parent.getName() );
         control = parent.getControl(AnimControl.class);
        if(control != null)
        {  
            System.out.println("Control Not Null ....");
            control.addListener(this);

        for (String anim : control.getAnimationNames()) {
            System.out.println("Anim name :"+anim);
        }

        channel = control.createChannel();
        channel.setAnim("Hi");
        }
      for ( Spatial s : ((Node) parent).getChildren()) {
          
          addLodControl(s);
         
      }
    } 

1 Like

Thank you guys :smiley:

Problem fixed, and I understood something important.
With the System.out.println in your code Ali_RS, I understood, how to fix that problem easier, because the names inside of blender are the same as the nodes inside of the JME. :smiley:

1 Like