from pyfbsdk import FBVector3d, FBModel, FBModelCube, FBModelList, FBGetSelectedModels, FBMessageBox
def CreateModel(pName, pPos):
lModel = FBModelCube(pName)
lModel.Scaling = FBVector3d(20, 20, 20)
lModel.Translation = pPos
lModel.Show = True;
lModel.Visible = True
return lModel
lModel1 = CreateModel("Cube 1", FBVector3d(-80, 10, 0))
lModel2 = CreateModel("Cube 2", FBVector3d(0, 10, 0))
lModel3 = CreateModel("Cube 3", FBVector3d(80, 10, 0))
lModel3.Parent = lModel2;
lModel2.Selected = True
lModel3.Selected = True
lModel1.Selected = True
def DisplaySelectList(pModelList, pMsg):
if len( lModelList ) == 0:
FBMessageBox( "Message", pMsg + "Nothing selected", "OK", None, None )
else:
lMessage = pMsg + "%d selected models:" % len( lModelList )
lMessage += ''.join( map( lambda pModel: "\n " + pModel.Name, lModelList ))
FBMessageBox( "Message", lMessage, "OK", None, None )
del( lMessage )
lModelList = FBModelList()
FBGetSelectedModels( lModelList)
DisplaySelectList(lModelList, "Get list of selected models in scene graph order.\n" )
lModelList.Clear()
FBGetSelectedModels( lModelList, lModel2, True )
DisplaySelectList(lModelList, "Get list of selected models under lModel2 in scene graph order.\n")
lModelList.Clear()
FBGetSelectedModels( lModelList, None, True, True )
DisplaySelectList(lModelList, "Get list of selected models in select order.\n")
lModelList.Clear()
del( lModelList, lModel1, lModel2, lModel3 )
del( FBVector3d, FBModel, FBModelCube, FBModelList, FBGetSelectedModels, FBMessageBox )