mrWolf Posted April 22, 2013 Share Posted April 22, 2013 I've a hip file with a dop which doesn't recook as it should when I change certain node parameters upstream. In order to make it work I need to bypass on and off the dop network manually, OR perform in a Python shell: hou.node('/obj/dop_version/dopnet1').cook(True) Is there a way I can attach this Python code to the a parameter in a node, so that when I change the parameter content, the code gets executed ? Alessandro Quote Link to comment Share on other sites More sharing options...
animknight Posted April 23, 2013 Share Posted April 23, 2013 You can attach this to any parameters callback script. Properties -> Parameter Description -> Callback Script. Change the language from Hscript to Python. Callback script runs whenever the parameter value changes. I hope this helps Cheers -J Quote Link to comment Share on other sites More sharing options...
mrWolf Posted April 23, 2013 Author Share Posted April 23, 2013 Thank you Jagadeesh ! I tried that and it works. But it works only if I change the content of the parameter manually, via UI. If I , for instance, keyframe that channel, the callback script is not executed at play time. Is there a way to have the callback script executed every time that parameter changes , regardless how, OR to have a callback script run whenever a certain node is cook ? You can attach this to any parameters callback script. Properties -> Parameter Description -> Callback Script. Change the language from Hscript to Python. Callback script runs whenever the parameter value changes. I hope this helps Cheers -J Quote Link to comment Share on other sites More sharing options...
animknight Posted April 24, 2013 Share Posted April 24, 2013 Hey Alessandro, You can use a Script SOP to have the script run whenever the node gets cooked. Also hou.node().cook() function has a frame range parameter where you can specify the frames at which to cook this object. Hope this helps. Cheers -J Quote Link to comment Share on other sites More sharing options...
mrWolf Posted April 24, 2013 Author Share Posted April 24, 2013 Jagadeesh, this is really handy node, thank you for the hint ! It doesn't fix my issue cause even if i force the cook of a dop network , for some reason it works only if i change that parameter manually, not in 'play' mode, but it's a really handy sop node and a huge help do debug issues. Quote Link to comment Share on other sites More sharing options...
animknight Posted April 25, 2013 Share Posted April 25, 2013 (edited) Alessandro, You can make the Script sop time dependent. Make sure you check the Make Time dependent Toggle. This will make sure that the Script runs every frame. Now you can directly call the cook function in the Script. Or if you want this to be tied to a parameter callback, then a nice little trick would be to have a button parameter with the callback script. Then in the Script sop you can do something like hou.node("../blah").parm('buttonParm').pressButton(). This will press the button every frame and the callback script gets executed every frame. Hope this helps Cheers -J Edited April 25, 2013 by jagadeesh Quote Link to comment Share on other sites More sharing options...
mrWolf Posted April 26, 2013 Author Share Posted April 26, 2013 hey Jagadeesh this is a really neat trick. I'll definitely use it sometimes. It turns out the problem I was having was caused by an incorrect use of dops and sop solvers. This is where I explain the issue. Alessandro, You can make the Script sop time dependent. Make sure you check the Make Time dependent Toggle. This will make sure that the Script runs every frame. Now you can directly call the cook function in the Script. Or if you want this to be tied to a parameter callback, then a nice little trick would be to have a button parameter with the callback script. Then in the Script sop you can do something like hou.node("../blah").parm('buttonParm').pressButton(). This will press the button every frame and the callback script gets executed every frame. Hope this helps Cheers -J Quote Link to comment Share on other sites More sharing options...
animknight Posted April 26, 2013 Share Posted April 26, 2013 I'm glad it's resolved 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.