Archived post by shadesoforange

@mestela I have this code lying around for copying parm values from one node to another

(from the first selected node to the second)

“`def copyParmValues(source_node, target_node): “”” Copy parameter values of the source node to those of the target node if a parameter with the same name exists. “”” for parm_to_copy in source_node.parms(): parm_template = parm_to_copy.parmTemplate() # Skip folder parms. if isinstance(parm_template, hou.FolderSetParmTemplate): continue
parm_to_copy_to = target_node.parm(parm_to_copy.name()) # If the parameter on the target node does not exist, skip this parm. if parm_to_copy_to is None: continue
# If we have keys/expressions we need to copy them all. if parm_to_copy.keyframes(): # Copy all hou.Keyframe objects. for key in parm_to_copy.keyframes(): parm_to_copy_to.setKeyframe(key) else: # If the parameter is a string copy the raw string. if isinstance(parm_template, hou.StringParmTemplate): parm_to_copy_to.set(parm_to_copy.unexpandedString()) # Copy the raw value. else: parm_to_copy_to.set(parm_to_copy.eval())

#initial setup srcpath = hou.selectedNodes()[0].path() targetpath = hou.selectedNodes()[1].path()
#src and target definition srcNode = hou.node(srcpath) targetNode = hou.node(targetpath)
#copyparms copyParmValues(srcNode,targetNode)“`

Archived post by Ambrosiussen

Here’s a handy menuscript snippet to get all unique values of a certain attribute to show up in the little parm dropdown menu. Example with name attribute on points: “`import hou
AllAttribValues = set(hou.pwd().geometry().pointStringAttribValues(‘name’)) Pairs = [[x, x] for x in AllAttribValues]
return sum(Pairs, [])“`

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20205701/24/20/unknown.png