Foot Peel Scripted Setup (rough)

So after after a few attempts I was able to get a scripted setup working for my foot peel node setup. Right now it isn’t flexible in terms of the objects it’s given to work with, but I can fix that pretty easily with the usual select/set UI setups that I tend to make.

Everything worked as expected on simple transform nodes, but some values will probably have to be flipped once I put them on bones just because of the way the foot rotates.

I was using this image from my previous post as reference.

import maya.cmds as cmds

class footPeelSetup(object):
    def __init__(self,animCtrl,toeGrp,footGrp):
        self.animCtrl = animCtrl
        self.toeGrp = toeGrp
        self.footGrp = footGrp
        # create footPeel and footPeelBreak attributes
        self.footPeel = cmds.addAttr(self.animCtrl,ln="Foot_Peel",k=1,min=0)
        self.footPeelBreak = cmds.addAttr(self.animCtrl,ln="Foot_Peel_Break",k=1,min=0,dv=30)

        # Create and connect nodes for toe group
        # First make our node that finds the difference between footPeel and footPeelBreak
        self.difference1 = cmds.createNode("plusMinusAverage")
        cmds.setAttr(self.difference1 + ".op",2)
        self.condition1 = cmds.createNode("condition")
        cmds.setAttr(self.condition1 + ".op",2)
        cmds.setAttr(self.condition1 + ".cfr",0)
        self.multDivide1 = cmds.createNode("multiplyDivide")
        cmds.setAttr(self.multDivide1 + ".i2x",1)

        # not sure what the correct short name for Foot Peel will be. Might need to make this a variable ***
        cmds.connectAttr(self.animCtrl + ".Foot_Peel",self.difference1 + ".i1[0]")
        cmds.connectAttr(self.animCtrl + ".Foot_Peel_Break",self.difference1 + ".i1[1]")

        cmds.connectAttr(self.difference1 + ".o1",self.condition1 + ".ctr")
        cmds.connectAttr(self.animCtrl + ".Foot_Peel",self.condition1 + ".ft")
        cmds.connectAttr(self.animCtrl + ".Foot_Peel_Break",self.condition1 + ".st")

        cmds.connectAttr(self.condition1 + ".ocr",self.multDivide1 + ".i1x")

        cmds.connectAttr(self.multDivide1 + ".ox","toe.rz")

        ### now set up the nodes for the foot

        self.difference2 = cmds.createNode("plusMinusAverage")
        self.difference3 = cmds.createNode("plusMinusAverage")
        self.condition2 = cmds.createNode("condition")
        self.condition3 = cmds.createNode("condition")
        self.multDivide2 = cmds.createNode("multiplyDivide")
        cmds.connectAttr(self.animCtrl + ".Foot_Peel_Break",self.multDivide2 + ".i1x")
        cmds.setAttr(self.multDivide2 + ".i2x",2)
        cmds.setAttr(self.difference2 + ".op",2)
        cmds.setAttr(self.difference3 + ".op",2)
        cmds.setAttr(self.condition2 + ".op",2)
        cmds.setAttr(self.condition3 + ".op",2)
        cmds.connectAttr(self.animCtrl + ".Foot_Peel",self.condition2 + ".ft")
        cmds.connectAttr(self.animCtrl + ".Foot_Peel_Break",self.condition2 + ".st")
        cmds.setAttr(self.condition3 + ".ctr",0)
        cmds.connectAttr(self.animCtrl + ".Foot_Peel",self.condition3 + ".ft")

        cmds.connectAttr(self.animCtrl + ".Foot_Peel",self.difference2 + ".i1[0]")
        cmds.connectAttr(self.animCtrl + ".Foot_Peel_Break",self.difference2 + ".i1[1]")

        cmds.connectAttr(self.animCtrl + ".Foot_Peel_Break",self.difference3 + ".i1[0]")
        cmds.connectAttr(self.difference2 + ".o1",self.difference3 + ".i1[1]")

        cmds.connectAttr(self.animCtrl + ".Foot_Peel",self.condition2 + ".cfr")
        cmds.connectAttr(self.difference3 + ".o1",self.condition2 + ".ctr")

        cmds.connectAttr(self.condition2 + ".ocr",self.condition3 + ".cfr")
        cmds.connectAttr(self.multDivide2 + ".ox",self.condition3 + ".st")

        cmds.connectAttr(self.condition3 + ".ocr","foot.rz")

myFootPeel = footPeelSetup("nurbsCircle1","toe","foot")


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s