Jump to content

python link parameters fireback


pelos

Recommended Posts

when I link some parameters some of the main node get crazy wire messing up the node.

example

Node A has some parameters link between them. example

nodeA.parm("bla")      and   nodeA.parm("ble")  is set as reference link to nodeA.parm("bla")      nothing crazy one parameter looking at another one in the same node.

 

now I want to create a new node and link all the parameters to this new node

I want nodeB parameters to look at nodeA, after running the code  witch is a regular stuff just setting parameters,  some of the paramters in nodeA that were just a integer now have an expression poiting to another parameter  =(

 

should I create something like if its an expression use "setExpression"  if is not an expression use the regular set?

 

def linkParmsTo(source_node, target_node):
    """ Link the parms of the source node to those of the target node if
        a parameter with the same name exists.
# Produced by:
#       Graham Thompson
#       captainhammy@gmail.com
#       www.captainhammy.com
    """
    for parm_to_link in source_node.parms():
        # Skip folder parms.
        if isinstance(parm_to_link.parmTemplate(), hou.FolderSetParmTemplate):
            continue
 
        parm_to_link_to = target_node.parm(parm_to_link.name())
 
        # If the target parm exists
        if parm_to_link_to is not None:
            parm_to_link.set(parm_to_link_to)     

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...