Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#Actualbelfegor

Posted 04 July 2013 - 01:32 PM

If you can get it the easy way with MeshView, you (might) need to use: ID3DXAnimationController::CloneAnimationController then RegisterAnimationSet then D3DXSaveHierarchyToFile.

I done it once this way but deleted the project long time ago since i don't use dx animation system anymore, so i will guess few steps here:

Load meshes with animations.

Clone and create new animation controller :

DWORD numAllAnimations = 0;
for i = numMeshes
    numAllAnimatios += mesh[i]->getAnimController()->GetNumAnimationSets();
 
// animCtrl is animation controller from first mesh, it doesn't matter much i just need starting point
LPD3DXANIMATIONCONTROLLER newController;
animCtrl->CloneAnimationController(
        animCtrl->GetMaxNumAnimationOutputs(),
        numAllAnimations,
        animCtrl->GetMaxNumTracks(),
        animCtrl->GetMaxNumEvents(), &newController);

Register each of their animation sets to new controller:

for i = numMeshes
    for j = mesh[i].numAnimationSet
        LPD3DXANIMATIONSET set;
        mesh[i]->getAnimController()->GetAnimationSet(j, &set);
        newController->RegisterAnimationSet(set);

then save your hierarchy to file:

D3DXSaveMeshHierarchyToFile("character_with_all_animations.x", D3DXF_FILEFORMAT_TEXT, &rootFrame, newController, 0);

That should be it.

 

Note that you should check all functions for failure!

 

EDIT:

You might want to skip registering first mesh animation sets as it is probably already included into new animation controller since we cloned it from.


#4belfegor

Posted 04 July 2013 - 01:25 PM

If you can get it the easy way with MeshView, you (might) need to use: ID3DXAnimationController::CloneAnimationController then RegisterAnimationSet then D3DXSaveHierarchyToFile.

I done it once this way but deleted the project long time ago since i don't use dx animation system anymore, so i will guess few steps here:

Load meshes with animations.

Clone and create new animation controller :

DWORD numAllAnimations = 0;
for i = numMeshes
    numAllAnimatios += mesh[i]->getAnimController()->GetNumAnimationSets();
 
// animCtrl is animation controller from first mesh, it doesn't matter much i just need starting point
LPD3DXANIMATIONCONTROLLER newController;
animCtrl->CloneAnimationController(
        animCtrl->GetMaxNumAnimationOutputs(),
        numAllAnimations,
        animCtrl->GetMaxNumTracks(),
        animCtrl->GetMaxNumEvents(), &newController);

Register each of their animation sets to new controller:

for i = numMeshes
    for j = mesh[i].numAnimationSet
        LPD3DXANIMATIONSET set;
        mesh[i]->getAnimController()->GetAnimationSet(j, &set);
        newController->RegisterAnimationSet(set);

then save your hierarchy to file:

D3DXSaveMeshHierarchyToFile("character_with_all_animations.x", D3DXF_FILEFORMAT_TEXT, &rootFrame, newController, 0);

That should be it.

 

Note that you should check all functions for failure!


#3belfegor

Posted 04 July 2013 - 01:23 PM

If you can get it the easy way with MeshView, you (might) need to use: ID3DXAnimationController::CloneAnimationController then RegisterAnimationSet then D3DXSaveHierarchyToFile.

I done it once this way but deleted the project long time ago since i don't use dx animation system anymore, so i will guess few steps here:

Load meshes with animations.

Clone and create new animation controller :

DWORD numAllAnimations = 0;
for i = numMeshes
    numAllAnimatios += mesh[i]->getAnimController()->GetNumAnimationSets();
 
// animCtrl is animation controller from first mesh, it doesn't matter much i just need starting point
LPD3DXANIMATIONCONTROLLER newController;
animCtrl->CloneAnimationController(
        animCtrl->GetMaxNumAnimationOutputs(),
        numAllAnimations,
        animCtrl->GetMaxNumTracks(),
        animCtrl->GetMaxNumEvents(), &newController);

Register each of their animation sets to new controller:

for i = numMeshes
    for j = mesh[i].numAnimationSet
        LPD3DXANIMATIONSET set;
        mesh[i]->getAnimController()->GetAnimationSet(j, &set);
        newController->RegisterAnimationSet(set);

then save your hierarchy to file:

D3DXSaveMeshHierarchyToFile("character_with_all_animations.x", D3DXF_FILEFORMAT_TEXT, &rootFrame, newController, 0);

That should be it.


#2belfegor

Posted 04 July 2013 - 01:23 PM

If you can get it the easy way with MeshView, you (might) need to use: ID3DXAnimationController::CloneAnimationController then RegisterAnimationSet then D3DXSaveHierarchyToFile.

I done it once this way but deleted the project long time ago since i don't use dx animation system anymore, so i will guess few steps here:

Load meshes with animation.

Clone and create new animation controller :

DWORD numAllAnimations = 0;
for i = numMeshes
    numAllAnimatios += mesh[i]->getAnimController()->GetNumAnimationSets();
 
// animCtrl is animation controller from first mesh, it doesn't matter much i just need starting point
LPD3DXANIMATIONCONTROLLER newController;
animCtrl->CloneAnimationController(
        animCtrl->GetMaxNumAnimationOutputs(),
        numAllAnimations,
        animCtrl->GetMaxNumTracks(),
        animCtrl->GetMaxNumEvents(), &newController);

Register each of their animation sets to new controller:

for i = numMeshes
    for j = mesh[i].numAnimationSet
        LPD3DXANIMATIONSET set;
        mesh[i]->getAnimController()->GetAnimationSet(j, &set);
        newController->RegisterAnimationSet(set);

then save your hierarchy to file:

D3DXSaveMeshHierarchyToFile("character_with_all_animations.x", D3DXF_FILEFORMAT_TEXT, &rootFrame, newController, 0);

That should be it.


#1belfegor

Posted 04 July 2013 - 01:21 PM

If you can get it the easy way with MeshView, you (might) need to use: ID3DXAnimationController::CloneAnimationController then RegisterAnimationSet then D3DXSaveHierarchyToFile.

I done it once this way but deleted the project long time ago since i don't use dx animation system anymore, so i will guess few steps here:

Load meshes with animation.

Clone and create new animation controller :

DWORD numAllAnimations = 0;
for i = numMeshes
    numAllAnimatios += mesh[i]->getAnimController()->GetNumAnimationSets();
 
// animCtrl is animation controller from first mesh, it doesn't matter much i just need starting point
LPD3DXANIMATIONCONTROLLER newController;
animCtrl->CloneAnimationController(
        animCtrl->GetMaxNumAnimationOutputs(),
        numAllAnimations,
        animCtrl->GetMaxNumTracks(),
        animCtrl->GetMaxNumEvents(), &newController);

 

Register each of their animation sets to new controller:

for i = numMeshes
    for j = mesh[i].numAnimationSet
        LPD3DXANIMATIONSET set;
        newController->GetAnimationSet(j, &set);
        newController->RegisterAnimationSet(set);

 

then save your hierarchy to file:

D3DXSaveMeshHierarchyToFile("character_with_all_animations.x", D3DXF_FILEFORMAT_TEXT, &rootFrame, newController, 0);

 

That should be it.


PARTNERS