Here are two simple python scripts.Someone can find it handy ,especially if has to deal with big scenes with many materials.
The first one creates material ID for multiple selected materials and also creates list with the ID's on sticky node inside OUT context.
And the second one adds automatically the channels that you want to include in selected mantra node.
In the first script I couldn't find a simple way in Houdini to have the color picker UI so you have to type the color vector value.Something like : 1,0,0 for RED and 0,1,0 for Green and so on.
Maybe I could use option to pick R G B but I wanted the script to have the freedom to put any color value.
If anyone has an idea how to call Houdini's color picker without using external ui files and libraries will be great to show me.
MatirialID:
def colorID():
sel = hou.selectedNodes()
n = hou.ui.readMultiInput(“Set ID Name and RGB Color”,)
name = n
color = eval(n)
for i in sel:
chan = i.createNode(“parameter”,name)
chan.moveToGoodPosition()
chan.parm(“parmname”).set(name)
chan.parm(“parmlabel”).set(name)
chan.parm(“parmtype”).set(“color”)
chan.parm(“colordefr”).set(color)
chan.parm(“colordefg”).set(color)
chan.parm(“colordefb”).set(color)
chan.parm(“exportparm”).set(1)
if hou.node(“out”).findStickyNote(“colorID_list”):
note = hou.node(“out”).findStickyNote(“colorID_list”)
text = note.text()
if name in text:
pass
else:
note.setText(text + “\n”+name)
else:
note = hou.node(“out”).createStickyNote(“colorID_list”)
note.setColor(hou.Color((1,0.5,0)))
note.setText(name)
colorID()
AddMatID:
import hou
mantra = hou.selectedNodes()
note = hou.node(“out”).findStickyNote(“colorID_list”)
text = note.text()
textlist = text.split()
numIDs = len(textlist)
sel = hou.ui.selectFromList(textlist)
pick = [textlist for i in sel]
numPick = len(pick)
implanes = mantra.parm(“vm_numaux”).eval()
addplane = implanes + numPick
mantra.parm(“vm_numaux”).set(addplane)
planeN = implanes + 1
for i in pick:
mantra.parm(“vm_variable_plane%s” % planeN).set(i)
mantra.parm(“vm_quantize_plane%s” % planeN).set(“half”)
planeN += 1
You can simply create shelf button for each one and paste the script in it.
Cheers.
Material ID script
4726 2 1-
- infinity_spiral
- Member
- 34 posts
- Joined: July 2006
- Offline
-
- zdimaria
- Member
- 390 posts
- Joined: Jan. 2012
- Offline
-
- Alejandro Echeverry
- Member
- 691 posts
- Joined: June 2006
- Offline
Thank you, it's very helpful!!!
Feel The Knowledge, Kiss The Goat!!!
http://www.linkedin.com/in/alejandroecheverry [linkedin.com]
http://vimeo.com/lordpazuzu/videos [vimeo.com]
http://www.linkedin.com/in/alejandroecheverry [linkedin.com]
http://vimeo.com/lordpazuzu/videos [vimeo.com]
-
- Quick Links


