Skip to content

Instantly share code, notes, and snippets.

@fereria fereria/anonymous-gist.py
Last active Aug 29, 2015

Embed
What would you like to do?
parentSwitch
def createParentNodeSwith(cNode,parentNode,addSwitchNode,attrName,switchName=None,select=0):
if switchName == None:
switchName = []
for i in parentNode:
switch.append(i.name())
addEnum = ":".join(switchName)
if addSwitchNode.hasAttr(attrName) != True:
addSwitchNode.addAttr(attrName,at="enum",en=addEnum,k=True)
addSwitchNode.attr(attrName).set(select)
switchAttr = []
for num in range(0,len(parentNode)):
constNode = pm.parentConstraint(parentNode[num],cNode,w=1,mo=True)
switchAttr.append(parentNode[num].name()+"W"+str(num))
for num in range(0,len(parentNode)):
cond = pm.createNode("condition")
addSwitchNode.attr(attrName) >> cond.firstTerm
cond.secondTerm.set(num)
cond.colorIfFalseR.set(0)
cond.colorIfTrueR.set(1)
cond.outColorR >> constNode.attr(switchAttr[num])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.