-
Notifications
You must be signed in to change notification settings - Fork 1
Importing animations into Blender
Blender's glTF import tool a little idiosyncratic, which means there are a few steps to getting animations into Blender successfully. Also, as far as I can tell, there is no easy way to merge a model and an animation for that model in Blender, so we will use my included tool for this step.
You want to know how to get a model into Blender and through the unpack-repack process in the first place. Please try this tutorial at least once (the unpack and repack steps), then come back.
Please note that this is not a tutorial on 3D animation in Blender - I am not an animator and I do not know how to animate. This is a tutorial on how to get animations into and out of Blender, and back into the game. Please consult other tutorials on animating in Blender.
-
Grab the animation file you would like to edit. I am going to edit Agnès' dash animation, chr5001_mot_dash.mdl. Also grab the base model for your character; in my case this would be chr5001.mdl.
-
Run kuro_mdl_to_basic_gltf.py by double-clicking the script and it will unpack your model and animation and convert them to .glb format. (A second filetype, .metadata, will be created for each .glb; this file has the list of locators and can be directly edited.)
-
If you were to import the animations as is, you would only find a pose and key frames. You can animate this way, but it would be much easier with the model present. (Particularly because you cannot allow Blender to orient the bones - more on this later.)
Left: The animation as-is. Right: The animation, merged with the model.
*If you want to see textures, then also copy over the images, put them in a textures folder and convert them to .png files.
- Place kuro_merge_model_into_animations.py into the folder with the animations, and double click the script. This script will insert all the model data into each animation (notice that the resultant file size of each animation will be substantially larger). NOTE: Like all my tools, I actually recommend running
python kuro_merge_model_into_animations.py
from the command line so that you can see error messages.
- When importing the model into Blender, be sure to set Bone Dir to "Blender (best for re-importing)".
- This is critical if you want to be able to use the animation in the game. If you keep the default "Temperance (average)" then the bones will look correct in Blender but will be horribly distorted in the game.
Note: these images are from applying the transformation to the base model, not the animation model, but the effect is the same. It is just easier for me to take a screenshot when doing it this way.
To find the animation, first select it in the Outliner. It belongs to the armature, and is right above Pose and Armature.
- Expand the node tree until you see Animation, Pose and Armature. Select Animation.
-
On the Timeline editor, zoom out until you see the animation (mouse wheel scroll). You may need to disable "Only Keyframes from Selected Channels," which is in the View menu of the Timeline editor.
-
If you set the starting frame to 800 and the ending frame to 813 for this animation (the start and end of the animation, as seen as the diamonds on the timeline), then pressing the play button will cause the animation to loop smoothly.
- Once you are done, export your animation as .glb and overwrite the original. Run kuro_mdl_import_animation.py. It will ignore the model inside your .glb and export only the skeleton and animation data; you do not need to remove the model prior to compile.
python kuro_mdl_import_animation.py
-
Note that Kuro animations use the bind pose as the skeleton, rather than the initial pose of the animation. This is not an issue if you are editing animations extracted from Kuro, but will be an issue if you attempt to import animations from elsewhere (Cold Steel uses the initial pose, for example). See this tutorial on how to change your animation to use the bind pose as skeleton.
-
Note that you may need to update ani script with your new start and stop times. This is beyond the scope of this tutorial; please visit the Trails Research Group for more information.
-
Place your new .mdl file in the correct folder (see the basic tutorial). If everything went well, your animation should play in-game!