FBX SDK - 从字符

时间:2015-08-16 16:25:43

标签: python c++ autodesk fbx motionbuilder

是否可以从枚举ENodeId中获取关联的FbxNode? 例如,如果我想从Character::eLeftHand

获取FbxNode

我尝试使用Character::GetCharacterLink(ENodeId, FbxCharacterLink) 然后只需调用FbxCharacterLink

即可从FbxCharacterLink::mNode中提取FbxNode

但是,此函数会返回大多数ENodeIds False,因此不会创建FbxCharacterLink

character = myScene.GetCharacter(0)
lefthand = character.eLeftHand
lefthand_node = FbxCharacterLink()
character.GetCharacterLink(lefthand, lefthand_node) # False
lefthand_node = lefthand_node.mNode

当我使用Python和Pyfbxsdk在Motionbuilder中编写脚本时,它非常简单,无论骨架对象如何命名,我都可以获得它的FBXObject

m = character.GetModel(self.BodyNodeObject[o])
使用

生成

BodyNodeObject

def BodyNodes(self):
    for i in dir(FBBodyNodeId):
        if i[0] == 'k':
            try:
                self.BodyNodeObject[BodyNodesId[i]] = getattr(FBBodyNodeId, i)
            except:
                pass

BodyNodesId只是一本字典

BodyNodesId = OrderedDict({
        'kFBChestNodeId':'Spine1',
        'kFBHeadNodeId':'Head',
        'kFBHipsNodeId':'Hips',
        'kFBLeftAnkleNodeId':'LeftFoot',
        'kFBLeftCollarNodeId':'LeftShoulder',
        'kFBLeftElbowNodeId':'LeftForeArm',
        ...
})

0 个答案:

没有答案