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® MotionBuilder® / Open Reality / MB ORSDK Samples - filterresample
  RSS 2.0 ATOM  

MB ORSDK Samples - filterresample
Rate this thread
 
25436
 
Permlink of this thread  
avatar
  • Matte
  • Posted: 11 April 2009 04:46 PM
  • Total Posts: 23
  • Joined: 22 January 2008 02:13 PM

Hey all,

I just took a look at writing some of my own filters for motionbuilder(2009 64-bit in this case). So i compiled one of the sampels that comes with the application, filterresample in this case. Just thought it might be good example to start from.

However after compile when i actually try to run the filter in motionbuilder on some curves it hangs everytime. Very odd, since this is actually an example which comes with motionbuilder.

After some poking around and testing with the code i have figured out that it seems to hang because a temporary variable (lCurve in this case) is being deallocated at the end of the filter run. Nothing strange about that really, the proper approach is to deallocate it since its being dynamiclly allocated earlier in the function. And it seem to only be used as a local temp fcurve. However, if i remove the deallocation line for this local var, the filter works!? I have tried a couple of things to try and deallocate the var in other ways but it always end up with the filter not working and motionbuilder hanging, even though to me the lCurve var only seems to be used for local calculations, and doesnt really replace the inputcurve in any way at the end of the run.

Am i missing something? Is the tempcurve actually replacing the inputcurve in some way that iam missing? It sure behaves like it does. However i cant find any clear code that seems to indicate that it does, thats why i find this a little bit weird.  I could of course ignore this problem, since the filter actaully works, but not deallocated dynamiclly allocated variables is bad, and it will eventually blow up in your face, so i dont want to start writing filters which are a ticking timebomb.

/Matte



Replies: 0
avatar
  • Neill3d
  • Posted: 16 April 2009 03:17 AM

Hi,

you have memory leak, may be somewhere in your code memory heap breaks, that’s why dealocating is not working.



Replies: 0
avatar
  • Matte
  • Posted: 18 April 2009 06:35 AM

Sure, it could be a memory leak, but you seem to be missing the point. This code is part of the SDK examples which are shipped with motionbuilder. I have not done any change to it at all (except after i already noticed that it does not work). And by default if i just open the solution -> compile it -> load the dll in motionbuilder -> run it -> instant crash. One would expect that the code coming directly from the developer at least work, buggy maybe, but at least work, and not completely shut motionbuilder down on execution.

So, that is why i posted this thread, cause i wanted to hear if anyone else is having the same problems? To try and figure out if this is a design problem right from the start made by Autodesk. Since the examples that ships with motionbuilder is suppose to be guidelines to create your own stuff for whatever class you are interested in. When one of the examples does not work, it kinda screws the entire idea up.

/Matte



Replies: 0
avatar
  • Neill3d
  • Posted: 19 April 2009 03:44 AM

Yes, you right. I have compiled the plugin and plugin execution is returning with the error.
I can give you advice to avoid using FCurve, just allocate own storage arrays (for example using FBArrayTepmplate). Better example of filter design is the filter_template. I have used it for develope my filter plugin.



Replies: 0
avatar
  • Matte
  • Posted: 19 April 2009 01:43 PM

Haha, yeah, I tested using the FBArrayTemplate instead to store the tempvalues, worked like a charm. Thanks for the suggestion. Shame on Autodesk though for not having a example that actually works, kinda bad in my book. Especially when its suppose to be an sdk educational example.

/Matte



Replies: 0
avatar

Hi Matte,

Can you tell me what you set up and did in your scene to not have the sample work?

I agree, this shouldn’t happen, so ify you can provide me the above I can get a bug logged then hopefully fixed soon,

Thanks,

Kristine



KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn

Replies: 0
avatar
  • Matte
  • Posted: 02 May 2009 02:19 PM

Sure;

If i remember correct it was just a simple test scene, imported from maya. 3 or 4 joints with some geometry skinned to it. All joints had some random rotation animation which was created in maya. Baked/plotted data with one key every frame on the channels.

I compiled the plugin, using vs2008, as described previously in this thread. Compile went fine. Started motionbuilder, the plugin loads fine, filter list shows the orsdk example filter. Selected one of the joints, made a keyframe span selection on a channel. Activate the filter. If i remember correct “previewing” the curve change worked fine, so you can see the change in fcurve editor. However when you press accept motionbuilder makes a fatal directly and dies. Thats pretty much it.

/Matte



Replies: 0
avatar

Hi Matte,

Thanks for the details, I was able to reproduce it with a simple cube and some keyframes on it...I will get that logged as a bug and we can get it fixed, sorry you wasted any time on it on working of crashing sample…

Kristine



KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn

Replies: 0
avatar

This is definitely not the problem but just to note for others Visual Studio 2008 is not a supported compiler for MotionBuiler 2009 (Visual Studio 2005 is), sorry I had to say it.

~Kristine



KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn

Replies: 0
avatar

This sample has been fixed in MotionBuilder 2010, it no longer crashes and works correctly.

Regards,

Kristine



KRISTINE MIDDLEMISS | SENIOR DEVELOPER CONSULTANT
AUTODESK DEVELOPER NETWORK Media & Entertainment
http://www.autodesk.com/joinadn

Replies: 0