3
$\begingroup$

I want to export a model as DirectX .x format and retain the armature and animations. It's partially/sometimes working but not consistently. I have the checkboxes in the exporter checked to export animations, export separate AnimationSets, export unused animations, and the "export selected objects only" unchecked. My animations are separate Actions within Blender under dope sheets.

My model has 2 animations. Sometimes the exported file has 2 AnimationSets (which are what the animations are called in the .x format) and sometimes 3. One of them always has only 1 Animation sub-section that contains {Armature} (the name I gave to the blender object containing the armature and mesh). The others are the animations I want to export and contain Animation sections for each bone (sometimes there is only one of these AnimationSets.)

I think this has something to do with the following screenshot of the outliner:

outliner

There is an Animation on the main section of the object and another on the mesh. These get out of sync, and I'm not even sure the correct way of setting one or the other or what each of them are. I also notice that changing one of them sometimes doesn't change what animation is played in Blender. What are each of these supposed to represent and how do you set each of them? If I knew what they were I could probably figure out how to consistently export all animations.

In the screenshot, Sphere is the mesh and Armature is the mesh parented to the bones (sorry for poor naming, right now I'm just trying to get it to work.)

I'm using Blender 2.77a.

$\endgroup$
0
$\begingroup$

Blender records animation data into an action. Each object can have one active action which receives the keyframes when you use insert keyframe for a property or group of properties like LocRotScale when inserting keyframes in the 3DView.

When the dopesheet is in the Action Editor mode, the active action is visible and this action name is the first item visible under Animation in the outliner. You can change the active action and create more actions here.

While only one action can be active, which is the one being edited, we can create multiple actions for each object and use the NLA Editor to merge them into a larger animation. The tracks and actions added to the NLA Editor are then listed below the active action in the outliner. The combination of actions in the NLA is what you see in the 3D viewport. Note that actions can be muted in the NLA as well as individual channels in the dopesheet and graph editor, also the active action may not exist in the NLA but will be added to the animation in the viewport.

show outliner, action editor and nla links

It's isn't too hard to get mixed up when using the NLA. Let's say you create an action that contains animation from frame 1 to 20. When you place the action in the NLA you can re-position it so that it plays from 50 to 70. If you then re-select the action so it is the active action again, as the active action it will play back from frames 1 to 20 and will not play from frame 50 as set in the NLA. This would be the cause of the out of sync animation while exporting. To fix this, select your mesh and remove the active action from the action editor.

With just a quick look at the export_x script, it changes the frame and exports the location/rotation as read from each object at that frame, this should match what you see in the 3D viewport when playing the animation.

I would expect the best results will be achieved if you remove the active action and only use NLA when exporting.

$\endgroup$
  • $\begingroup$ Thanks for the detailed explanation. That answers a lot of questions. One thing I'm still not clear on is why I have two different Animations in my screenshot (outlined in red.) Perhaps the top one is the only one I need as it seems to be the only one that does anything for me... maybe you can animate the mesh apart from bones and that's what the second one is. After playing around a bit, I found I can clear the second one and just use the first one. I also cloned the .x exporter with a few changes which works better for me, so I'm good. Thanks! $\endgroup$ – goobliata May 22 '16 at 3:41
  • $\begingroup$ One action is on your armature and one is on the mesh, meaning they both have keyframes. The mesh has nla tracks which means you put a mesh action into the nla. You can find what is keyframed in the action editor. $\endgroup$ – sambler May 22 '16 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.