[Guide] Restoring Animations

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Sie_Sayoka
Posts: 3
Joined: Wed, 18. Feb 26, 21:53
x4

[Guide] Restoring Animations

Post by Sie_Sayoka »

This guide will cover restoring animations from a vanilla ship. Because the Egosoft Tools strips all of the animation information from a model it will export with a blank .ani file. If you would like to add or change an animation for a ship this process must be done to restore the animations. This guide may also be useful for animating for beginners. I also recommend looking at the blender examples from the bonus downloads.

Required Tools:
  • 1. Reference Files & Workspace
    We'll start with the assumption that the ship is properly converted. Open two instances of blender, one for the modded ship and another for the vanilla ship. In this example I'll be working on a Nodan (ship_gen_s_fighter_01) and the front landing gears animation. The vanilla instance should have functional animations that we can use as a reference. Unfortunately we will have to do additional work with naming and categorizing as these don't get imported correctly.

    Image

    Create a horizontal split of your workspace by right clicking on the edge of the viewport window. Then switch to the Nonlinear Animation (NLA) editor. Hiding objects will also hide the animation.
  • 2. Keyframes, Tracks, & Strips

    Image

    Select all the relevant objects for the animation of your modded ship and press the I key on frame 0 with the cursor over the viewport. This will create keyframes and populate the animation list. You'll see that it also created tracks, which are the grey bars on the left. Don't click on the push down button yet.

    Image

    Before we go any further we need to find those names mentioned earlier. Open up the corresponding .anixml file of the ship. There's a bunch of numbers and other junk in it but we are most interested in the animation subnames. Let's take a look at one of them.

    Code: Select all

    landinggears_inactive
    The first word is the track name and the second word is the action name.

    Image

    Set the rest of your keyframes by checking both the blender reference and the anixml file for values and frames. Then click the push down button. Rename the tracks (grey boxes) to the appropriate animation subname. In this case it's landinggears. The strip may need to be divided depending on the animation. In this case it needs to be divided into 4 parts. You can divide a strip by selecting the strip, moving to a frame, and pressing the Y key. These also need to be renamed.

    If you've messed up by putting a keyframe on the wrong frame or put in an incorrect value you can select the strip, go to the timeline editor or dopesheet editor to remove the keyframes or change the values in the tool sidebar.

    Image

    If you are working with multiple objects that have parents you can drag and shift+drop an object onto another for it to become a child, much like how the game uses parent/child parts.

    Image

    Be aware that some values may be inverted between the vanilla and modded ship. Ensure that it visually looks correct before setting down a keyframe.
  • 3. Finishing Up

    Image

    Once you're happy with how your keyframes look it's time to change the animation interpolation. This isn't a necessary step but it may make the animation look better. You can also check what the reference blender ship is doing. First set the top window to the Graph Editor. Then select a strip and press the Tab Key. This will show your keyframes and the interpolation between them. If the graph is too zoomed in your can press the Home Key when your cursor is over the graph window. Usually you will want to set interpolation to linear as I believe most animations in the game use this. Bezier interpolation will have two lines sticking out. Change the interpolation for each animation and keyframe.

    Image

    Set the output animation to 30 FPS in the sidebar.

    Image

    Check the animation tag for the part in the Egosoft Tools. This is required to export animation data.

    Image

    After this the ship can be exported. The new .xml file should have the animations you put in under the corresponding parts. Check to ensure that all the names and frames are correct. It's not strictly necessary to add these to the final .xml file... probably.

    Add the newly generated .ani file and check to see if everything works as it should.
Image

Congratulations!
User avatar
ChemODun
Posts: 598
Joined: Mon, 12. Feb 07, 21:58
x4

Re: [Guide] Restoring Animations

Post by ChemODun »

Excellent guide!
Multiply entropy by absolute zero

Freedom in space

Return to “X4: Foundations - Scripts and Modding”