Browse files

Resurrect old tool to promote parms to arbitrary nodes.

  • Loading branch information...
captainhammy committed May 27, 2018
1 parent 6b146cb commit e40fad75e607a08f99479d2b2690446f4789c616
Showing with 84 additions and 0 deletions.
  1. +84 −0 houdini/PARMmenu.xml
@@ -2,6 +2,90 @@
<scriptItem id="promote_parm_to_node">
<label>Promote Parameter to Node</label>
<scriptCode><![CDATA[# Get the parms to act on.
parms = kwargs["parms"]
# The number of parms that were selected.
num_parms = len(parms)
parm_tuple = parms[0].tuple()
# Find the node to start from.
node = parm_tuple.node()
# Prompt for a target node. Start at the parent (the most logical choice?)
result = hou.ui.selectNode(initial_node=node.parent())
# Try to find ths selected node.
target_node = hou.node(result)
if target_node is not None:
if target_node == node:
raise hou.OperationFailed("Cannot promote to the source node.")
# Should the target parm will be set to the source value?
set_value = True
# The target node already has a parm tuple with the desired name so we
# should prompt to use it.
if target_node.parmTuple( is not None:
choice = hou.ui.displayMessage(
"Parameter already exists on {}. Link to existing parameter?".format(
buttons=("Yes and keep current value", "Yes and update value", "Cancel"),
# Use parm but keep value, so don't set.
if choice == 0:
set_value = False
# Use parm and update value.
elif choice == 1:
set_value = True
# Cancelling so clear out the parm list so we don't try to set anything.
parms = ()
# Get the target node's parm interface.
target_ptg = target_node.parmTemplateGroup()
# The parameter definition for the parm we are trying to link.
parm_template = parm_tuple.parmTemplate()
# If we are trying to link a single parm inside a tuple then modify
# the parm definition to represent that single parm.
if num_parms != len(parm_tuple):
# Add the parameter definition to the parm list.
# Update the interface with the new definition.
# Process each parm to set.
for parm in parms:
# Get the target parm.
target_parm = target_node.parm(
# Set the target parm to the current value if required.
if set_value:
# Create the channel reference.
<scriptItem id="relative_to_absolute_path">
<label>Convert to Absolute Path</label>

0 comments on commit e40fad7

Please sign in to comment.