Jump to content
  • Advertisement
Sign in to follow this  
Sc0rp

D3DXLoadMeshHierarchyFromX fails if 2 animated meshes are loaded

This topic is 4054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I can successfully load 1 or multiple meshes with 1 or more frame levels. I can also load a single animated mesh and it plays just fine. But when I had a second mesh to that file, D3DXLoadMeshHierarchyFromX returns D3DERR_INVALIDCALL. While debugging I found out that it loads 2 frames and 2 meshes but then loads a third frame after wich comes the error. I can't debug after that since it's assembly code. But i found out that it tries to call the destructors of my ID3DXAllocateHierarchy (wich fails due to the invalid frame allocation). Does anybody knows why it can load a single animated mesh perfectly but not 2? Thank you in advance ;)

Share this post


Link to post
Share on other sites
Advertisement
Hi Sc0rp,

I'm not sure what exactly do u mean by a single animation mesh. But I have tried personally adding several "Animation Sets" to the file, and it works just fine. Adding and removing that is. But the Animation file had one mesh but several animations.

Hope thats helps.

Share this post


Link to post
Share on other sites
Thanks for replying ramy.

What I mean is that I can have a box, let's say rotating. And that's ok. But if I simply add another mesh to the scene (another box for instance) and export it all to the same .X file D3DXLoadMeshHierarchyFromX fails.

Maybe it's a problem of the .X format. Maybe it can only have 1 mesh animated per file. But since I can't find documentation on that I'm guessing the problem is mine.

Share this post


Link to post
Share on other sites
Quote:
Original post by Sc0rp
I can successfully load 1 or multiple meshes with 1 or more frame levels. I can also load a single animated mesh and it plays just fine. But when I had a second mesh to that file, D3DXLoadMeshHierarchyFromX returns D3DERR_INVALIDCALL.


Link with the debug D3DX and then look in the debug output stream for the cause of the failure.

Share this post


Link to post
Share on other sites
Thanks legalize.

Here's the error:

"Assertion failure! (h:\gfx_sdk_dgt_sdk\windows\directx\dxg\active\d3dx9\anim\loadxh.cpp 1392): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices
D3DX: ID3DXAnimationController::RegisterAnimationOutput: Number of matrices registered is equal to the max number set at creation time."

Any idea?

Share this post


Link to post
Share on other sites
Quote:
Original post by Sc0rp
Here's the error:

"Assertion failure! (h:\gfx_sdk_dgt_sdk\windows\directx\dxg\active\d3dx9\anim\loadxh.cpp 1392): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices
D3DX: ID3DXAnimationController::RegisterAnimationOutput: Number of matrices registered is equal to the max number set at creation time."

Any idea?


When you create an animation controller, you tell it how many outputs it will have. You can't register more outputs than that; it uses a fixed-size array and doesn't dynamically increase it.

When you create the controller, use a bigger number for the requested number of animation outputs.

Share this post


Link to post
Share on other sites
Quote:
Original post by legalize
Quote:
Original post by Sc0rp
Here's the error:

"Assertion failure! (h:\gfx_sdk_dgt_sdk\windows\directx\dxg\active\d3dx9\anim\loadxh.cpp 1392): D3DXFrameNumNamedMatrices(pframeRoot) == plc->cNamedMatrices
D3DX: ID3DXAnimationController::RegisterAnimationOutput: Number of matrices registered is equal to the max number set at creation time."

Any idea?


When you create an animation controller, you tell it how many outputs it will have. You can't register more outputs than that; it uses a fixed-size array and doesn't dynamically increase it.

When you create the controller, use a bigger number for the requested number of animation outputs.


I did. I already set it to high numbers and still the same. I only have 1 animation and 2 meshes. The animation controller is created like this:

D3DXCreateAnimationController(10, 10, 10, 10, &AnimController);

I'm not getting even near that limit.

Do I have to make my own instance of the ID3DXAnimationController as I did to the ID3DXAllocateHierarchy? If it is working with 1 mesh I guess not.

Share this post


Link to post
Share on other sites
Hi Scorp,

I've been having the same issue very spuratically in the last few weeks. About 10% of the time, one particular mesh (an animated windmill) has this issue. Only recently have I realized that the same assert was coming out. None of my other skinned meshes are exhibiting this problem, but then again this is the first static/skinned mesh I've used.

Once the assert kicks off, then the animation of my model becomes very choppy as though a lot of the keys are missing. If I cause a device lost event by moving my game to another monitor, then the problem usually disappears.

Also, I'm using D3DXLoadMeshHierarchy to load my skinned mesh in a template, then the instance clones the template's animation controller using CloneAnimationController. It look like this:

const i32 cloneAnimationControllerStatus = animationControllerPtr->CloneAnimationController(
animationControllerPtr->GetMaxNumAnimationOutputs(),
animationControllerPtr->GetMaxNumAnimationSets(),
animationControllerPtr->GetMaxNumTracks(),
animationControllerPtr->GetMaxNumEvents(),
&m_animationControllerPtr);
if (cloneAnimationControllerStatus != 0)
{
throw Exception("Could not clone animation controller: " + toString(cloneAnimationControllerStatus));
}

I'm laying more traps for this bug. I'm not sure if the clone or the load call is issuing the assert. If I catch the root problem, then I'll post what I did to fix this problem for myself.

Share this post


Link to post
Share on other sites
Sorry about the false alarm. The model issueing the assert wasn't the windmill. It was another newer model whose export to .x was dubious at best.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!