   [DX9] about ID3DXAnimationController / ID3DXAnimationSet
  Hi guys! For my project I`m using the D3DX APIs to load .x files for mesh and animations. As requested by the animator, we are separating the mesh and animation data such that animation sets can be reused for different meshes that have the same skeleton structure. But it seems the resources on this topic are very rare. I tried to use ID3DXAnimationController::GetAnimationSetID3DXAnimationController::RegisterAnimationSetbut according the error message I can't add new animation sets.Some other options are to use RegisterAnimationOuput. but again, I can't find any example on how to use this API.Another solution I　can think of is to cheat on D3DXAnimationController by replacing the skeleton matrices that are originally bound to the animation controller by the mesh that wants to reuse the animation. call AdvanceTime, then restore the matrices. But this method sounds to gimmicky and is prone to bugs in the long run.What do you think?   
  Did you check the controller for max animationsets? You may have to clone it and increase the available number before you add new ones.;  The X file is a hierarchical scene graph. This is how *most* of them work. They have two types of nodes: frames (transformation matrix) and meshcontainers (geometry). After that usually a list of animation sets is found. Each animation set is a list of frames to be animated and animation keys with keyframe data and time values.You overload the Microsoft provided allocation hierarchy and tell it how to load/allocate Frame nodes and Geometry nodes. Then you call D3DXLoadMeshHierarchyFromX() and the framework calls back to your overloaded frame/geometry allocator methods when it hits one of these node types while parsing the X file.That same function also takes a reference to a D3DXANIMATIONCONTROLLER, which will get automatically filled in with the animation sets and keyframe data.You might need to physically open your X files and visually verify that *EVERY* frame name referenced in *ALL* animation sets exist under the hierarchical scene graph part of the file, otherwise the DX9 animation framework usually barfs in strange ways.Once D3DXLoadMeshHierarchyFromX() completes without errors, if the animation controller is valid you can do things like AdvanceTime() on the controller. Here are some things to try for "doing it yourself" so you can share animation sets:1. Pass a null animation controller to D3DXLoadMeshHierarchyFromX(), to prevent the framework from going down the "skinned" mesh path.2. Call D3DXCreateAnimationController() to make your own empty controller.3. Call D3DXFrameRegisterNamedMatrices() with the pointer to the frame root of the scene hierarchy you previously loaded from step #1 and the empty animation controller. This should add all the frames from your HSG to the animation controller.4. Call D3DXCreateKeyframedAnimationSet() to build an empty animation set for one of your animation sets in your X file. Provide the name of the animation set here, for example "Idle" or "Attack".5. Read in all the Scale,Rotate,Translate keyframe data under each "Animation" block for this animation set from your X file into user-allocated arrays (time, value pairs organized by frameName being animated).6. Call RegisterAnimationSRTKeys() on the empty animation set and provide references to all your user-allocated S,R,T data, along with the name of the frame to be animated.7. Now register the created animation set to the animation controller by calling RegisterAnimationSet() on animation controller object with new KeyframedAnimationSet object as input.8. Now I *think* the final trick is to indicate where you want the animation mixer to place it's output: For each matrix you registered above, maybe call AnimationController::RegisterAnimationOutput() and provide the name of each of your frames to be animated as well as the address of it's transformation matrix in the hierarchical scene graph? But maybe this was already done by step #3?Well, I'm not really sure about "rolling" your own animation mixer using the D3DX api because I never tried it, but this stuff is my best guess here, maybe its better than nothing.