Re-Targeting Animotive FBX (Maya)
Retargeting to Control Rig Script
Throughout this document we will show you one method of retargeting an Animotive FBX to any control rig.
We will leave code blocks for you to copy and paste from.
Keep in mind that these examples are only a guide, please change it to match your naming conventions and also, stick with the structure that is explained throughout the document.
Import your Animotive FBX
Import the Animotive FBX with a namespace, e.g. Animotive_LWBoy_Take.
Code: Parent Constraint to FK Controls
def animotive_FBX_Retargeter_FK(): animotiveData = ["*:Root_M", "*:Spine1_M", "*:Chest_M", "*:Neck_M", "*:Head_M", "*:Scapula_R", "*:Shoulder_R", "*:Elbow_R", "*:Wrist_R", "*:ThumbFinger1_R", "*:ThumbFinger2_R", "*:ThumbFinger3_R", "*:IndexFinger1_R", "*:IndexFinger2_R", "*:IndexFinger3_R", "*:MiddleFinger1_R", "*:MiddleFinger2_R", "*:MiddleFinger3_R", "*:RingFinger1_R", "*:RingFinger2_R", "*:RingFinger3_R", "*:Scapula_L", "*:Shoulder_L", "*:Elbow_L", "*:Wrist_L", "*:ThumbFinger1_L", "*:ThumbFinger2_L", "*:ThumbFinger3_L", "*:IndexFinger1_L", "*:IndexFinger2_L", "*:IndexFinger3_L", "*:MiddleFinger1_L", "*:MiddleFinger2_L", "*:MiddleFinger3_L", "*:RingFinger1_L", "*:RingFinger2_L", "*:RingFinger3_L", "*:Ankle_L", "*:Knee_L", "*:Ankle_R", "*:Knee_R", "*:Hip_L", "*:Hip_R"] FKControls = ["Root_Control", "FK_Spine_Control", "FK_Chest_Control", "FK_Neck_Control", "FK_Head_Control", "FK_Scapula_R_Control", "FK_Shoulder_R_Control", "FK-Elbow_R_Control", "FK_Wrist_R_Control", "FK_ThumbFinger1_R_Control", "FK_ThumbFinger2_R_Control", "FK_ThumbFinger3_R_Control", "FK_IndexFinger1_R_Control", "FK_IndexFinger2_R_Control", "FK_IndexFinger3_R_Control", "FK_MiddleFinger1_R_Control", "FK_MiddleFinger2_R_Control", "FK_MiddleFinger3_R_Control", "FK_RingFinger1_R_Control", "FK_RingFinger2_R_Control", "FK_RingFinger3_R_Control", "FK_Scapula_L_Control", "FK_Shoulder_L_Control", "FK_Elbow_L_Control", "FK_Wrist_L_Control", "FK_ThumbFinger1_L_Control", "FK_ThumbFinger2_L_Control", "FK_ThumbFinger3_L_Control", "FK_IndexFinger1_L_Control", "FK_IndexFinger2_L_Control", "FK_IndexFinger3_L_Control", "FK_MiddleFinger1_L_Control", "FK_MiddleFinger2_L_Control", "FK_MiddleFinger3_L_Control", "FK_RingFinger1_L_Control", "FK_RingFinger2_L_Control", "FK_RingFinger3_L_Control", "FK_Ankle_L_Control", "FK_Knee_L_Control", "FK_Ankle_R_Control", "FK_Knee_R_Control", "FK_Hip_L_Control", "FK_Hip_R_Control"] # This setAttr is for your IKFK Switches, if you have IK Controls on by default this remember to change the integer at the end so that the FK controls will be turned on # cmds.setAttr ("IKFKSwitch_L_Leg.attributename", 0) cmds.setAttr ("IKFKSwitch_R_Leg.attributename", 0) # the integer should change based on your attribute cmds.parentConstraint (animotiveData [0], FKControls [0], mo = True) cmds.parentConstraint (animotiveData [1], FKControls [1], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [2], FKControls [2], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [3], FKControls [3], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [4], FKControls [4], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [5], FKControls [5], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [6], FKControls [6], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [7], FKControls [7], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [8], FKControls [8], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [9], FKControls [9], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [10], FKControls [10], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [11], FKControls [11], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [12], FKControls [12], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [13], FKControls [13], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [14], FKControls [14], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [15], FKControls [15], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [16], FKControls [16], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [17], FKControls [17], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [18], FKControls [18], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [19], FKControls [19], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [20], FKControls [20], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [21], FKControls [21], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [22], FKControls [22], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [23], FKControls [23], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [24], FKControls [24], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [25], FKControls [25], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [26], FKControls [26], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [27], FKControls [27], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [28], FKControls [28], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [29], FKControls [29], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [30], FKControls [30], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [31], FKControls [31], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [32], FKControls [32], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [33], FKControls [33], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [34], FKControls [34], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [35], FKControls [35], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [36], FKControls [36], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [37], FKControls [37], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [38], FKControls [38], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [39], FKControls [39], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [40], FKControls [40], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [41], FKControls [41], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [42], FKControls [42], mo = True, st = ['x','y','z']) animotive_FBX_Retargeter_FK() |
How to use - Parent Constraint Animotive FBX to FK Control Rig
You need to contain this part of the script in a definition - Just copy the code and change it as you see fit
Let's create two lists inside this definition;
‘animotiveData’ - Stores all of the Animotive FBX group node names (Source)
‘FKControls’ - Stores all of the control names you want to parent constraint to (Target)
For the items we add to ‘animotiveData’ you need to add an asterisk and colon
animotiveData = ["*:Root_M"] # Example line only |
This helps maya find these names easier because they have a unique namespace that we made when we imported the character
Make sure the source and target lists are in the same order
For items we add to ‘FKControls’, you do not need to add asterisk and colon
FKControls = ["Root_Control"] # Example line only |
Let's create our parent constraints;
The order you should write it should look like this;
cmds.parentConstraint (animotiveData [0], FKControls [0], mo = True) cmds.parentConstraint (animotiveData [1], FKControls [1], mo = True, st = ['x','y','z']) |
This line of code selects both lists, their index in that list, and parent constraints the two lists indexes together - This is why the items in both lists have to be in the same order
In the code above, the first line does not have ‘st = ['x','y','z']’ - This is because you should always put the root group node/ joint/ control first
The root needs translation AND rotation - Therefore, you do not write ‘st = ['x','y','z']’ into controls that need to translate
st stands for ‘Skip Translation’
Other controls that need translation and rotation; Cog/ IK controls
Every other FK control will need rotation only, so that is why all of the other lines have ‘st = ['x','y','z']’
Keep in mind that in scripting, the first item is always 0
We need to keep the original position of the animotive data and the control rig, so we use ‘mo = True’ to toggle this option on
mo stands for ‘Maintain Offset’
Code: Baking to the FK Controls
def baketoFKControlRig(): FKControlBake = ["Root_Control", "FK_Spine_Control", "FK_Chest_Control", "FK_Neck_Control", "FK_Head_Control", "FK_Scapula_R_Control", "FK_Shoulder_R_Control", "FK-Elbow_R_Control", "FK_Wrist_R_Control", "FK_ThumbFinger1_R_Control", "FK_ThumbFinger2_R_Control", "FK_ThumbFinger3_R_Control", "FK_IndexFinger1_R_Control", "FK_IndexFinger2_R_Control", "FK_IndexFinger3_R_Control", "FK_MiddleFinger1_R_Control", "FK_MiddleFinger2_R_Control", "FK_MiddleFinger3_R_Control", "FK_RingFinger1_R_Control", "FK_RingFinger2_R_Control", "FK_RingFinger3_R_Control", "FK_Scapula_L_Control", "FK_Shoulder_L_Control", "FK_Elbow_L_Control", "FK_Wrist_L_Control", "FK_ThumbFinger1_L_Control", "FK_ThumbFinger2_L_Control", "FK_ThumbFinger3_L_Control", "FK_IndexFinger1_L_Control", "FK_IndexFinger2_L_Control", "FK_IndexFinger3_L_Control", "FK_MiddleFinger1_L_Control", "FK_MiddleFinger2_L_Control", "FK_MiddleFinger3_L_Control", "FK_RingFinger1_L_Control", "FK_RingFinger2_L_Control", "FK_RingFinger3_L_Control", "FK_Ankle_L_Control", "FK_Knee_L_Control", "FK_Ankle_R_Control", "FK_Knee_R_Control", "FK_Hip_L_Control", "FK_Hip_R_Control"] clipduration = cmds.keyframe('*:*YourRootNodeHere', q = True) cmds.playbackOptions(edit = True, animationStartTime = 0) cmds.playbackOptions(edit = True, animationEndTime = clipduration[-1]) minTIME = cmds.playbackOptions(edit = True, minTime = 0) maxTIME = cmds.playbackOptions(edit = True, maxTime = clipduration[-1]) cmds.bakeResults(FKControlBake, t=(minTIME,maxTIME), simulation = True) |
How to use - Baking to the FK Controls Script
Create another definition to contain all of the code that is related to it
Copy and paste the control list from the Parent Constraint Script into the bake script definition
We want to select all of the controls and bake the constrained movement onto them
Change ‘FKControls’ to whatever naming convention fits your needs
Next we will set up the code that affects the playback speed and updates the time slider based on your Animotive FBX animation
In ‘clipduration’ - You need to add the root group node of the Animotive FBX, this will define the end keyframes
Next we set the animation start and end times
The edit flag is needed to let maya know that we want to alter the time slider - We need this flag for all 4 playback options
Next we set the time of the animation;
Set ‘minTIME’ to 0
Set ‘maxTIME’ to ‘clipduration- The [-1] is the end key of the Animotive FBX
Next, we will set our bake simulation options with a line of code
‘cmds.bakeResults()’ is the command for baking animation
The ‘t’ flag means time, we add our ‘minTIME’ and ‘maxTIME’ to define the time of the animation
‘simulation = True’ - Toggles simulation on
Retarget back onto your Character FBX
Tip: Good practice when working with animation layers is to merge everything onto the base animation layer when you are finished, and then retarget this back onto the Character FBX.
The Character FBX is the same Geometry, joints and textures you imported into Animotive.
For example, the parent constraint script should be;
List 1; Add your control names
Copy and paste ‘FKControls’
Rename ‘FKControls’ to something suitable
Delete the Animotive FBX front the maya scene because you do not need this anymore
Import your character that you imported into Animotive, this should have the same hierarchy
Give the character FBX import a namespace; You could rename the old one, select all items relating to the character FBX and add the contents to the namespace
List 2; Copy and paste ‘animotiveData’ and indexes because these should be the same as the joint names
Rename ‘animotiveData’ to something suitable
You will now need to change the order of the parent constraint command
Previously, it was animotiveData → FKControls
Now it should be; FKControls → Character FBX
For the bake part of the script, the items you need to add to the list are the character FBX joint names
Copy and paste your renamed ‘animotiveData’
Rename ‘FBXBake’
Change ‘clipduration’ string to the root control name
Code: Parent Constraint Controls to Character FBX
def FK_Controls_to_CharacterFBX_Retargeter(): bakedFKControls = ["Root_Control", "FK_Spine_Control", "FK_Chest_Control", "FK_Neck_Control", "FK_Head_Control", "FK_Scapula_R_Control", "FK_Shoulder_R_Control", "FK-Elbow_R_Control", "FK_Wrist_R_Control", "FK_ThumbFinger1_R_Control", "FK_ThumbFinger2_R_Control", "FK_ThumbFinger3_R_Control", "FK_IndexFinger1_R_Control", "FK_IndexFinger2_R_Control", "FK_IndexFinger3_R_Control", "FK_MiddleFinger1_R_Control", "FK_MiddleFinger2_R_Control", "FK_MiddleFinger3_R_Control", "FK_RingFinger1_R_Control", "FK_RingFinger2_R_Control", "FK_RingFinger3_R_Control", "FK_Scapula_L_Control", "FK_Shoulder_L_Control", "FK_Elbow_L_Control", "FK_Wrist_L_Control", "FK_ThumbFinger1_L_Control", "FK_ThumbFinger2_L_Control", "FK_ThumbFinger3_L_Control", "FK_IndexFinger1_L_Control", "FK_IndexFinger2_L_Control", "FK_IndexFinger3_L_Control", "FK_MiddleFinger1_L_Control", "FK_MiddleFinger2_L_Control", "FK_MiddleFinger3_L_Control", "FK_RingFinger1_L_Control", "FK_RingFinger2_L_Control", "FK_RingFinger3_L_Control", "FK_Ankle_L_Control", "FK_Knee_L_Control", "FK_Ankle_R_Control", "FK_Knee_R_Control", "FK_Hip_L_Control", "FK_Hip_R_Control"] CharacterFBX= ["*:Root_M", "*:Spine1_M", "*:Chest_M", "*:Neck_M", "*:Head_M", "*:Scapula_R", "*:Shoulder_R", "*:Elbow_R", "*:Wrist_R", "*:ThumbFinger1_R", "*:ThumbFinger2_R", "*:ThumbFinger3_R", "*:IndexFinger1_R", "*:IndexFinger2_R", "*:IndexFinger3_R", "*:MiddleFinger1_R", "*:MiddleFinger2_R", "*:MiddleFinger3_R", "*:RingFinger1_R", "*:RingFinger2_R", "*:RingFinger3_R", "*:Scapula_L", "*:Shoulder_L", "*:Elbow_L", "*:Wrist_L", "*:ThumbFinger1_L", "*:ThumbFinger2_L", "*:ThumbFinger3_L", "*:IndexFinger1_L", "*:IndexFinger2_L", "*:IndexFinger3_L", "*:MiddleFinger1_L", "*:MiddleFinger2_L", "*:MiddleFinger3_L", "*:RingFinger1_L", "*:RingFinger2_L", "*:RingFinger3_L", "*:Ankle_L", "*:Knee_L", "*:Ankle_R", "*:Knee_R", "*:Hip_L", "*:Hip_R"] cmds.setAttr ("IKFKSwitch_L_Leg", 0) cmds.setAttr ("IKFKSwitch_R_Leg", 0) # the integer should change based on your attribute cmds.parentConstraint (bakedFKControls [0], CharacterFBX[0], mo = True) cmds.parentConstraint (bakedFKControls [1], CharacterFBX[1], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [2], CharacterFBX[2], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [3], CharacterFBX[3], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [4], CharacterFBX[4], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [5], CharacterFBX[5], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [6], CharacterFBX[6], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [7], CharacterFBX[7], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [8], CharacterFBX[8], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [9], CharacterFBX[9], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [10], CharacterFBX[10], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [11], CharacterFBX[11], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [12], CharacterFBX[12], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [13], CharacterFBX[13], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [14], CharacterFBX[14], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [15], CharacterFBX[15], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [16], CharacterFBX[16], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [17], CharacterFBX[17], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [18], CharacterFBX[18], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [19], CharacterFBX[19], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [20], CharacterFBX[20], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [21], CharacterFBX[21], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [22], CharacterFBX[22], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [23], CharacterFBX[23], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [24], CharacterFBX[24], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [25], CharacterFBX[25], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [26], CharacterFBX[26], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [27], CharacterFBX[27], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [28], CharacterFBX[28], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [29], CharacterFBX[29], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [30], CharacterFBX[30], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [31], CharacterFBX[31], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [32], CharacterFBX[32], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [33], CharacterFBX[33], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [34], CharacterFBX[34], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [35], CharacterFBX[35], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [36], CharacterFBX[36], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [37], CharacterFBX[37], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [38], CharacterFBX[38], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [39], CharacterFBX[39], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [40], CharacterFBX[40], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [41], CharacterFBX[41], mo = True, st = ['x','y','z']) cmds.parentConstraint (bakedFKControls [42], CharacterFBX[42], mo = True, st = ['x','y','z']) FK_Controls_to_CharacterFBX_Retargeter() |
Code: Bake Controls to Character FBX
def bake_to_CharacterFBX(): CharacterFBXBake= ["*:Root_M", "*:Spine1_M", "*:Chest_M", "*:Neck_M", "*:Head_M", "*:Scapula_R", "*:Shoulder_R", "*:Elbow_R", "*:Wrist_R", "*:ThumbFinger1_R", "*:ThumbFinger2_R", "*:ThumbFinger3_R", "*:IndexFinger1_R", "*:IndexFinger2_R", "*:IndexFinger3_R", "*:MiddleFinger1_R", "*:MiddleFinger2_R", "*:MiddleFinger3_R", "*:RingFinger1_R", "*:RingFinger2_R", "*:RingFinger3_R", "*:Scapula_L", "*:Shoulder_L", "*:Elbow_L", "*:Wrist_L", "*:ThumbFinger1_L", "*:ThumbFinger2_L", "*:ThumbFinger3_L", "*:IndexFinger1_L", "*:IndexFinger2_L", "*:IndexFinger3_L", "*:MiddleFinger1_L", "*:MiddleFinger2_L", "*:MiddleFinger3_L", "*:RingFinger1_L", "*:RingFinger2_L", "*:RingFinger3_L", "*:Ankle_L", "*:Knee_L", "*:Ankle_R", "*:Knee_R", "*:Hip_L", "*:Hip_R"] clipduration = cmds.keyframe('RootControlHere', q = True) cmds.playbackOptions(edit = True, animationStartTime = 0) cmds.playbackOptions(edit = True, animationEndTime = clipduration[-1]) minTIME = cmds.playbackOptions(edit = True, minTime = 0) maxTIME = cmds.playbackOptions(edit = True, maxTime = clipduration[-1]) cmds.bakeResults(CharacterFBXBake, t=(minTIME,maxTIME), simulation = True) bake_to_CharacterFBX() |
Retargeting to IK Controls
Same methodology as retargeting to FK controls with a few minor adjustments.
Alter the Animotive FBX to control rig parent constraint code;
Replace Controls -
FK_Hip_L/R
FK_Knee_L/R
FK_Ankle_L/R
With -
IK_Leg_L/R
IK_PoleVector_Control_L/R
Delete Animotive data names -
Hips_L/R
Make sure they are in the same place in the lists before moving on (Check the code below for reference)
For the IKFKSwitch aspect of the code, make sure you change the integer, and attribute name to turn your IK on if it is not on by default
This should be the only alterations you need to make
Code: Parent Constraint Animotive FBX to IK Control Rig
def animotive_FBX_Retargeter_IK(): animotiveData = ["*:Root_M", "*:Spine1_M", "*:Chest_M", "*:Neck_M", "*:Head_M", "*:Scapula_R", "*:Shoulder_R", "*:Elbow_R", "*:Wrist_R", "*:ThumbFinger1_R", "*:ThumbFinger2_R", "*:ThumbFinger3_R", "*:IndexFinger1_R", "*:IndexFinger2_R", "*:IndexFinger3_R", "*:MiddleFinger1_R", "*:MiddleFinger2_R", "*:MiddleFinger3_R", "*:RingFinger1_R", "*:RingFinger2_R", "*:RingFinger3_R", "*:Scapula_L", "*:Shoulder_L", "*:Elbow_L", "*:Wrist_L", "*:ThumbFinger1_L", "*:ThumbFinger2_L", "*:ThumbFinger3_L", "*:IndexFinger1_L", "*:IndexFinger2_L", "*:IndexFinger3_L", "*:MiddleFinger1_L", "*:MiddleFinger2_L", "*:MiddleFinger3_L", "*:RingFinger1_L", "*:RingFinger2_L", "*:RingFinger3_L", "*:Ankle_L", "*:Knee_L", "*:Ankle_R", "*:Knee_R"] IKControls = ["Root_Control", "FK_Spine_Control", "FK_Chest_Control", "FK_Neck_Control", "FK_Head_Control", "FK_Scapula_R_Control", "FK_Shoulder_R_Control", "FK-Elbow_R_Control", "FK_Wrist_R_Control", "FK_ThumbFinger1_R_Control", "FK_ThumbFinger2_R_Control", "FK_ThumbFinger3_R_Control", "FK_IndexFinger1_R_Control", "FK_IndexFinger2_R_Control", "FK_IndexFinger3_R_Control", "FK_MiddleFinger1_R_Control", "FK_MiddleFinger2_R_Control", "FK_MiddleFinger3_R_Control", "FK_RingFinger1_R_Control", "FK_RingFinger2_R_Control", "FK_RingFinger3_R_Control", "FK_Scapula_L_Control", "FK_Shoulder_L_Control", "FK_Elbow_L_Control", "FK_Wrist_L_Control", "FK_ThumbFinger1_L_Control", "FK_ThumbFinger2_L_Control", "FK_ThumbFinger3_L_Control", "FK_IndexFinger1_L_Control", "FK_IndexFinger2_L_Control", "FK_IndexFinger3_L_Control", "FK_MiddleFinger1_L_Control", "FK_MiddleFinger2_L_Control", "FK_MiddleFinger3_L_Control", "FK_RingFinger1_L_Control", "FK_RingFinger2_L_Control", "FK_RingFinger3_L_Control", "IKLeg_L", "PoleLeg_L", "IKLeg_R", "PoleLeg_R"] # This setAttr is for your IKFK Switches, if you have IK Controls on by default remember to change the integer at the end so that the FK controls will be turned on # cmds.setAttr ("IKFKSwitch_L_Leg.attributename", 0) cmds.setAttr ("IKFKSwitch_R_Leg.attributename", 0) # the integer should change based on your attribute cmds.parentConstraint (animotiveData [0], IKControls [0], mo = True) cmds.parentConstraint (animotiveData [1], IKControls [1], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [2], IKControls [2], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [3], IKControls [3], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [4], IKControls [4], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [5], IKControls [5], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [6], IKControls [6], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [7], IKControls [7], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [8], IKControls [8], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [9], IKControls [9], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [10], IKControls [10], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [11], IKControls [11], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [12], IKControls [12], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [13], IKControls [13], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [14], IKControls [14], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [15], IKControls [15], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [16], IKControls [16], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [17], IKControls [17], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [18], IKControls [18], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [19], IKControls [19], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [20], IKControls [20], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [21], IKControls [21], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [22], IKControls [22], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [23], IKControls [23], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [24], IKControls [24], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [25], IKControls [25], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [26], IKControls [26], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [27], IKControls [27], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [28], IKControls [28], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [29], IKControls [29], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [30], IKControls [30], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [31], IKControls [31], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [32], IKControls [32], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [33], IKControls [33], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [34], IKControls [34], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [35], IKControls [35], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData [36], IKControls [36], mo = True, st = ['x','y','z']) cmds.parentConstraint (animotiveData[37], IKControls [37], mo = True) cmds.parentConstraint (animotiveData[38], IKControls [38], mo = True, sr = ['x','y','z']) cmds.parentConstraint (animotiveData[39], IKControls [39], mo = True) cmds.parentConstraint (animotiveData[40], IKControls [40], mo = True, sr = ['x','y','z']) animotive_FBX_Retargeter_IK() |
Bake onto the IK Controls
Same as the FK version
Copy and paste the ‘Baking to the FK Controls’ code
Copy and paste the ‘IKControls’ list from the IK animotive to control rig parent constraint code
Replace the definition name
Replace the name ‘IKControls’ to something unique like ‘IKControlBake’
Remember to copy and paste the name in the cmds.bakeResults line of code
Parent Constraining IK Controls to Character FBX code
Delete Animotive FBX
Like the FK version of this code;
Rename definition
Swap around the control list so they are at the top and the character FBX is below the controls
Add in ALL of your controls and joints
Change the name of your lists to something sensible
Update the names in the ‘cmds.parentConstraint’ section of this definition
Bake IK Controls onto the Character FBX
Different to the FK version
This time we want to apply the animation to all of the joints in the Character FBX joint hierarchy
This is so we can bake the IK leg and/ or arm motion onto the FBX skeleton
We are omitting the hip/ shoulder movement from our take because it will be dictated by the IK Handle, therefore, we need to bake this IK movement into our Character FBX joints
This time the code will select your Character FBX’s root joint
We will then change the options to ‘hi = “below”’
This will bake everything that is below the root joint
Code: Bake controls to Character FBX code
def baketoFBXRig2(): clipduration = cmds.keyframe('Root_Control', q = True) cmds.playbackOptions(edit = True, animationStartTime = 0) cmds.playbackOptions(edit = True, animationEndTime = clipduration[-1]) minTIME = cmds.playbackOptions(edit = True, minTime = 0) maxTIME = cmds.playbackOptions(edit = True, maxTime = clipduration[-1]) # Bake the animation onto the other character # cmds.select("*:Root_M") cmds.bakeResults("*:Root_M", t=(minTIME,maxTIME), simulation = True, hi = 'below') |
Last updated