def spaceSwitchConstraintOnOFFBuild( orginSource, sourceInputON, sourceInputOFF, controllerAttributeName, constraintController, ParentNodeREV = ''):
listInputsOnOFF = [sourceInputOFF ,sourceInputON]
if mc.objExists(orginSource + '_parentConstraint1'):
mc.delete(orginSource + '_parentConstraint1')
mc.parentConstraint( listInputsOnOFF, orginSource, w=1 )
if not mc.objExists(ParentNodeREV):
mc.createNode( 'reverse', n= ParentNodeREV)
spaceSwitcherRange( constraintController, controllerAttributeName, ["onOffRange"])
mc.connectAttr ((constraintController + '.' + controllerAttributeName), (ParentNodeREV + '.inputX'))
mc.connectAttr ((ParentNodeREV + ".outputX"), (orginSource + "_parentConstraint1." + sourceInputOFF + "W0"))
mc.connectAttr ((constraintController + '.' + controllerAttributeName), (orginSource + "_parentConstraint1." + sourceInputON + "W1"))
so I’m currently working on a faster option to connect constraints to object attributes, but I’ve seemed to have run into an issue.
the problem is that I plan to set multiple objects to one control, however whenever I connect a attribute to its connection it disconnects all other connections to the node, i’m hoping there is a workaround. (thanks in advance!)
spaceSwitchConstraintOnOFFBuild( “joint1_FK_IK”, “joint1_FK”, “joint1_IK”, “IKFKTest”, “CircleControl”, ParentNodeREV = ‘joint1_FK_IKREV’ )
attachest fine in the reverse node
connects from object directly to controller (joint1_FK_IK) <-- CircleControl
spaceSwitchConstraintOnOFFBuild( “joint2_FK_IK”, “joint2_FK”, “joint2_IK”, “IKFKTest”, “CircleControl”, ParentNodeREV = ‘joint1_FK_IKREV’)
attachest fine in the reverse node
connects from object directly to controller (joint2_FK_IK) <-- CircleControl (breakes connection from joint1_FK_IK )
spaceSwitchConstraintOnOFFBuild( “joint3_FK_IK”, “joint3_FK”, “joint3_IK”, “IKFKTest”, “CircleControl”, ParentNodeREV = ‘joint1_FK_IKREV’)