Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / KTime bug in FBX SDK 2011.2
  RSS 2.0 ATOM  

KTime bug in FBX SDK 2011.2
Rate this thread
 
43667
 
Permlink of this thread  
avatar
  • Total Posts: 38
  • Joined: 05 February 2009 04:40 AM

Greetings,

Please take a look at the following code:

KFCurve* curve = new KFCurve()
curve->KeyModifyBegin()
KTime lTimeW;
lTimeW.SetSecondDouble(0.0)
int index = curve->KeyAdd(lTimeW)

This code used to work fine, but is no longer working after SDK 2011.2 upgrade. It crashes (segmentation fault) in the KeyAdd() function. I traced it in the debugger to the fact that lTimeW variable is not fully initialized. In particular, here is GDB dump:

(gdb) p lTimeW
$1 = {
mTime = 0,
static gsGlobalTimeMode = fbxsdk_2011_2::KTime::eFRAMES30,
static gsGlobalTimeProtocol = fbxsdk_2011_2::KTime::eFRAME,
static gsTimeObject = 0x0
}

Not that gsTimeObject is NULL. If however I initialize an SDK manager before executing the above code (i.e. just add one line [KFbxSdkManager* manager = KFbxSdkManager::Create()] in the beginning, everything works, and gsTimeObject is no longer null in debugger.

This sounds like a bug to me, as nothing seems to suggest that KTime is dependent on SDK manager. Thoughts?



Replies: 0
avatar

Hi Matt,

KFCurve has some globals that are initialized in the KFbxSdkManager. We suppose that in the usual workflow, the first thing done is initializing a KFbxSdkManager.

The static function call, if you don’t want to create a manager, is

KFCurve::AllocateGlobals().

hope this helps,

Viviane, FBX Team



Viviane Rochon
Maya Data Platform
Autodesk

Replies: 1
/img/forum/dark/default_avatar.png

Viviane,

Thanks a lot for your response. It helps, and my code is working again to some degree. However, now I am getting a crash in KFCurve destructor.

Is it also true that if KFbxSdkManager is destroyed, the KFCurve globals are de-allocated?

The sequence of events in my application is like this:

1. Create FCurves and save them
2. Create manager and scene
3. Copy curves into scene
4. Export scene into a file
5. Destroy manager and scene
6. Destroy FCurves

Steps 2-5 could be repeated multiple times. Now after using KFCurve::AllocateGlobals() before the step 1, everything works once, but still crashes on subsequent execution of steps 2-5 and on destroying fcurves.

Does it mean I have to always have one manager instantiated so that I can user the FCurves?

Thanks again,

—Matt

Author: quarterdome

Replied: 27 May 2010 08:30 AM  
avatar

Oh yes, KFCurve::FreeGlobals() is called when the last KFbxSdkManager is destroyed.

If you create the manager before anything else, and destroy it at the end of your program, do you encounter other issues?

Viviane



Viviane Rochon
Maya Data Platform
Autodesk

Replies: 1
/img/forum/dark/default_avatar.png

Thanks Viviane. I got this to work.

Author: quarterdome

Replied: 28 May 2010 09:33 AM