Sign in to follow this  
VanillaSnake21

Check if X file has animation

Recommended Posts

stanlo    212
If you mean by looking at the file, all you need to do is open it in a text editor (assuming it's saved as text as opposed to binary), and look for an AnimationSet block. If it has one of these (and associated animation frames), then it's animated.

Share this post


Link to post
Share on other sites
VanillaSnake21    175
Quote:
Original post by stanlo
If you mean by looking at the file, all you need to do is open it in a text editor (assuming it's saved as text as opposed to binary), and look for an AnimationSet block. If it has one of these (and associated animation frames), then it's animated.


I meant checking from within the app, I want to use different rendering method for the mesh that has no animation, I <s>could</s> use the same method but it would be doing useless work of traversing trees and stuff even if the mesh is not animated. So basically you said that I will need to look for an AnimationBlock, that might actually help me since I think I could searh an X file for stuff from within the code. Thanks :)

Share this post


Link to post
Share on other sites
dpadam450    2357
Since a .x file is text, it's rather simple to edit. When you export from maya, you already know your answer to animated or not. So put a flag at the beginning of the .x file that lets you know.

Share this post


Link to post
Share on other sites
stanlo    212
How are you loading in the mesh into your app? If you're just using LoadMeshFromX, you won't get any animation anyway.

Share this post


Link to post
Share on other sites
VanillaSnake21    175
Quote:
Original post by dpadam450
Since a .x file is text, it's rather simple to edit. When you export from maya, you already know your answer to animated or not. So put a flag at the beginning of the .x file that lets you know.


You mean a flag for myself or a flag that I can check using functions in the code? And besides I don't think its a convinient method of edidting evry output file, I was thinking of maybe exporting in mayas native .mb format , importing into MilkShape3D or something and then exporting as X, but MilkShape doesn't seem to except .mb as a format, or output .X, I might have to use fxb. Or maybe there are other ways? Thanks.

Share this post


Link to post
Share on other sites
VanillaSnake21    175
Quote:
Original post by stanlo
How are you loading in the mesh into your app? If you're just using LoadMeshFromX, you won't get any animation anyway.


Currntly I have two methods inside my Mesh class, one is LoadFromFile() and other is LoadAnimated(), LoadFromFile() uses LoadMeshFromX() to load a static mesh, while LoadAnimated() uses D3DXLoadMeshHierarchy() to load an animated mesh. What I want to do is combine both methods into a single LoadFromFile() meshod, and then check if the mesh has animation or not to decide which code to use for rendering. So basically Im trying to use D3DXLoadMeshHierarchy() and then find out what type (anim/no anim) it is. The strange part is that I thouht that a non animated mesh would not have any frames at all, but I found that all my meshes have frames even if thyre not animated.

Share this post


Link to post
Share on other sites
stanlo    212
You should be able to use the load hierarchy function for everything. In the case that no animation exists, your animation controller should just have no sets or something.

Share this post


Link to post
Share on other sites
VanillaSnake21    175
Quote:
Original post by stanlo
You should be able to use the load hierarchy function for everything. In the case that no animation exists, your animation controller should just have no sets or something.


I don't think you read my previous posts since I clearly said that I'm using D3DXLoadMeshHierarchy() for all my loads, and loads are not what Im concerned with, and also I said that whichever file I have whether with animation or no animation I still have animation sets and frames, which leads me to believe that my exporter is misfunctioning.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this