This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def toggle_manual(): | |
"""Toggle cook mode""" | |
current_mode = hou.updateModeSetting() | |
auto = (hou.updateMode.AutoUpdate, hou.updateMode.OnMouseUp) | |
toggle_cook = hou.shelves.tool("toggle_manual") | |
toggle_cook.setLabel("Auto Update") | |
if current_mode in auto: | |
hou.setUpdateMode(hou.updateMode.Manual) | |
toggle_cook.setIcon("MISC_cook") | |
elif current_mode == hou.updateMode.Manual: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hqueue.houdini as hq | |
node = hq.getNode("/obj/topnet1").displayNode() | |
node.executeGraph(False, True, False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
@contextlib.contextmanager | |
def set_read_only_parm(parm): | |
if not isinstance(parm, (hou.Parm, hou.ParmTuple)): | |
return | |
# Unlock the parm | |
parm.lock(False) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Disable When / Hide When Expressions | |
Used to control parameter visibility. | |
""" | |
# Hide When Expression | |
{ expanded == 1 } | |
# Hide When Expression (multiparm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Callbacks | |
idx = kwargs["script_multiparm_index"] | |
# In a parameter expression | |
idx = evaluatingParm().multiParmInstanceIndices[0] # Returns a tuple. Will need subscript for the right level, and test for IndexError | |
# In a parameter expression, better | |
import re | |
idx = re.match(r".+(\d+)$", evaluatingParm().name()).group(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import hou | |
def ftrimify(parm): | |
"""Wrap an ftrim() function around channel refs. | |
Args: | |
parm (hou.Parm): Parameter to add ftrim()s to. Should be a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Match forearm, leftArm, and arm | |
@name=*[aA]rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Action button script.""" | |
import os | |
if kwargs["shift"]: | |
# Copy evaluated parameter string | |
text = kwargs["parmtuple"][0].evalAsString() | |
command = "echo -n {0}| xclip -sel clip".format(text) | |
os.system(command) | |
else: | |
# Copy a reference to this parameter |
NewerOlder