Shelf Tools
My shelf tools setup, in progress. Save to houdinixx.x/toolbar/daam.shelf
<?xml version="1.0" encoding="UTF-8"?>
<shelfDocument>
<!-- This file contains definitions of shelves, toolbars, and tools.
It should not be hand-edited when it is being used by the application.
Note, that two definitions of the same element are not allowed in
a single file. -->
<toolshelf name="daam" label="daam">
<memberTool name="SopToTops"/>
<memberTool name="rop_to_top"/>
<memberTool name="TOPS_rangeselect"/>
<memberTool name="versionup"/>
<memberTool name="sop_makeFile"/>
<memberTool name="showfile"/>
<memberTool name="exportToNew"/>
<memberTool name="sopTimeClamp"/>
</toolshelf>
<tool name="SopToTops" label="SOPtoTOP" icon="hicon:/SVGIcons.index?COP2_subnet.svg">
<script scriptType="python"><![CDATA[import hou
nodes = hou.selectedNodes()
topnet = hou.node("/obj/topnet1")
if not topnet:
topnet = hou.node("/obj").createNode("topnet")
topnet.setName("topnet1")
for x in nodes:
name = x.name()+"_"+str(x.parent())
fstart = x.parm("f1").eval()
fend = x.parm("f2").eval()
if x.type().name() == "rop_geometry":
ver = x.parm("vp_version")
path = x.path()
elif x.type().name() == "rop_alembic":
ver = x.parm("vp_version")
path = x.path()
elif x.type().name() == "filecache::2.0":
path= x.path() + "/render"
ver = x.parm("vp_version")
else:
ver = x.parm("version")
path = x.path()
topcache = topnet.createNode("ropfetch")
try:
if x.parm("cachesim").eval() is 1:
topcache.parm("batchall").set(1)
topcache.setColor(hou.Color(.5,0,0))
else:
topcache.parm("framesperbatch").set(15)
topcache.setColor(hou.Color(0,.5,0))
except:
if x.parm("initsim").eval() is 1:
topcache.parm("batchall").set(1)
topcache.setColor(hou.Color(.5,0,0))
else:
topcache.parm("framesperbatch").set(15)
topcache.setColor(hou.Color(0,.5,0))
p = hou.IntParmTemplate("version", "Version", 1, min=1, max=40)
g = topcache.parmTemplateGroup()
g.insertAfter("pdg_servicename", p)
topcache.setParmTemplateGroup(g)
topcache.parm("version").set(ver)
topcache.parm("roppath").set(path)
topcache.setName(name)]]></script>
</tool>
<tool name="TOPS_rangeselect" label="TOPS RangeSelect" icon="hicon:/SVGIcons.index?BUTTONS_set_framerange.svg">
<script scriptType="python"><![CDATA[node = hou.selectedNodes()[0]
popup = hou.ui.selectNode(title="Select Node to grab range",node_type_filter=hou.nodeTypeFilter.Sop)
popup = hou.node(popup)
start = popup.parm("f1")
end = popup.parm("f2")
if node.type().name() == "rangeextend":
node.parm("newrangex").set(start)
node.parm("newrangey").set(end)
if node.type().name() == "rangegenerate":
node.parm("rangex").set(start)
node.parm("rangey").set(end)]]></script>
</tool>
<tool name="versionup" label="Node Version UP" icon="hicon:/SVGIcons.index?BUTTONS_list_reorderup.svg">
<script scriptType="python"><![CDATA[import hou
nodes = hou.selectedNodes()
for x in nodes:
ver = x.parm("version").eval() + 1
x.parm("version").set(ver)]]></script>
</tool>
<tool name="rop_to_top" label="ROPtoTOP" icon="hicon:/SVGIcons.index?BUTTONS_theme_dark.svg">
<script scriptType="python"><![CDATA[import hou
nodes = hou.selectedNodes()
topnet = hou.node("/obj/topnet1")
frb = round((hou.playbar.frameRange()[1] - hou.playbar.frameRange()[0]) / 2)
if not topnet:
topnet = hou.node("/obj").createNode("topnet")
topnet.setName("topnet1")
if not hou.node("/obj/topnet1/rangegenerate_start"):
rg = topnet.createNode("rangegenerate")
rg.setName("rangegenerate_start")
for x in nodes:
ver = x.parm("ver")
path = x.path()
name = x.name()
if x.parm("extra"):
name = name + x.parm("extra").eval()
else: pass
topcache = topnet.createNode("ropfetch")
p = hou.IntParmTemplate("version", "Version", 1)
g = topcache.parmTemplateGroup()
g.append(p)
topcache.setParmTemplateGroup(g)
topcache.parm("version").set(ver)
topcache.parm("roppath").set(path)
topcache.parm("framesperbatch").set(frb)
topcache.setName(name)]]></script>
</tool>
<tool name="sop_makeFile" label="SOP makeFile From ROP" icon="hicon:/SVGIcons.index?BUTTONS_upload.svg">
<script scriptType="python"><![CDATA[import hou, re
nodes = hou.selectedNodes()
parent = nodes[0].parent()
nodeList = []
for x in nodes:
name = x.name()+"_load"
version = x.parm("vp_version").eval()
path= x.parm("sopoutput").eval()
path = str(path)
newpath1 = re.sub("_v\d+", "_v{0}", path).format("`padzero(3,ch('version'))`")
newpath1 = re.sub("\.\d+", ".$F4", newpath1)
file = parent.createNode("file")
try:
file.setName(name)
except:
continue
file.setColor(hou.Color(0,0,1))
file.parm("file").set(newpath1)
p = hou.IntParmTemplate("version", "Version", 1)
g = file.parmTemplateGroup()
g.append(p)
file.setParmTemplateGroup(g)
file.parm("version").set(version)
nodeList.append(file)
parent.layoutChildren(items=nodeList)]]></script>
</tool>
<tool name="showfile" label="TOPS Show File in Nautilus" icon="hicon:/SVGIcons.index?BUTTONS_addassetdirectory.svg">
<script scriptType="python"><![CDATA[import hou, re
nodes = hou.selectedNodes()
for x in nodes:
rpath = x.parm("roppath").eval()
tnode = rpath.rpartition("/")[0]
dirpath = hou.node(tnode).parm("file").eval()
dirpath = dirpath.rpartition("/")[0]
hou.ui.showInFileBrowser(str(dirpath))]]></script>
</tool>
<tool name="exportToNew" label="SOP send to new" icon="hicon:/SVGIcons.index?BUTTONS_cut.svg">
<script scriptType="python"><![CDATA[node = hou.selectedNodes()
net = hou.node("/obj")
for x in node:
name = x.name()
makeout = net.createNode("geo")
makeout.setInput(0,x)
makeout.setName(name+"_INOUT")
makeout.moveToGoodPosition()
makeout.setColor(hou.Color(.5, .25, .6))
merge = makeout.createNode("object_merge")
merge.parm("objpath1").set(x.path())]]></script>
</tool>
<tool name="sopTimeClamp" label="SOP time clamp" icon="hicon:/SVGIcons.index?SOP_timeblend.svg">
<script scriptType="python"><![CDATA[node = hou.selectedNodes()
for x in node:
outnode = x.outputs()[0]
name = x.name() + "_TIMESHIFT_clamp"
start = x.parm("f1")
end = x.parm("f2")
net = x.parent()
timeshift = net.createNode("timeshift")
timeshift.parm("rangeclamp").set(3)
timeshift.parm("frange1").deleteAllKeyframes()
timeshift.parm("frange2").deleteAllKeyframes()
timeshift.parm("frange1").set(start)
timeshift.parm("frange2").set(end)
timeshift.setName(name)
timeshift.setInput(0, x)
outnode.setInput(0, timeshift)
timeshift.moveToGoodPosition()]]></script>
</tool>
<shelfSetEdit name="shelf_set_1" fileLocation="/mnt/jobs/software/houdini/hfs20.5.370-py310/houdini/toolbar/ShelfDefinitions.shelf">
<addMemberToolshelf name="NOISE" inPosition="14"/>
<addMemberToolshelf name="daam" inPosition="15"/>
</shelfSetEdit>
</shelfDocument>