def AdjustmentBlendObject(obj): take = FBSystem().CurrentTake if take.GetLayerCount() > 1: poseLayerFCurves = GetObjectFCurvesForLayer(obj, take.GetLayerCount() - 1) baseLayerFCurves = GetObjectFCurvesForLayer(obj, 0) for i in range(len(poseLayerFCurves)): poseFCurve = poseLayerFCurves[i] keys = poseFCurve.Keys if len(keys) > 1: keyPairsList = GetKeyPairsFromFCurve(keys) for keyPair in keyPairsList: startTime = keyPair[0] stopTime = keyPair[1] startValue = keyPair[2] stopValue = keyPair[3] spanValues = EvaluateFCurveForKeyPairTimespan( baseLayerFCurves[i], startTime, stopTime) percentageValues, totalBaseLayerChange = GetPercentageOfChangeValues( spanValues) totalPoseLayerChange = abs(stopValue - startValue) previousValue = startValue for value in percentageValues: valueDelta = (totalPoseLayerChange / 100.0) * value[1] if stopValue > startValue: currentValue = previousValue + valueDelta else: currentValue = previousValue - valueDelta poseLayerFCurves[i].KeyAdd(value[0], currentValue) previousValue = currentValue
def AdjustmentBlendCharacter(character = None): if not character: character = FBApplication().CurrentCharacter if character: take = FBSystem().CurrentTake if take.GetLayerCount() > 1: characterObjs = GetCharacterEffectorsAndExtensions(character) for obj in characterObjs: if obj: AdjustmentBlendObject(obj) else: FBMessageBox("Error...", "No additive layer found. Adjustment blending affects interpolation between keys on the the top most additive layer.", "OK") else: FBMessageBox("Error...", "No additive layer found. Adjustment blending affects interpolation between keys on the top most additive layer.", "OK")
def GetLayers(): take = FBSystem().CurrentTake return [take.GetLayer(i) for i in range(take.GetLayerCount())]