0
$\begingroup$

I'm writing an Add-on which imports high resolution parameterized plant models. I create Panel which presents the configurable parameters.

enter image description here

Because changing the plant model is expensive, I want to buffer or shadow changes to the property and have the user press an "Update" button/operator (not shown). If they don't press the button, I need to revert the changes to the properties. so they are correct the next time the plant is selected.

I've tried creating a temporary set of the same properties, but I keep running into the limitation of the draw() (and poll()) context being prevented from modifying ID properties - so I can't create the copy.

I suspect I'm missing something obvious as this can't be all that uncommon. How can I save off the state of active object property group prior to draw() and restore when no longer active if the user doesn't commit the changes via an update operator?

For example, in the screenshot above, the user might change the Season from Summer to Fall, and then change their mind, deselect the plant, the panel disappears. When they select the plant again, the Season should display Summer, not Fall.

$\endgroup$
0
$\begingroup$

What is working for me now is adding the property group to the object type twice as my_props and my_props_shadow. The UI works with my_props_shadow. A reset operator copies my_props back to my_props_shadow. These seems clunky and I feel like I'm unnecessarily polluting the object namespace - but I haven't found something better yet.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.