Sign in to follow this  

.X exporter & 3ds Max 8 Sdk : GetQuickSampledKeys() is buggy ?

Recommended Posts

Hello, I got the sources of the .X exporter Kwxport for 3ds Max 8 ( ), and as it's exporting all sampled frames for animation, I wanted to modify it so it'd export only the Key Frames. To do so, I thought I'd use the function GetQuickSampledKeys() from the 3ds Max 8 SDK. Unfortunately, it seems it's quite buggy : the keys seems to be all wrong. Code : if (Igc->IsAnimated(IGAME_POS)) { IGameKeyTab Keys; if (Igc->GetQuickSampledKeys(Keys, IGAME_POS)) { int NbKey = Keys.Count(); for (i = 0; i < NbKey; ++i) { IGameKey &Key = Keys[i]; int Time = Key.t; Point3 p = Key.sampleKey.pval; [ ... write P in file ... ] } } } Key.sampleKey.pval then contains crazy values.. Doing the same thing with IGAME_SCALE gives the same values than with IGAME_POS, but stocked in Key.sampleKey.sval.s instead of Key.sampleKey.pval . Key.t is consistent & valid. Calling Igc->GetQuickSampledKeys(Keys, IGAME_ROT) doesn't work any better, and even create a bug later in the exporter (coz of some buffer overrun ?). I'm using latest version of 3DXI, found here : . I wonder if it's related to the controller type being Biped instead of linear or something more simple... Anyone already tried to use this function ?

Share this post

Link to post
Share on other sites
I'm pretty disillusioned with IGame. It was billed as the future of data export, but it's never been particularly robust. I would suggest going to the underlying Max node and extracting the animation using the regular Max SDK.

Share this post

Link to post
Share on other sites
Hello hplus0603,

thanks for ur answer! ;)

Yesterday, I tried this :

int Id = node->GetNodeID();
Interface *ip = GetCOREInterface();
INode *iNode = ip->GetINodeByHandle(Id);
Control *c = iNode->GetTMController()->GetPositionController();
if (c)
int Keyable = c->IsKeyable();
int NbKey = ikeys->GetNumKeys();

for (i = 0; i < NbKey; ++i)
ITCBPoint3Key Key;

ikeys->GetKey(i, &Key);

int Time = Key.time;
Point3 p = Key.val;
// write P & Time to file...

I'm getting the correct number of keys (same than with IGame), but IsKeyable() returns false, and it seems I'm only getting the ITCBKey filled (with values a bit contradictory with SDK doc :-S ), while ITCBPoint3Key::val is untouched... Only 7 floats are modified, and only ITCBKey has this size.

I guess the mesh I want to convert use a kind of keys that is not easily possible to fetch as Scale/Rot/Pos, or there are some bugs in the Sdk.

Strangely, Panda exporter seems to manage not too bad to export only Keyframes, but it clearly misses some of them : the legs of my biped don't have any animation..! :-S

I also tried to figure out the KeyFrames by analyzing the sampled P/S/Rot, but due to imprecisions, it makes the animation jerk as soon as I remove a bit too much frames.

If I'm using the .ASE exporter, it seems the key frames are well exported in P/S/Rot form, but the format seems a bit different from .X so I guess I'll have to figure out how the re-create the animation if I go with the .ASE file... :-S

Share this post

Link to post
Share on other sites
I found an explanation in the Max SDK that it's not possible to interpolate the Keys in World Space (like it's done in the DirectX 8 examples, and probably in DX9 Sdk as well), coz Max interpolates them in Local Space.

I guess that's why when Panda exports only KeyFrames, the result is weird with the different DirectX Viewers...

Thus, if I want to interpolate only the KeyFrames, I'd need to change many things (both exporter & renderer work with World Space), so I give up for now, and I'll use the full sampled frames...

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