Using Your Currently Selected Character To Generate A List Of All FK And IK Models With MotionBuilder Python

Here is a quick post that will help use your currently selected character to generate lists of all FK and IK models. When ever possible I like to use these funcitons as opposed to generating the list by hand and storing that as a variable.

I can’t remember where I stumbled upon this method, but I am happy to have it!

##Get A List Of FK
def GetFK():
    fkList = []
    for id in fb.FBBodyNodeId.values.itervalues():
        if id == fb.FBBodyNodeId.kFBReferenceNodeId:
            continue
        model = fb.FBApplication().CurrentCharacter.GetCtrlRigModel(id)
        if model:
            fkList.append(model)
    return fkList
    
##Get A List Of IK Effectors
def GetIK():
    ikList = []
    for id in fb.FBEffectorId.values.itervalues():
        model = fb.FBApplication().CurrentCharacter.GetEffectorModel(id)
        if model:
            ikList.append(model)
    return ikList

As always, I hope this helps.

2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *