View Full Version : FBX SDK - Get the FbxNode from an ENodeId of a Character


eltero
08 August 2015, 10:55 AM
Is it possible to get the associated `FbxNode` from the enum ENodeId ?
for example if i want to get the FbxNode from the `Character::eLeftHand`

I tried to use `Character::GetCharacterLink(ENodeId, FbxCharacterLink)`
then extracting the FbxNode from `FbxCharacterLink` simply by calling `FbxCharacterLink::mNode`

However this function returns for most ENodeIds False, so no `FbxCharacterLink` is created.

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

when I was scripting inside Motionbuilder using Python and `Pyfbxsdk`, it was very easy, no matter how the skeleton objects are named, I can get the `FBXObject` of it

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

and `BodyNodeObject` is generated with

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

`[I]BodyNodesId` is simply a dictionary

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

Things in FBX SDK aren't as easy as in the Pyfbxsdk that the motionBuilder and Maya use


1