Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #####Parameters#####
- ##Get List if Nodes(get_list)##
- ##Set Color(set_color)##
- ##Revert to Defaults(panel)##
- ##Raise Floating Panel(floatPanel)##
- ##(Folder)Add nodes##
- ##Color(setColor#)##
- ##Prefix(prefix#)<toggle>##
- ##Prefix String(prefixstr#)##
- ##Use Reference Node(enable#)<toggle>##
- ##Reference Node(refNode#)##
- ##Node Type(nodeType#)##
- #######Set color###########
- for node in hou.node( "/obj" ).allSubChildren():
- if node.type().name().startswith( "IE::ColorNodes" ):
- path = node.path() + "/set_color"
- node.parm( "set_color" ).pressButton()
- ###########################################################################################################################
- ######Raise Floating Panel#######
- for node in hou.node( "/obj" ).allSubChildren():
- if node.type().name().startswith( "IE::ColorNodes" ):
- node.parm( "floatPanel" ).pressButton()
- ###########################################################################################################################
- def setColor( ):
- node = hou.pwd()
- currContext = node.parent().path() + "/"
- mainParm = node.parm( "add_nodes" ).eval()
- for i in xrange( 1, mainParm + 1 ):
- prefixToggle = node.parm( "prefix%s"%( i ) ).eval()
- prefixString = node.parm( "prefixstr%s"%( i ) ).evalAsString()
- refNodeToggle = node.parm( "enable%s"%( i ) ).eval()
- refNodeStr = node.parm( "refNode%s"%( i ) ).evalAsString()
- nodeTypeParm = node.parm( "nodeType%s"%( i ) ).evalAsString()
- setColor = node.parmTuple( "setColor%s"%( i ) ).eval()
- colorR = setColor[0]
- colorG = setColor[1]
- colorB = setColor[2]
- if prefixToggle and not refNodeToggle:
- for aNode in hou.node( "/" ).allSubChildren():
- prefixName = aNode.name().split( "_" )[0]
- if prefixString == prefixName:
- aNode.setColor( hou.Color( [ colorR, colorG, colorB ] ) )
- elif node.parm( "prefix%s"%i ).eval() == 0:
- nodeType = node.parm( "nodeType%s"%i ).eval()
- refNode = node.parm( "refNode%s"%( i ) ).eval()
- if hou.node( refNode ) == None:
- pass
- elif refNode == "":
- pass
- elif refNode != "":
- nodeType = hou.node( refNode ).type().name()
- nodeParm = node.parm( "nodeType%s"%( i ) )
- nodeParm.set( "%s"%nodeType )
- setColor = node.parmTuple( "setColor%s"%( i ) ).eval()
- colorR = setColor[0]
- colorG = setColor[1]
- colorB = setColor[2]
- for aNode in hou.node("/").allSubChildren():
- if aNode.type().name() == nodeType:
- aNode.setColor( hou.Color( [ colorR, colorG, colorB ] ) )
- def getList():
- node = hou.pwd()
- objContext = hou.node( "/" ).allSubChildren()
- nodeList = []
- for nodes in objContext:
- nodeList.append( nodes )
- treeNodes = {}
- for i in nodeList:
- treeNodes[ i.path() ] = i.type().name()
- # print treeNodes
- choices = hou.ui.selectFromTree( treeNodes.keys(), message='Select Nodes to Color' )
- # print choices
- if len( choices ) > 0:
- num = int( len( choices ) )
- node.parm( "add_nodes" ).set( "%d"%num )
- nodeList = []
- for choice in choices:
- nodeType = hou.node( choice ).type().name()
- nodeList.append( nodeType )
- # print nodeList
- parmList = []
- currContext = node.parent().path() + "/"
- mainParm = node.parm( "add_nodes" ).eval()
- for i in xrange( 1, mainParm + 1 ):
- parm = node.parm( "nodeType%s"%( i ) ).name()
- parmList.append( parm )
- values = dict( zip( parmList, nodeList ) )
- for i in xrange( 1, mainParm + 1 ):
- node.setParms( { "nodeType%s"%i : values[ "nodeType%s"%i ] } )
- def revert():
- for aNode in hou.selectedNodes():
- aNode.setColor( hou.Color( [ 0.8,0.8,0.8 ] ) )
- def panel():
- node = hou.pwd()
- path = node.path()
- hou.hscript( "oppane -t parmeditor %s"%path )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement