Getting my hands dirty with Motionbuilder and its python at the moment, but having some difficulties and hopefully some of you know the answer to my question :).
What I want to do is to retrieve the texture thats a assigned to a certain model with python.
And since i’m still kinda new to python and stuck in a maya-python mode I’m having troubles adapting to Motionbuilder-python.
It’s kind of a pain since I am not aware of any direct way to retrieve a texture name from a model, but you can trace the connections to find “FBVideoClip” nodes (which are the actual texture files, not the FBTexture node).
from pyfbsdk import *
# Select some models
lModelList = FBModelList()
FBGetSelectedModels(lModelList)
for lModel in lModelList:
lTextures = []
# First find FBTexture nodes connected to the model
for i in range(lModel.GetSrcCount()):
lConnection = lModel.GetSrc(i)
if lConnection.ClassName() == 'FBTexture':
lTextures.append( lConnection )
for t in lTextures:
# Now find FBVideoClip nodes connected to each texture
for j in range(t.GetSrcCount()):
lConnection = t.GetSrc(j)
if lConnection.ClassName() == 'FBVideoClip':
# Do something with the Filename
print lConnection.Filename