B Tutorial Animation Animation tutorial (Blender3D)

Users who are viewing this thread

DtheHun

Sergeant Knight
The official Blender Exporter has been released. I have read the replies, and I sadly understood that many of us think that Blender's only avail was making static meshes till now, because of old scripts. This spring, I have written a tutorial to Daydream team members, about how to make animations in Blender, and how to get them to Mount&Blade v1.11. Maybe some parts of this tutorial will be useful to you too, although it is not for the new official exporter script. The animation itself is figurative, as the method is complex enough. My english is far from perfect, I am better with arrows. There will be many of them in the pictures, so I hope you can read them.  :smile:



Here is what you need:


Blender2.49b: http://download.blender.org/release/Blender2.49b/
note: With higher blender versions (2.5 and above), these sripts are not working. However , you can have multiple Blender versions installed. I prefer modeling in 2.5, animating and exporting finished models in 2.49.
OpenBrf: http://www.mbrepository.com/file.php?id=1466
ModuleSystem v1.010: http://www.mbrepository.com/file.php?id=1694
BRF Export script by Dirk Schulz,
Bake Constraints script by Roger Wickes,
and skeletons (.blend) ready for animation are here:
http://web.t-online.hu/findadezso/surrealarms/mb_animacio.zip 

You get two kind of skeletons. One with Forward Kinematic chain, and another with my Inverse Kinematic setup. Here is the difference:


I. Animate

We are going to set up a new sword combat stance. Open skeleton_IK.blend.


Make sure that you are in Pose Mode.
Select abdomen and the two IK_Foot bones [Shift + Right click]


Rotate them on Z axis [R + Z + (move mouse, or use Num buttones and write -75), Right Click to apply the rotation]


This will be the first frame. (1 sec=25 frame)
Rotate [R], and Move [G] bones to set up something like this.
[Alt G, Alt R] - clears the Location/Rotation.
[N] - open Transform Properties
IK controlled bones sometimes do not chose the right direction to rotate, but you can help them by rotating the thigh bones.
Press [A] to select all bones, then press (I) and select LocRot to save this pose.


Go forward in the timeline to frame 15 [Right Arrow]
Sink the abdomen on axis Z to make the crouch deeper. Rotate the legs or move the helper bones if the angles turns out.
You can also play with the upper body if you want to make the stance more flimsy.
Press [A] to select all bones, then press (I) and select LocRot to save this pose on the 15. frame.


Now go back to the first frame [Left Arrow]. Copy the pose.


Go forward to frame 25. Past the pose.
Every bone is selected, so press (I) and select LocRot to save this pose on the 25. frame.


Open the Timeline menu, set the end frame to 25, play your animation.


Go to Action Editor view. Good place to edit the lenght of the stance by moving the dots [Alt, Shift, B - helps multi selection], if you make a wrong frame you can delete it here [X].

When you are pleased with your work save the project to sword_stance.blend 

II. Exporting

While animation with the IK chain is much more simple and precise - you do not need to rotate all the bones of the legs one by one after each movement of the torso to keep feet in place - exporting FK animation is much more simple. In the IK chain, the position data of the controlled legs are in the helper bones. They are not used by the game, so their data lose if you export the animation to BRF. Before exporting the IK animation, you must transform it to FK.


Select Object Mode on the right. Make sure, that imported_armature - the skeleton - is selected.
Open Scripts Window on the left.
Run Scripts/Animation/Bake Constraints
Now the skeleton is FK, but not Mount&Blade compatible, so we have to export it's Action to the FK armature.

Save the project to sword_stance.blend


Open skeleton_FK.blend.
Select Append or Link [Shift F1] from File menu.
Load sword_stance.blend/Action/Action.002


Open Action Editor Window on the left.
Select imported_armature from the list of available actions.


Before export, mirror abdomen's LOC X IPO curve on the horizontal axis. Do not ask me why, but the animation will sliding in game without this process. 
So, open Ipo Curve Editor Window on the left.
Select Ipo type: Pose
On the right, select abdomen bone.
Select LocX
Press A to select the whole curve.
Mirror it. [Shift M 3, or Curve/Mirror/Over Horizontal Axis]


Save the project to sword_stance_exp.blend 
Time to export what we have.
Select File/Export/Brf Export (.brf)
Export Anim
Name it: sword_stance.brf

III. OpenBrf


Open sword_stance.brf with OpenBrf
Export the animation - imported_armature.
Give it the name: sword_loop01.SMD


Open uni_stances.brf with OpenBrf in Mount&Blade\Common_Res
There is already a sword_loop01, rename it to sword_loop01old
Import sword_loop01.SMD
Save uni_stances.brf

IV. module_animations.py
Edit with IDLE module_animations.py


Find sword_loop01
Change the duration to 1.0 from 9.0 (25 frames will take 1.0 sec)
Change the end frame to 24 from 200 (25. was the last key in Blender, but in Mount&Blade the first frame is 0 not 1, so 25. frame will have the number 24.
Save the changes, and run build_module.bat.

Start the game and equip a one hand weapon.
 
Hi DtheHun,
thanks for the tut.
I am lost though on the part of exporting.
I did the bake constraints conversion. Now my sword stance is FK.
I opened the FK skeleton from your pack so that I can do the append or link action of my sowrd stance to the fk armature.
When I do load library, nothing happens. I see in your pictures that you have somewhat imported the whole action. I have no visible actions in the action editor and I still remain with the FK skeleton there. What could be wrong?
I thought because I dont have the pyton some scripts are not working. but then I installed the python (couple of versions and the blender still doesnt recognize that python is installed)
Is that something I missed during the tut?
Thanks in advance for your help and time.

I took this day off for this! :smile:) I am really into it. I appreciate any hurried answer if possible.
 
You can try to "Append or Link" my pre-made action from sword_stance.blend/Actions/imported _armature (the pack contains this save) to see; is the "Append or Link" function itself, or the previous steps - your save - is wrong. Blender's official Python install process worked for me under XP, but there must be some troubleshoot help, if you search for the error message on Google. Unrecognized Python is not a good state anyway.
 
 
How to create new animations without preset ones? Without your files.
http://173.192.225.169/BlenderExporter.zip .....
 
Wow, that looks impressively complicated. D:

Is it maybe possible to somehow import ones from Native Warband and edit those a bit? :???:
 
Ceolwynn said:
How to create new animations without preset ones? Without your files.
http://173.192.225.169/BlenderExporter.zip .....

The official text doesn't talk about inverse kinematic (fixed feet) option. A nod, or wave doesn't need that, but if you want to make a more complex movement like this one: http://www.youtube.com/watch?v=h1f5jqq-d00] , then you have to set up an IK chain yourself, or use mine.  :wink:

FrisianDude said:
Is it maybe possible to somehow import ones from Native Warband and edit those a bit? :???:
I can't import those, just make and export new ones.

 
thanks a lot dude. I already started to do some things..
By the way, are you skilled a bit with the coding? I'm trying to attach to the animation I made, a script, that should trigger the animation when I push a key. I don't find anything that could help me on the tuts.
Thanks again!!! :smile:
 
Sorry to pop-in so annoying :smile: but:
I managed to put the animation in-game instead of the kicking. The problem is that, even if I set the time and frames correctly, it only show a sec of the full animation I made.
The same happens with a two hander stance I made and replaced the old one. It goes for about 3 seconds and then it restarts..
Can you help with some ideas here?
Thanks.

 
cifre said:
I'm trying to attach to the animation I made, a script, that should trigger the animation when I push a key.

In the example I will show you how to attach right kick animation to "K" key.

Edit with IDLE module_mission_templates.py


Left: Trigger code
my_motion_key = (
    0, 0, 0, [(key_clicked, key_k),],
    [
        (get_player_agent_no,":player_agent"),
        (agent_get_horse, ":player_horse", ":player_agent"),
        (lt, ":player_horse", 0),
        (agent_set_animation, ":player_agent", "anim_kick_right_leg"),
    ])

Right: You have to paste the trigger name (my_motion_key, ) in "List of triggers" section of each mission templates, where you want to use it; If you write it only under "town_center", then it will works only in town centers. There are many mission templates, so have a good hunting. 

About the animation length problem; if the duration, start/end frame numbers in module_animations.py do not have effect on it, maybe the duration of kick is controlled with flags, worst if it is hardcoded. True, there was no kick in vanilla game when I have written this tutorial, but it is hard to believe that those variables have no more effect in Warband. My advice is; You should set up a key controlled trigger for your animation, and play with different variables and flags to find what is wrong.
 
THANK YOU!  :grin:
I'll try today again after getting back home.
I think the preset animation in-game is coded (I erased the flags in the animation module scripts) as everything which is longer then the original one is interrupted.
But now, knowing how to set a new animation trigger key, I hope I will not have any issues anymore.
Thanks again and please check again the thread as I may require your so greatly beloved help! :smile:
 
Scripts is a window type like 3D view, or Action Editor.

BlenderScriptsWindow.png
 
Back
Top Bottom