views:

27

answers:

0

I have a mesh file that contains the skinned mesh that I want, and then a bunch of separate animation files that contain various AnimationSets. I'd like to have my program dynamically build the list of AnimationSets available to a mesh at run-time. I know I can combine these into one mesh file using MView, but that isn't practical for what I'm planning.

I thought this would be pretty simple since ID3DXAnimationController.RegisterAnimationSet seems like it exists to do exactly this and the MView mesh viewer program can do this. But when I call RegisterAnimationSet using an animation from a different file, it fails with an unhelpful Invalid Call return value.

Both the skinned mesh and the animation were exported from the same 3DS file, so I'm pretty certain that they are compatible.

Here's my code:

var
  anim : ID3DXAnimationSet;
  am : IDxAnimMesh;
begin  
  fAnim := ResMgr.AnimFetch('man01.x');
  am := ResMgr.AnimFetch('a_rigtest.x');
  DXCheck(am.Controller.GetAnimationSet(0,anim));
  DXCheck(fAnim.Controller.RegisterAnimationSet(anim));
end;

The file "man01.x" contains a default animation. And "a_rigtest.x" contains an animation exported from a different portion of the timeline fromt the same 3DS file. So it seems like they should be compatible. MView combines them with no trouble.

Am I doing something wrong? Does anyone know how this is supposed to work? Or better yet, does anyone know where I could find the source code to MView?

Any help would be appreciated.