Deliverator
Graphical Hackificator
With Nexus Buddy 2 it is now possible to extract animations into Blender for the first time. This tutorial briefly describes the process for getting animations into Blender so that they can be edited before converting them back to the Civ V .gr2 format.
What You Will Need
Nexus Buddy 2
Blender 2.49b or Blender 2.79b
Civ V Blender Scripts
Tutorial One - Extract Animation to Blender
First we'll walk through the simple case when everything works fine.
1. Open you model in Nexus Buddy 2.3.2 or above. This can a unit or a leader or anything else that has separate .gr2 animation files. For example, open u_greek_hoplite.gr2.
2. Press Export Animation to NA2 and select the animation you want to export. For example, u_greek_hoplite_attacka.gr2.
3. All being well a file should be created in the same directory as the animation called u_greek_hoplite_attacka__0.000-1.000.na2.
4. Also export the model to NB2 format by pressing Export to NB2 (There is only one model for a unit so it doesn't matter which of the two buttons you use All Models/Current Model).
5. In Blender first import the NB2 model, for example u_greek_hoplite.nb2.
6. Now import the NA2 model using the script, for example u_greek_hoplite_attacka__0.000-1.000.na2.
7. Now switch to an animation view that has the Timeline window open, and right click the skeleton of the model. You should see all the animation keyframes have been imported and you can play the animation.
8. You are now able to edit the animation before exporting it to FBX for use in the game.
Here's a video that demonstrates step 5 onwards:
Other example showing the victory animation:
Tips
Tip One: Scrambled Skeleton Workaround
When using the Blender 2.49 NB2 import script some skeletons get scrambled due to incorrect bone rotations. The Blender 2.7 NB2 script doesn't have this issue. So the workaround for units that end up with a scrambled skeleton (e.g. Spearman, Landsknecht) is to:
1) Import the .nb2 file into Blender 2.7 using the Import NB2 Addon script.
2) Save the .blend file with Legacy Mesh Format checked.
3) Open the .blend file in Blender 2.49, dismissing the warning message.
4) Resave the .blend file.
5) Now you can import the NA2 animation and everything should work fine.
I've tried and failed to convert the NA2 scripts to Blender 2.7. If you want to attempt to fix my effort my best effort Addon script is here. It imports the animation data successfully but the bone rotations are not correct somehow.
So if you want to work on custom skeletons and animations you'll have to use "Old Faithful" Blender 2.49 (unless someone fixes the code above).
Resources
This classic Tutorial from the Coyote is a good introduction to bespoke animation with Blender; the Nifskope stuff isn't relevant to Civ 5 but much of the rest is:
http://forums.civfanatics.com/downloads.php?do=file&id=10989
Some cool applications of this capability in this thread: Animation Tweaks of Existing CiV Units.
The Parameters
NA2 Start Time/NA2 End Time - This default to the start and end of the GR2 animations but you can specify the time window if you wish.
If NA2 End Time is set to a value greater than the length of the animation then the whole animation will be extracted but nothing more. In code terms if NA2 End Time > Animation Length then NA2 End Time = Animation Length.
FPS: Frames per Second. This controls the frequency with which frames are sampled. The default of 60 might be overkill for some applications, Civ 4 only used 30 FPS. The lower the FPS the small the amount of keyframes and data there will be in the resulting NA2 file for the same timeframe.
Some Technical Background
The animation extract feature in Nexus Buddy uses a function called Sample Bone that is exposed in the Firaxis Granny library. This function does not seem to handle memory well on repeat usage from what I can tell. It seems that after calling this function a certain number of times it will start trying to accessing memory blocks that it is not allowed to. I have handled this by catching the memory access violation and retrying. The program will try a maximum of five times to get an exception free extraction. In almost all cases this solution appears to work.
Anyway that's it for now. I will try and add more on editing animations and re-importing to .gr2 later.
What You Will Need
Nexus Buddy 2
Blender 2.49b or Blender 2.79b
Civ V Blender Scripts
Tutorial One - Extract Animation to Blender
First we'll walk through the simple case when everything works fine.
1. Open you model in Nexus Buddy 2.3.2 or above. This can a unit or a leader or anything else that has separate .gr2 animation files. For example, open u_greek_hoplite.gr2.
2. Press Export Animation to NA2 and select the animation you want to export. For example, u_greek_hoplite_attacka.gr2.
3. All being well a file should be created in the same directory as the animation called u_greek_hoplite_attacka__0.000-1.000.na2.
4. Also export the model to NB2 format by pressing Export to NB2 (There is only one model for a unit so it doesn't matter which of the two buttons you use All Models/Current Model).
5. In Blender first import the NB2 model, for example u_greek_hoplite.nb2.
6. Now import the NA2 model using the script, for example u_greek_hoplite_attacka__0.000-1.000.na2.
7. Now switch to an animation view that has the Timeline window open, and right click the skeleton of the model. You should see all the animation keyframes have been imported and you can play the animation.
8. You are now able to edit the animation before exporting it to FBX for use in the game.
Here's a video that demonstrates step 5 onwards:
Other example showing the victory animation:
Tips
Tip One: Scrambled Skeleton Workaround
When using the Blender 2.49 NB2 import script some skeletons get scrambled due to incorrect bone rotations. The Blender 2.7 NB2 script doesn't have this issue. So the workaround for units that end up with a scrambled skeleton (e.g. Spearman, Landsknecht) is to:
1) Import the .nb2 file into Blender 2.7 using the Import NB2 Addon script.
2) Save the .blend file with Legacy Mesh Format checked.
3) Open the .blend file in Blender 2.49, dismissing the warning message.
4) Resave the .blend file.
5) Now you can import the NA2 animation and everything should work fine.
I've tried and failed to convert the NA2 scripts to Blender 2.7. If you want to attempt to fix my effort my best effort Addon script is here. It imports the animation data successfully but the bone rotations are not correct somehow.
So if you want to work on custom skeletons and animations you'll have to use "Old Faithful" Blender 2.49 (unless someone fixes the code above).
Resources
This classic Tutorial from the Coyote is a good introduction to bespoke animation with Blender; the Nifskope stuff isn't relevant to Civ 5 but much of the rest is:
http://forums.civfanatics.com/downloads.php?do=file&id=10989
Some cool applications of this capability in this thread: Animation Tweaks of Existing CiV Units.
The Parameters
NA2 Start Time/NA2 End Time - This default to the start and end of the GR2 animations but you can specify the time window if you wish.
If NA2 End Time is set to a value greater than the length of the animation then the whole animation will be extracted but nothing more. In code terms if NA2 End Time > Animation Length then NA2 End Time = Animation Length.
FPS: Frames per Second. This controls the frequency with which frames are sampled. The default of 60 might be overkill for some applications, Civ 4 only used 30 FPS. The lower the FPS the small the amount of keyframes and data there will be in the resulting NA2 file for the same timeframe.
Some Technical Background
The animation extract feature in Nexus Buddy uses a function called Sample Bone that is exposed in the Firaxis Granny library. This function does not seem to handle memory well on repeat usage from what I can tell. It seems that after calling this function a certain number of times it will start trying to accessing memory blocks that it is not allowed to. I have handled this by catching the memory access violation and retrying. The program will try a maximum of five times to get an exception free extraction. In almost all cases this solution appears to work.
Anyway that's it for now. I will try and add more on editing animations and re-importing to .gr2 later.
Last edited: