MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FBFindModelsOfType seems not work?

3 REPLIES 3
Reply
Message 1 of 4
aurora.lu
311 Views, 3 Replies

FBFindModelsOfType seems not work?

I tired to use FBFindModelsOfType to look for all cameras in the scene.
But it is not defined in pyfbsdk.
How to use it properly?

Here is my sample code.


from pyfbsdk import *

lCamlist = FBComponentList()

#FBFindModelsOfType (tuple pList, int pTypeInfo, FBModel pParent=None)

FBFindModelsOfType (lCamlist, 1, None)# actually I don't know the Type Info of the camera.


Right now I use FBSelectObjectsByNames to accessing cameras.
3 REPLIES 3
Message 2 of 4
Jacques.LIAO
in reply to: aurora.lu

Which version of MoBu?
Jacques LIAO
Freelancer / Consultant programmer for MotionBuilder and Virtual production
Message 3 of 4
omnized
in reply to: aurora.lu

I can't seem to get FBFindModelsOfType to work either 😕

Alternative ways...
# example 1
sceneCams = []
for lComp in FBSystem().Scene.Components:
if lComp.ClassName() == 'FBCamera':
sceneCams.append(lComp)


# example 2 
lCamList = FBSystem().Scene.Cameras


# example 3 
lCam = FBCamera('myCam')
if lCam.Is(FBCamera_TypeInfo()) == True:
print "This is the '%s' ClassName" % lCam.ClassName()
Message 4 of 4
awforsythe
in reply to: aurora.lu

FBFindModelsOfType isn't exposed to Python:

import pyfbsdk
print 'FBFindModelsOfType' in dir(pyfbsdk) # Prints False


The way to deal with all the cameras in the scene is, as suggested above:

for camera in FBSystem().Scene.Cameras:
# Do stuff
print camera.LongName


FYI, FBCamera.SystemCamera will be True for the default system cameras (Producer Perspective, Top, Side, etc.) and False for all others, allowing you to differentiate them easily.

Also, though it doesn't help you here, you can get a class's TypeInfo like so:

FBCamera_TypeInfo()


(This is the Python equivalent of FBCamera::TypeInfo in the C++ API.)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report