Python cook only once.

   7182   4   1
User Avatar
Member
20 posts
Joined: July 2008
Offline
I have made a Python SOP at object level that sets up a few hundred nodes for later use in the animation.
I do not want this script to be ran every time I change the frame counter. Is there any way, except for changing the script to see if it already ran, I can control the cooking conditions, like only on change of a certain parameter?
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Your sop/object will recook every frame change if it is Time Dependent. If you MMB on the node it will tell you if it is dependent or not. If you make your python operator non time dependent it will not recook every frame change.

Accessing things like the frame number, animated parameters, fetching transforms or distances to nodes that are animated will all result it it becoming dependent.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
1390 posts
Joined: July 2005
Offline
paleajed
I have made a Python SOP at object level that sets up a few hundred nodes for later use in the animation.
I do not want this script to be ran every time I change the frame counter. Is there any way, except for changing the script to see if it already ran, I can control the cooking conditions, like only on change of a certain parameter?

If I understand what you're after correctly, this is not a job for a PythonSOP. You can add simple Null object on /obj level, edit its definition, add a new script in Script Tab, and connect it via callback script with custom button added previously to a Null object. This is just one way to use custom scripts in Houdini and there are few others mentioned in HOM help page.

PythonSOP was meant to proceed geometry and it does cook every frame (I've never could make PythonSOP time independent like Graham suggested in other way then locking node or making some condition in python code. This could be handy option for sure.)
User Avatar
Member
7740 posts
Joined: July 2005
Offline
SYmek
(I've never could make PythonSOP time independent like Graham suggested in other way then locking node or making some condition in python code. This could be handy option for sure.)

Well, there were a few bugs fixed in H9.5
User Avatar
Member
1390 posts
Joined: July 2005
Offline
edward
SYmek
(I've never could make PythonSOP time independent like Graham suggested in other way then locking node or making some condition in python code. This could be handy option for sure.)

Well, there were a few bugs fixed in H9.5

How great! I've just checked and indeed it seems to cook only if needed in H9.5. I didn't know this was fixed ( I wasn't even considering it as a bug).

Thanks Edward (and Graham)!
  • Quick Links