pelos Posted December 31, 2012 Share Posted December 31, 2012 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. Quote Link to comment Share on other sites More sharing options...
graham Posted December 31, 2012 Share Posted December 31, 2012 hou.pwd() will return the location in which the new node will be a child of. In the OnCreated handler you can get the new node using the kwargs dictionary : node = kwargs["node"] 2 Quote Link to comment Share on other sites More sharing options...
pelos Posted December 31, 2012 Author Share Posted December 31, 2012 aja!!! i knew there was a trick for that....!!! master graham thanks. Quote Link to comment Share on other sites More sharing options...
anim Posted December 31, 2012 Share Posted December 31, 2012 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 Quote Link to comment Share on other sites More sharing options...
pelos Posted December 31, 2012 Author Share Posted December 31, 2012 whats the diference between kwargs[node] and hou.pwd() / hou.node(".") Quote Link to comment Share on other sites More sharing options...
anim Posted December 31, 2012 Share Posted December 31, 2012 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 Quote Link to comment Share on other sites More sharing options...
Andr1 Posted March 8, 2019 Share Posted March 8, 2019 (edited) 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 March 9, 2019 by Andr1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.