Advertisement

3DSMAX plug-in development

Started by April 17, 2001 03:33 AM
2 comments, last by SomeCodeGuy 23 years, 9 months ago
Hi there, This is a message for those who has previous experience writing file-export plug-ins for 3DSMAX. I''m having a hard time extracting an animation out of a MAX scene. Say I have a sphere that''s animated, say it travels from left to right in 100 frames. What I''ve tried to do is simply ask the MAX system to give me the location of the vertices in every frame. I know this sounds pretty dumb, but I''m having trouble to even get this to work. The objects I export don''t move!!! Here''s my code to get the time information:

Interface *gi;
Interval aniRange = gi->GetAnimRange();
tpf = GetTicksPerFrame();
startTime = aniRange.Start();
endTime = aniRange.End();
 
Then I for loop through endTime to startTime, and I do the following:

Object *obj = node->EvalWorldState(doItTime).obj;
// and later on, I do
tri = (TriObject *)obj->ConvertToType(doItTime, triObjectClassID);
 
so now I have the TriObject (the mesh) at the specified time... but this isn''t working. The above code should look familiar to anyone who''s done this before.

- code
No, it''s not you that''s dumb. It''s the max SDK. That way wouldn''t work.

If what you require is simple animation data (ie. translation, rotating and scaling ), you can get the TM controller and use GetValue to get the keys.

ie node->GetTMController()->GetPositionController();

Use the keys + node TM to calculate the vertices at the specificed time.

However, you shouldn''t store the whole mesh at every animation interval if it is just simple animation. Use the animation keys to manipulate the TM.

If you want to get vertex animation ( ie. MasterPointController ), then you are out of luck. If you figured that out, I like to know too!
Advertisement
Void,

Unfortunately, the goal of my project is not some simple animation (rotate, translate), but something much more complicated.

It''s usually an animation of an object that starts out as a sphere, then it''s deformed with all kinds of crazy modifiers, and my job is try to reproduce that sequence of animation. Now, like I said before, the dumb-guy''s way of solving this problem is simply extract the geometry at every frame.

Is this vertex animation you speak of??

How would you approach this problem??

Thanks.

- code
quote:
Original post by SomeCodeGuy
Is this vertex animation you speak of??

How would you approach this problem??




Yup. Morphing is vertex animation.

I gave up. AFAIK, max seems to take the base mesh and use a MasterPointController to get the final vertices. Given the poorly written SDK help and I''m no max user, I can''t figure how to get it.

At first I thought it has something to do with max interval caching, but that doesn''t seem to work too. The EvalWorldState is probably buggy wrt time, but no one seems to care now that max4 is out.

If you do find out, please let me know!

Note: If you try to extract the mesh from EvalWorldState with time != 0 like that, notice it gives inconsistent results when u modify the vertices position directly?

I''m using max 3.1 BTW.

This topic is closed to new replies.

Advertisement