MoBu – How to set Character Solver via Python


I’m having trouble setting the solver type in Motionbuilder 2014 via Python. There don’t seem to be any examples of how to do this in the documentation though I was able to figure part of the problem.

By default, MoBU 2014 sets a character to use the HIK 2014 solver. I can confirm this using below commands:

myCharacter =FBApplication().CurrentCharacter
print( myCharacter.GetExternalSolver().Name )

>>HIK 2014 Solver

I was also able to print out the 3 solver types like this:

print( FBCharacterSolver.GetRegisteredSolverNames () )

>>> [‘HIK 2013 Solver’, ‘HIK 2014 Solver’, ‘MB Character Solver’]

My problem is how to set my current characters solver to ‘MB Character Solver’. I was able to find the SetExternalSolver method but unsure what to do with it. What would be the correct syntax to do this:

myCharacter.SetExternalSolver( ‘MB Character Solver’ )

Much Thanks!

It’s index based.

myCharacter.SetExternalSolverWithIndex(2)  # MB Character Solver

You could make a function that would take a string like this:

def SetExternalSolverWithString(character, name):
    solvers = pyfbsdk.FBCharacterSolver.GetRegisteredSolverNames()
        index = solvers.index(name)
    except ValueError:
        raise ValueError("Solver name %s not valid.  Valid names are: %s" % (name, solvers))

Ahh, thanks. Totally worked. I may have been thrown off because I expected the solver name to change in the left hand part of the Navigator under the character name. I see that it did update in the drop down under the Character Settings tab.