Jump to content

Recook python SOP


Nerox

Recommended Posts

I have a Python SOP which sometimes doesn't seem to recook when it, in my opinion, should. I wonder if there is code available which can handle this? I imagine a flag on the node which can be set in order to trigger a cook. This can happen when the incoming geometry changes or when a parameter is updated for instance.

You would expect that this is a default thing, but it doesn't seem so.

Link to comment
Share on other sites

Can you provide an example file of it not cooking. You can force a node to recook by calling hou.Node.cook(True). You could call this from a node event callback on a parm tuple change but it shouldn't really be necessary.

Link to comment
Share on other sites

Frankly I haven't been able to reproduce this, I might have been caused by something else. Sadly I don't know what, at the same time I ran in to viewport redraw issues. At a certain point I had to reboot for something else and both problems vanished... That's actually a good thing :-), never the less it would have been nice if I knew the cause.

Link to comment
Share on other sites

  • 4 weeks later...

I have found one of the easiest ways to get a python node to recook is to add an arbitrary button to the parms. It does not have to have a callback script or anything on it, but when you click it it will cause a recook.

Nice! :-)

Thanks for sharing Klockworks

Link to comment
Share on other sites

  • 1 year later...

hmmm... I'd love to have somebody revisit this issue as I have a python sop that loads transforms from an alembic cache and I need it to recook for every frame but it won't.

I even have a parameter scripted as $FF, plus if I query the node to see if it's time dependent or not it returns True. It'll only cook if it's display/template flag is on, which is not always the case.

Cheers

Edited by rafaelfs
Link to comment
Share on other sites

I do evaluate the parm that contains the $FF like this:


myTime = node.evalParm('frame')
[/CODE]

I just tested with adding the useless call to hou.frame() and still it'll only recook if the node is templated or displayed.

Cheers

Edited by rafaelfs
Link to comment
Share on other sites

Sorry, I missed that part about display/template above. That makes sense since Houdini isn't going to cook a node it doesn't have to. If there is nothing referencing the node that needs it to cook and it isn't somehow being displayed then I wouldn't expect it to get cooked since it would essentially be a waste of resources.

Link to comment
Share on other sites

But I do have some other nodes down the chain that are referencing parameters in my python SOP and it still won't cook.

I had a similar setup that was working in 12.1, where I was grabbing the alembic transforms via an alembic CHOP. I would later reference copy the paramter with the chop() expression and still It would return current frame transforms even if the referenced node wasn't being displayed and even if it was frozen by a timeshift SOP. Was it mere luck?

Link to comment
Share on other sites

I read the sticky note in your file, and it's supposed to behave that way. You have nothing referencing the data of "cook_test2" and there's nothing being displayed that uses the output of cook_test2. You have a ch("../cook_test2/time") but that refers to the *parameter* time, not to the data of cook_test2.

  • Like 1
Link to comment
Share on other sites

Yes, you need to force something in your session to actually use the geometry generated by your Python SOP in order for it to evaluate.

Ok, I've worked this into my code, seems to work great, but I'll need to further test next week :)

Thanks a lot, guys!

Cheers

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...