Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Switch ShowHideNode
def createShowhideSwitch(nodeList,addAttrNode,attrName,attrList=None):
if isinstance(addAttrNode,str) == True:
addAttrNode = pm.PyNode(addAttrNode)
setNode = []
if attrList == None:
attrList = []
for i in nodeList:
if isinstance(i,str) == True:
attrList.append(i)
setNode.append(pm.PyNode(i))
else:
attrList.append(i.name())
setNode.append(i)
addAttrNode.addAttr(attrName,k=True,at="enum",en=":".join(attrList))
for i in range(0,len(setNode)):
print i
cond = pm.createNode("condition")
addAttrNode.attr(attrName) >> cond.firstTerm
cond.secondTerm.set(i)
cond.colorIfFalseR.set(0)
cond.colorIfTrueR.set(1)
cond.outColorR >> setNode[i].v
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.