Tasks/EnableGameModeOnSelectedCharacters_Z.py
12 lBonesName = (
'LeftForeArm' ,
'RightForeArm' ,
'LeftLeg' ,
'RightLeg' )
15 lAffectedCharacterList = []
19 gScene = gSystem.Scene
22 def SetGameModeOnSelectedCharacters(pCharacter, pState = True):
24 print 'Setting game mode for character \'%s\'' % pCharacter.Name
31 for lBoneName
in lBonesName:
33 if lBone: lBones.append( lBone )
36 if len( lBonesName ) == len( lBones ):
40 lBone.PropertyList.Find(
'RotationActive' ).Data = pState
41 lBone.PropertyList.Find(
'RotationMinX' ).Data = pState
42 lBone.PropertyList.Find(
'RotationMinY' ).Data = pState
43 lBone.PropertyList.Find(
'RotationMaxX' ).Data = pState
44 lBone.PropertyList.Find(
'RotationMaxY' ).Data = pState
47 lAffectedCharacterList.append( lCharacter.Name )
52 FBMessageBox (
'Warning' ,
'Unable to set game mode for character \'%s\'' % lCharacter.Name,
"Ok" )
55 for lCharacter
in gScene.Characters:
58 if lCharacter.Selected:
59 SetGameModeOnSelectedCharacters(lCharacter)
63 if len( lAffectedCharacterList ) == 0:
65 if FBMessageBox (
'Information' ,
'Could not set Game Mode. No character is selected. \n Do you want to enable Game Mode on the current Character?' ,
'Yes' ,
'No' )==1:
66 SetGameModeOnSelectedCharacters(
FBApplication ().CurrentCharacter)
68 FBMessageBox (
'Information' ,
'Could not set game mode. No character were selected.' ,
'Ok' )
72 FBMessageBox (
'Information' ,
'Set game mode for characters :%s' % lAffectedCharacterList,
'Ok' )