Jump to content
Sign in to follow this  
pelos

python link parameters fireback

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)     

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×