Homguy Posted June 25, 2010 Share Posted June 25, 2010 (edited) Hello all, How to make a custom python node time dependent, i mean to cook it every frame so that the value in the parameter gets updated every frame? i tried adding frame number to calculation but even that doesnt seems to do the trick? Is there some function like setTimeDependent()? I was browsing a bit about it and found that the following code will make the node to cook every frame.? OP_Node::flags().timeDep = 1; REF from: http://accad.osu.edu/~pete/Houdini/html/qa/index.html If so, how to implement it in a python node.? Where should i write it.? Edited June 25, 2010 by Homguy Quote Link to comment Share on other sites More sharing options...
graham Posted June 25, 2010 Share Posted June 25, 2010 (edited) Well looking at the SOP_HOMWave example evaluating the frame seems to cause it to be time dependent for me. Alternatively you can use how you mentioned. The newer, more correct method would be to use OPNodeFlags::setTimeDep(1) in your cook function. To do this in an operator you'd do something like this->flags().setTimeDep(1) Edited June 25, 2010 by graham Quote Link to comment Share on other sites More sharing options...
Homguy Posted June 25, 2010 Author Share Posted June 25, 2010 Well looking at the SOP_HOMWave example evaluating the frame seems to cause it to be time dependent for me. Alternatively you can use how you mentioned. The newer, more correct method would be to use OPNodeFlags::setTimeDep(1) in your cook function. To do this in an operator you'd do something like this->flags().setTimeDep(1) Thanks a lot for such a quick reply graham. Should I add this in the code tab of the operator ( i mean the window that comes when we select Type Properties ).? And the code should be something like this, right.? node = hou.pwd() node.setTimeDep(1) If not, correct me please..? Cheers. Quote Link to comment Share on other sites More sharing options...
graham Posted June 25, 2010 Share Posted June 25, 2010 I'm confused. Is this regular Python SOP or an operator written in the HDK using HOM? This is the HDK forum but now I believe you are just talking about a regular Python SOP operator. If it's a regular Python SOP then all you need to do to force time dependency is throw this in the Python code somewhere in the Code tab of the Operator Type Properties. It will make sure the node is evaluated every frame. f= hou.frame() If it's an HDK op then you'll have to do what I mentioned above. Quote Link to comment Share on other sites More sharing options...
Homguy Posted June 25, 2010 Author Share Posted June 25, 2010 (edited) Oops.. Sorry graham.. I dint notice that im in HDK forum.. Mine is a regular Python SOP. And, i already have hou.frame() in my code. But still the parameter is not updating every frame when i hit the play button( in the timeline ). When i hit the stop button, then the parameter updates to the proper value. The full code is not with me right now. I will post the code soon and then kindly help me solving it. Once again, sorry for posting it in a wrong page. Edited June 25, 2010 by Homguy Quote Link to comment Share on other sites More sharing options...
graham Posted June 25, 2010 Share Posted June 25, 2010 If you MMB on your node does it show as Time Dependent? Also, do you have Continuos parameter updates enabled? http://www.sidefx.com/docs/houdini10.0/basics/cooking Quote Link to comment Share on other sites More sharing options...
Homguy Posted June 25, 2010 Author Share Posted June 25, 2010 Thanks for the link graham. I will check these things and get back to you. Cheers. Quote Link to comment Share on other sites More sharing options...
Homguy Posted June 26, 2010 Author Share Posted June 26, 2010 Turning on "Continuous parameter updates" option solved the issue. Thanks graham. And this the code my python node has. # This code is called when instances of this SOP cook. geo = hou.pwd().geometry() # Add code to modify the contents of geo. #current node n its parameter curr_node = hou.pwd() ind = curr_node.parm("index") t = curr_node.parm("test") #another node n its parameters bs = hou.node("../aboveNode") num = bs.evalParm("aParameter") #break value n frame value brk = 1 f = hou.frame() for n in range(num): if(brk == 1): v = bs.evalParm("blend" + str(n)) if(v == 1.0): value = n+f-f #added n sub the frame number to recook the node every frame. but not working ind.set(value) brk = 0 Although it has hou.frame() in it and on MMB click shows time dependent, it doesnt update the index parameter every frame. Is there anyway to make it update every frame without turning on Continuous parameter updates option.? Quote Link to comment Share on other sites More sharing options...
graham Posted June 26, 2010 Share Posted June 26, 2010 It's like that by design. When continuous updates are off, the UI doesn't need to be redrawn every frame as the animation plays so performance is improved at the cost of parameters not having their values displayed. Setting it on or off is just a UI thing and does not actually effect your nodes. 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.