I have read through the wiki and am trying to use the XmlAnimator that is on the wiki to test loading the animations from a model created in blender, but can’t seem to get it working
I keep getting “Armature should have 1 controller, but has 0”
Here is a link to my model if you want to have a look (Very simple looking pretty new to this 3d stuff)
www.digitalentity.webs.com/othersiteimages/person.blend
There are 3 animations, Rest (Model Rest pose), Stand and Walk
Thanks,
If it helps is Blender 2.49
What I think Im having trouble with is when I follow the tutorial is where is the superbone meant to be.
Since this is what the XmlAnimator code is looking for
List<Spatial> armatures =
rootNode.descendantMatches(Bone.class, "SuperBone");
Not sure if its an issue with how I have made the model or if there is something wrong with my bone naming or what. Also am I meant to be able to drag the bones around in the model app? (the one on the animation tutorial page)
If I click on one of the red dots and go to drag it with left mouse, it doesnt do anything. The mesh just go into what sorta looks like a wireframe mode
Thanks
Ok I have looked into this again
it now loads into XmlAnimator fine but will only list Rest as the only Animation
I have looked in the XML file and can only see this as the listed action, not sure if that means its a blender issue
Is the link above still the current blender-version or did you do any modifications?
Are you using the current hottbj-exporter 0.4b?
EDIT:
I'm quite sure that the exporter won't work properly with added mirror-modifier. (Actually I wonder
it is not throwing an error as it is quite strict…) Try to apply the mirror-modifier before parenting the
armature to the mesh.
I have just updated the blend file,
I had applied the mirror before exporting, but I just tested it then and it is now sorta working in the code just still will only show the rest animation
I had been using hottbj 0.4a I will get the updated one a see if that makes any difference
Well, I tried some things.
First of all, just applying the modifier before export might work but won't have the effect you
might want as the vertices are connected to the wrong bones (try to move the bones under the mirrored
mesh). YOu can solve this somehow like this:
- apply the modifier
- remove the parent of the armature:
- press f7 to switch to object view.
- in objects and links, remove the Par:Skeleton
- select first mesh AND second skeleton -> ctrl-p -> aramture -> create from bone heat
But that actually this does not solve your problem. So the cause can only be the animations itselfs. It might be
possible that you use bones in the animation that are removed in the skeleton. I think this might be the point. You can have a look at your bones and manually delete the bone in the ActionEditor for every animation(there might be confusion about rootbone and superbone).
I used a more drastical way and removed all bones from the animations and added the keys via ctrl-i (loc,rot) again. Keep in mind that the restpos-animation have to be in the same pose afterwards again.
The walk animation I made a quick test animation.
Export it and it works.
I will send you a working blend file to you email-address that is in oyur profile.
You sir are a legend!
I have fixed it up in my model and all the animations are now listed and appear to be working :lol:
Ok I have learned a few things,
- Dont mess with the bones after making an animation, or make sure you check what bones are listed in your animations (remove any that dont exist anymore)
2)Open the XML file in notepad or something to get the correct name for the Superbone in case is different to what the code is looking for
I think that was where I went wrong was the code wouldnt get any animations so I re-added the root bone which killed the animations and they didnt work after I have found the right bone name to look for
Here a helper method that will help getting the AnimationController. Should work
for every case. (at least it does for me):
n is the model with the animation:
public static AnimationController getAnimationController(Node n)
{
if (n==null)
return null;
else if (n instanceof Bone)
return ((Bone)n).getAnimationController();
else
{
AnimationController result=null;
if (n.getChildren()!=null)
for (Spatial child : n.getChildren())
{
if (child instanceof Node)
result = getAnimationController((Node)child);
if (result!=null)
return result;
}
return null;
}
}
Even better XD that works great!
Thanks for all your help I wasted a lot of time staring at it trying to figure it out