Jump to content

Nested OTLs and kwargs


GeordieM

Recommended Posts

Hi all, I've got a chain of nested OTLs and would like to call Python functions held in a lower level OTL from a higher level one.

 

Example graph:

 

obj/OTL_A/OTL_B/grid

 

OTL_B's pythonModule has a function:

 

# OTL_B Function

def setGridSize(gridSize):

    curNode =  hou.node(".")

    curNode.node(".\grid").parm("sizex").set(gridSize)

#

 

I then have a button callback in OTL_A that calls:

hou.node("./OTL_B").hdaModule().setGridSize(10)

 

I know there are betters ways to achieve this functionality using exposed parms but just making an example.

 

The issue is that the call to hou.node(".") inside OTL_B returns OTL_A.

 

I've read The threads about the differences between hou.node("."). hou.pwd() and kwargs["node"] and I understand I should use kwargs["node"] like this (I think):

 

# OTL_B Function

def setGridSize(gridSize):

    curNode =  kwargs["node"]

    curNode.node(".\grid").parm("sizex").set(gridSize)

#

 

The real problem is that kwargs["node"] does not exist.  The kwargs dictionary exists but only has a "type" key.  I believe kwargs["node"] works correctly from within callbacks but what about being directly called in a function?

 

TNKS!

 

G

Link to comment
Share on other sites

Guest mantragora

Pass the node that calls this function into this function directly from callback as a second parameter, instead of trying to get it inside of it.

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...