from pyfbsdk import *
def ListObjectProperties(o):
print "ObjectName: " + o.Name
for each in o.PropertyList:
print each.Name + " "
def ChangeRigidBody (obj, propertyName, newValue):
for i in range (obj.GetSrcCount()):
o = obj.GetSrc(i)
if isinstance(o, FBPhysicalProperties):
p = o.PropertyList.Find(propertyName)
if p:
p.Data = newValue
def SetRigidBodyState():
lModelList = FBModelList()
FBGetSelectedModels( lModelList )
if len( lModelList ) == 0:
FBMessageBox( "Message", "Nothing selected", "OK", None, None )
else:
for each in lModelList:
ChangeRigidBody ( each, "Bounce", 0.1 )
ChangeRigidBody ( each, "Density", 0.5 )
lMessage = "Models modified:"
lMessage += ''.join( map( lambda pModel: "\n" + pModel.Name, lModelList ))
FBMessageBox( "Message", lMessage, "OK", None, None )
SetRigidBodyState()