Samples/Character/SaveLoadCharacterMarkerSetMapping.py
14 def CharacterMapping(pSave, pFile = None, pCharacter = FBApplication().CurrentCharacter):
15 if pCharacter ==
None:
19 pFile =
"@%s_Mapping.txt" % pCharacter.Name
21 lMarkerSet = pCharacter.GetCharacterMarkerSet(
True)
26 lConfigFile.ClearFile()
27 for lProp
in lMarkerSet.PropertyList:
28 if lProp.Name.endswith(
'.Markers'):
30 lConstraintType = lMarkerSet.PropertyList.Find(lProp.Name.replace(
'.Markers',
'.Constraint'))
31 if lConstraintType !=
None:
32 lConfigFile.Set(lProp.Name,
"Type",
"%d" % lConstraintType.Data)
36 for lSrcId
in range(lProp.GetSrcCount()):
37 lConfigFile.Set(lProp.Name,
"Marker%d" % lSrcId, lProp.GetSrc(lSrcId).LongName)
42 pCharacter.CreateCharacterMarkerSet(
True)
43 lMarkerSet = pCharacter.GetCharacterMarkerSet(
True)
47 for lProp
in lMarkerSet.PropertyList:
48 if lProp.Name.endswith(
'.Markers'):
52 lMarkerName = lConfigFile.Get(lProp.Name,
"Marker%d" % lMarkerIndex)
57 lMarkerList.append(lMarkerModel)
62 lProp.DisconnectAllSrc()
64 for lMarker
in lMarkerList:
65 lProp.ConnectSrc(lMarker)
69 lConstraintType = lMarkerSet.PropertyList.Find(lProp.Name.replace(
'.Markers',
'.Constraint'))
70 if lConstraintType !=
None:
71 lType = lConfigFile.Get(lProp.Name,
"Type")
73 lConstraintType.Data = int(lType)
77 def LoadMapping(pFile = None, pCharacter = FBApplication().CurrentCharacter):
78 CharacterMapping(
False,pFile,pCharacter)
80 def SaveMapping(pFile = None, pCharacter = FBApplication().CurrentCharacter):
81 CharacterMapping(
True,pFile,pCharacter)