Following is a sample Python code that shows how to create a character marker set and access the created object:
pCharDst.CreateCharacterMarkerSet(False) # Get pointer to the newly created marker set (force get, as it is not active) lMarkerSet = pCharDst.GetCharacterMarkerSet(True)
Following is a sample Python code that shows how to do marker assignment:
The following example shows how to store and retrieve the marker assignment. This is also a good starting point for auto assignment script or mirroring script.
def CharacterMapping(pSave, pFile = None, pCharacter = FBApplication().CurrentCharacter): if pCharacter == None: return if pFile == None: pFile = "@%s_Mapping.txt" % pCharacter.Name lMarkerSet = pCharacter.GetCharacterMarkerSet(True) lConfigFile = FBConfigFile(pFile) if pSave: if lMarkerSet: lConfigFile.ClearFile() for lProp in lMarkerSet.PropertyList: if lProp.Name.endswith('.Markers'): lConstraintType = lMarkerSet.PropertyList.Find(lProp.Name.replace('.Markers', '.Constraint')) if lConstraintType != None: lConfigFile.Set(lProp.Name, "Type", "%d" % lConstraintType.Data) else: continue for lSrcId in range(lProp.GetSrcCount()): lConfigFile.Set(lProp.Name, "Marker%d" % lSrcId, lProp.GetSrc(lSrcId).LongName) else: if lMarkerSet: lMarkerSet.FBDelete() pCharacter.CreateCharacterMarkerSet(True) lMarkerSet = pCharacter.GetCharacterMarkerSet(True) FBBeginChangeAllModels() for lProp in lMarkerSet.PropertyList: if lProp.Name.endswith('.Markers'): lMarkerList = [] lMarkerIndex = 0 while True: lMarkerName = lConfigFile.Get(lProp.Name, "Marker%d" % lMarkerIndex) if lMarkerName: lMarkerIndex += 1 lMarkerModel = FBFindModelByLabelName(lMarkerName) if lMarkerModel: lMarkerList.append(lMarkerModel) else: break lProp.BeginChange() lProp.DisconnectAllSrc() for lMarker in lMarkerList: lProp.ConnectSrc(lMarker) #ConnectSrcIfMissing(lProp,lMarker) lProp.EndChange() lConstraintType = lMarkerSet.PropertyList.Find(lProp.Name.replace('.Markers', '.Constraint')) if lConstraintType != None: lType = lConfigFile.Get(lProp.Name, "Type") if lType: lConstraintType.Data = int(lType) FBEndChangeAllModels() def LoadMapping(pFile = None, pCharacter = FBApplication().CurrentCharacter): CharacterMapping(False,pFile,pCharacter) def SaveMapping(pFile = None, pCharacter = FBApplication().CurrentCharacter): CharacterMapping(True,pFile,pCharacter)
Refer to the example in <yourinstallationfolder>\bin\config\Scripts\Samples\Character\CharacterMarkerSetFromActor.py. This script automatically creates a character based on the actor structure, creates a character marker set, and copies the assignment. It shows how a pipeline works starting from a marker set, building character, and using custom assignment logic to output a solved skeleton.