infinity_spiral Posted March 12, 2013 Share Posted March 12, 2013 (edited) 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 freedoom 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","Color_Vector"]) name = n[1][0] color = eval(n[1][1]) 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[0]) chan.parm("colordefg").set(color[1]) chan.parm("colordefb").set(color[2]) 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[i] for i in sel] numPick = len(pick) implanes = mantra[0].parm("vm_numaux").eval() addplane = implanes + numPick mantra[0].parm("vm_numaux").set(addplane) planeN = implanes + 1 for i in pick: mantra[0].parm("vm_variable_plane%s" % planeN).set(i) mantra[0].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. Edited March 14, 2013 by T.I.M. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.