Exporting Character Animations from Blender

From the Oblivion ConstructionSet Wiki
Revision as of 19:08, 17 January 2008 by imported>Qazaaq (there you go, with internal links, external links, see also and correctly categorized, but not without mistakes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This tutorial will explain how to get a character animation from Blender to a format compatible with Oblivion. It will not explain how to make an animation in Blender and the tutorial will assume you've got a Blender file with a character animation already. There are various animation tutorials available around the web, there's even this Wiki tutorial that explains some basics.

Requirements

  • NifSkope
  • NifTools Blender scripts version 1.5.7. This is the highest version that's compatible with the program NifBlend that we're going to use. For these scripts to work you need Blender 2.43, install instructions for Blender, the correct version of Python and the Nif scripts take a look at Installing Blender.

NifBlend

As mentioned above we're going to use NifBlend which is a program that will extract a .kf file from a .nif file that Blender can export. Download NifBlend and extract the contents of the archive. NifBlend is a command-line program, but we will make a shortcut to do the most common operation.

Inside the folder you extracted NifBlend you have to create a shortcut to the program, right click NifBlend.exe and choose create shortcut. Now right click the shortcut and choose properties. In the window that comes up we will edit the target field, it's the text field at the top. At the end add x -pr 90, if you've extract the archive to C:\NifBlend it will look like this:

C:\NifBlend\NifBlend.exe x -pr 90

If the target path is between double quotes it could looks like this:

"C:\NifBlend v0.4\NifBlend.exe" x -pr 90

The x flag will tell NifBlend to extract the animation and the -pr 90 flag will tell NifBlend to set the priority of all bones to 90. This means that all animations on the bones will overwrite all stock animations. Setting bone priorities is beyond the scope of the tutorial, but this setting will guarantee that the default idle animations will not override the custom animation.

If you're also injecting animations with NifBlend you'll have a skeleton.nif file in the NifBlend directory. When extracting NifBlend will also extract a .kf file from skeleton.nif. You can deleted it after export or make a new folder and copy NifBlend.exe and the extract shortcut to that folder.

Converting the NIF file

Now we've got NifBlend ready we can export the animation. Open the Blender file with the animation and export the .nif file. Note: You have to configure the export script to export Nif version 20.0.0.4, the NifTools tutorial] will explain how to do that. Once exported move the .nif file to the NifBlend directory and run the shortcut we just created. This will create a .kf file with the same name as the .nif file you exported.

Fixing the KF file

After export the .kf is not ready to be used yet, most of the time there are two simple values that have to be changed.


The first one is the start text key that tells the animation when to start. Text keys are fields with instruction for the animation at specific times. Starting and ending are both example of these instructions. After extracting with the NifBlend a text key with the right time is already in the .kf file, but it's not named; the value is empty.

Open the .kf file in NifSkope and expand the NiControllerSequence block. Find the block called NiTextKeyExtraData and select it (most of the time it's at the bottom). If the Block Details Window is not already open press F3 to open it (or open it with the View menu). With the NiTextKeyExtraData block selected you'll see an array called Text Keys in the Block Details window that you can expand. Do that and expand both text keys you find inside. The result should look similar to this.


File:Nifblendtutorial textkey.png


Notice that on the selected line there's no value, while in the Text Key underneath the value end is there. Double click underneath 0.0000 on the select line and type start.

The second value that most likely needs to be changed is the name of the NiControllerSequence block. After extracting it will be named exactly like the .nif file. If you're replacing an existing animation it should be named exactly like it is in the existing animation. If you're making a Special Idle animation, one that can be played on any NPC at any time. Then it should be named SpecialIdle_AnimationName.

To rename the NiControllerSequence block, which is the first, you can double click on the name in the Block List. In the block list NiControllerSequence is in the name column and the name of the specific block is in the Value column.

You can also change it in the Block Details window by selecting the NiControllerSequence in the Block List window and double clicking the value of the Name string in the Block Details window (inside the red box in the image).


File:Nifblendtutorial controllersequence.png


Save the .kf file and enjoy your Oblivion-ready animation!

See Also