Here’s the script I edited from the thread I posted. I don’t know exactly if what I’m doing is right because I’m not a programmer but although it technically works, but the FK arm rotation gets Offset for some reason. -
import pymel.core as pm
print ‘POST: left hand isolate script’
control to isolate
isolate_ctrl = pm.PyNode(‘arm_L0_fk0_ctl’)
spaces to add to isolation
global_ctrl = pm.PyNode(‘local_C0_ctl’)
parent_ctrl = pm.PyNode(‘spine_C0_ik1_ctl’)
isolate_constrain_grp = pm.PyNode(‘arm_L0_fk0_npo’)
isolate_attr_holder = pm.PyNode(‘armUI_L0_ctl’)
create extra top group for isolate constrain
pm.select(isolate_constrain_grp, r=True)
isolate_grp = pm.group(n=isolate_constrain_grp.name() + ‘_isolate’, empty=True, world=True)
pm.delete(pm.parentConstraint(isolate_ctrl, isolate_grp, mo=False))
isolate_constrain_grp_parent = isolate_constrain_grp.getParent()
pm.parent(isolate_constrain_grp, isolate_grp)
pm.parent(isolate_grp, isolate_constrain_grp_parent)
add orientConstraint
con = pm.parentConstraint(global_ctrl, parent_ctrl, isolate_grp, mo=True, weight=0, skipTranslate=[‘x’, ‘y’, ‘z’])
con.interpType.set(2)
add attribute for switching spaces
pm.addAttr(isolate_attr_holder, type=‘float’, min=0, max=1, dv=0, longName=‘isolate_rotation’, keyable=True)
connect attr to constraint target weights
isolate_attr_holder.isolate_rotation >> con.getWeightAliasList()[0]
rev_node = pm.createNode(‘reverse’)
isolate_attr_holder.isolate_rotation >> rev_node.inputX
rev_node.outputX >> con.getWeightAliasList()[1]