LaidlawFX Posted June 23, 2017 Share Posted June 23, 2017 (edited) 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 June 23, 2017 by LaidlawFX Similar Thread Found Quote Link to comment Share on other sites More sharing options...
Atom Posted June 23, 2017 Share Posted June 23, 2017 I believe the python node will naturally cache the last generate. Try dropping in a button and activating code. ap_python_generate_button.hiplc 1 Quote Link to comment Share on other sites More sharing options...
LaidlawFX Posted June 23, 2017 Author Share Posted June 23, 2017 (edited) 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 June 23, 2017 by LaidlawFX Added example file. Quote Link to comment Share on other sites More sharing options...
Atom Posted June 23, 2017 Share Posted June 23, 2017 Why not use a standard FileCache node? Wouldn't Save To Disk simply be the same implementation as your Python button? Quote Link to comment Share on other sites More sharing options...
LaidlawFX Posted June 23, 2017 Author Share Posted June 23, 2017 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. Quote Link to comment Share on other sites More sharing options...
Atom Posted June 23, 2017 Share Posted June 23, 2017 I guess you could bypass the node after it kicks out it's geometry and is cached to disk. Then on creation should not run. But I have not tested that. 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.