Jump to content

Python Sop with Code Section that creates Geometry, cook on button press


LaidlawFX

Recommended Posts

Hello,

Currently I have a python sop where in the code section it creates geometry each time the node cooks. I would like it to only cook/update on a button press, and cache it in-between pressings. Is this possible, and how would you structure the code to do it?

Thanks,

-Ben

Edit: https://www.sidefx.com/forum/topic/25493/ - Similar thread. 

Edited by LaidlawFX
Similar Thread Found
Link to comment
Share on other sites

The button call, the print and other functions run via button call. Thanks :). However, the geometry creation part does not work. It errors on the Geometry Creation. 

GeometryPermissionError: Geometry is read-only.

Edit: I attached an example hip file with the original concept and the new button update.

PythonSopCreateGeo.hip

Edited by LaidlawFX
Added example file.
Link to comment
Share on other sites

Overall: I'm trying to limit unnecessary cooks of this create geometry generator as it is relatively expensive. I don't want traditional work, or even on creation, to cook the node as you will incur this cost. 

As for FileCache node, as far as this system, that will happen down the road. I just wanted to clean up this code/generator as much as possible internally. 

I was thinking about using a switching mechanism between a null and the generator, with a following cache node to store it after the cook, but that is a bunch of events that needs to happen. I was kind of hoping there was a python with button equivalent for it. 

  

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...