Jump to content

how.pwd() on created otl


pelos

Recommended Posts

i am doing an otl and i want to get its path when i put down the node to grab some parms.

the idea is once its been drop in the network editor, will read if there is a camera node, if there is one, put that camera in the otl path parm.

in the script tab i am doing a "on created"

i am doing print hou.pwd() but once i TAB select the otl and drop it, it print "obj" and not the actual node.

if i put a spare parm button that print hou.pwd() it does print the node correctly.

is there something special on created that i need to know? or a diferent type of code?

Thanks guys.

Link to comment
Share on other sites

using kwargs[] is preferred way to get this kind of data and you should use it every time it is available to avoid problems in the future, especially in nested digital asset where pwd() will not always be what you think is should

Link to comment
Share on other sites

here is some read on that subject

http://www.sidefx.com/docs/houdini12.1/hom/assetscripts#parameter_callback_scripts

and even though they say, "Using hou.pwd, or hou.node('.'), is also a valid way to access the PythonModule section, since Houdini changes the current node to the HDA instance when it invokes a parameter callback." I had problems in the past when calling hou.pwd() from within the callback function for nested assets. When nested asset had button with such callback script and that button was linked to parent asset button, the hou.pwd() returned parent asset rather than nested asset, since parent asset was still current, not sure if this is the case nowadays since from that point I tend to use kwargs dictionary

Link to comment
Share on other sites

  • 6 years later...

UPDATE. kwargs['node'] is actually accepted inside a onLoaded event handler. I don't know why it was not working when I tried it the first time..
However it's not mentioned in the documentation of Hou17.

-------

What's the reason for the 'node' key not being accepted in a onLoaded event handler script?
http://www.sidefx.com/docs/houdini/hom/locations.html#node_event_kwargs

I need to know what is the instance of the digital asset in the onLoaded script.
If do something like hou.pwd() it would return "/"

Edited by Andr1
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...