Python in Motionbuilder, bug in the SDK?

So here’s the deal: I have some code that calls FBApplication.LoadAnimationOnCharacter, that works fine. However, if I use QT’s QFileDialog.getOpenFileName before calling the code, I get this error. Note these are the arguments I’m passing in, in order:

<pyfbsdk.FBApplication object at 0x000000003140DF48>
C:/depot/content/WOD/Animation/Male/Common/Action_Loot_Stand_Loop_01.fbx
<pyfbsdk.FBCharacter object at 0x0000000028C856D8>
<pyfbsdk.FBFbxOptions object at 0x000000003140DF98>
<pyfbsdk.FBPlotOptions object at 0x0000000031189048>

Traceback (most recent call last):
  File "C:\depot\games\branches\sandbox\CARBON-ANIMATION-PIPELINE\carbon	ools\pipeline\motionbuilder\uieditor.py", line 95, in _OnClick
    control.carboncallback()
  File "C:\depot\games\branches\sandbox\CARBON-ANIMATION-PIPELINE\carbon	ools\pipeline\motionbuilder\activefile.py", line 67, in LoadCharacterAnimation
    animsaveload.LoadAnimationOnCharacter(character, filename)
  File "C:\depot\games\branches\sandbox\CARBON-ANIMATION-PIPELINE\carbon	ools\pipeline\motionbuilder\animsaveload.py", line 25, in LoadAnimationOnCharacter
    application.LoadAnimationOnCharacter(filename, character, fbxopts, plotopts)
Boost.Python.ArgumentError: Python argument types in
    FBApplication.LoadAnimationOnCharacter(FBApplication, QString, FBCharacter, FBFbxOptions, FBPlotOptions)
did not match C++ signature:
    LoadAnimationOnCharacter(class PYFBSDK::FBApplication_Wrapper {lvalue}, char * __ptr64, class PYFBSDK::FBCharacter_Wrapper {lvalue}, class PYFBSDK::FBFbxOptions_Wrapper {lvalue}, class PYFBSDK::FBPlotOptions_Wrapper {lvalue})

I’ve verified multiple times the types match, and this ONLY happens after I do Qt’s QFileDialog.getOpenFileName. I’ve tried sticking shit into globals, del’ing things after I was done with them, etc., to no avail. Any ideas WTF is going on? This is the first bug I’ve run into anywhere that I have no ideas about and no workarounds for (is there another way to open up a file dialog in MoBu?).

Please help because I’m about to lose it.

Hi Rob! I have worked a bit with PyMobu and I use something like this for opening a file dialog:

from pyfbsdk import *
myFilePopup = FBFilePopup()
myFilePopup.Execute()
myFile = myFilePopup.FullFilename
print myFile

It has always worked fine for me.

Cheers,
Seigi

One theory. The “LoadAnimationOnCharacter” method is expecting a str as the second arg. Though since you used Qt, you’re passing in a QString. Try wrapping you arg in “str()” when passing it to the “LoadAnimationOnCharacter” method.

My best guess…

Hey Seigi, thanks! I looked for a builtin mobu UI class for the file dialog but didn’t see that one, I’m sure that’ll do the trick!

Stev, that’s a good thought. I think I tried using a unicode string but I’ll double check. That’d be quite a sinister problem (but certainly fits the symptoms!).

[QUOTE=Rob Galanakis;11822]

Please help because I’m about to lose it.[/QUOTE]

Welcome to a regular day when working with Motionbuilder :wink:

That was it, stev! Thanks! However I’m going to post yet another bug…

Glad it worked. Get used to losing your mind though…

pyfbsdk is so poorly organized compared to PyMEL’s awesome object model.

I’ve kind of started to write a bunch of core classes imitating commands and functionality of maya.cmds/PyMEL. There’s also PyMobu if everybody wants to contribute to an openSource project (Google Code Archive - Long-term storage for Google Code Project Hosting.).