Div Posted March 7, 2009 Share Posted March 7, 2009 Hi all, I'm working on a python sop, to move points along the time, and i've got a problem : the sop is not cooked at every frame, how can i change that ? how can i force it to recook at each frame ??? I've searched on this forums and found old solutions which d'ont works within houdini 9.5 ( for example flags.setTimeDep() etc....) Thanks a lot. Quote Link to comment Share on other sites More sharing options...
mic Posted March 7, 2009 Share Posted March 7, 2009 (edited) Hi all,I'm working on a python sop, to move points along the time, and i've got a problem : the sop is not cooked at every frame, how can i change that ? how can i force it to recook at each frame ??? I've searched on this forums and found old solutions which d'ont works within houdini 9.5 ( for example flags.setTimeDep() etc....) Thanks a lot. hi, can't check right now, but maybe this trick will be useful - put somewhere 0*$T. or in python terms, 0*hou.frame() .. Edited March 7, 2009 by mic Quote Link to comment Share on other sites More sharing options...
Div Posted March 7, 2009 Author Share Posted March 7, 2009 Good idea, but unfortunatly it doesn't works... Quote Link to comment Share on other sites More sharing options...
mic Posted March 7, 2009 Share Posted March 7, 2009 Good idea, but unfortunatly it doesn't works... hmm and the hou.Node cook() method (i found it in documentation) also doesn't help? Quote Link to comment Share on other sites More sharing options...
Div Posted March 7, 2009 Author Share Posted March 7, 2009 (edited) I think that's the good function, but I'm trying it but i'm not able to use it correctly.... Argh! The doc says cook(self, force=False, frameRange=()) So i use it like this, but this returns an error... I don't understand why... start = 1 end = 200 force = True frameRange = (start, end) hou.pwd().cook(force, frameRange) //edit : this works with the python shell ( hou.node("obj/geo1/myNode1/").cook(True, frameRange) ), not inside the python sop Edited March 7, 2009 by Div Quote Link to comment Share on other sites More sharing options...
graham Posted March 8, 2009 Share Posted March 8, 2009 (edited) Getting python sops to be time dependent can be tricky. The easiest way to force time dependency is to just do something like: frame = hou.frame() Causing the cook function to evaluate the frame number will always cause the node to become time dependent. Depending on what it is I'm doing I'll sometimes have a toggle on my SOP that will toggle it on/off depending on how my sop is designed or what I would like it to be doing: if pwd().parm("force_timedep"): frame = hou.frame() Edited March 8, 2009 by graham Quote Link to comment Share on other sites More sharing options...
Div Posted March 9, 2009 Author Share Posted March 9, 2009 (edited) I agree with your method but it doesn't works. I explain : my python sop read the position of the point, and add to it a processed value. But the python sop doesn't seems to read the point position for each frame, only for the first one, even if i put somewhere in my code hou.frame(), even if i add to the position a random value with hou.frame() as a seed... Example Of what i'm trying to achieve: #assume that pt is the point. ptPosX = pt.position()[0] ptPosX = ptPosX + vX newPos = (ptPosX, ptPosY, ptPosZ) pt.setPosition(newPos) Edited March 9, 2009 by Div Quote Link to comment Share on other sites More sharing options...
graham Posted March 10, 2009 Share Posted March 10, 2009 This is to be expected since it's essentially wanting to be recursive and use it's gdp value from the previous frame which no SOPs really allow. The only way to do that is to get some sort of SOP Solver simulation involved, or maybe write out to disk files with all the positions after each cook. You could probably try and do something with the Feedback proto install SOP. It's specially designed to do this type of thing. Quote Link to comment Share on other sites More sharing options...
Div Posted March 10, 2009 Author Share Posted March 10, 2009 Sorry to ask you this, but i don't really understand the "Feedback proto install SOP", I don't find anything similar in the doc, are you talking about the Feedback CHOP ? Quote Link to comment Share on other sites More sharing options...
graham Posted March 10, 2009 Share Posted March 10, 2009 Hmm, there seems to be no documentation whatsoever for proto install or the operators. Oh well. Proto install operators are operators that come with Houdini but are not in the main build because they aren't supported/tested (I think?). You can manually install them by running the "proto_install" command from a shell that has the Houdini environment initialized. This loads up the proto install app and you can choose to install certain operators and where to install them. In this case you could install SOP_Feedback and give it a test. 1 Quote Link to comment Share on other sites More sharing options...
Div Posted March 11, 2009 Author Share Posted March 11, 2009 Thanks a lot for your time... I will give it a try. Quote Link to comment Share on other sites More sharing options...
schiho Posted February 23, 2015 Share Posted February 23, 2015 Any results? Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted February 25, 2015 Share Posted February 25, 2015 As was mention above, putting simple hou.frame() will work. Don't know why you have problems with that. For example: node = hou.pwd() geo = node.geometry() # Add code to modify contents of geo. for point in geo.points(): pos = point.position() pos += hou.Vector3(0, hou.frame(), 0) point.setPosition(pos) Will make sop time dependent. MMB click on sop and see it at the bottom. If you need geometry from previous cook, then sop solver would be easy and faster, but you can also get geometry from any frame in python. This method was introduced some time ago... Quote Link to comment Share on other sites More sharing options...
Jason Posted February 26, 2015 Share Posted February 26, 2015 If you want a feedback effect in Python (without using a Solver SOP type structure), perhaps you can stash a copy of the geometry in a dictionary that's sitting in the houdini session? Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted February 26, 2015 Share Posted February 26, 2015 Here is an example of simple python based sop solver simple_python_sopsolver.hipnc 1 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.