- Add an RNA property for toggling autopack on and off.
- Disable manual packing operators in the interface while autopacking is on (but leave it accesible via the python api)
- Manual packing operators don't modify the autopack state anymore
Details
Diff Detail
Event Timeline
| source/blender/editors/space_info/info_ops.c | ||
|---|---|---|
| 197–200 | Thinking about this, I would not have this poll function to avoid breaking python scripts that depend on this behavior. The operators could be set to show inactive int he menu, (prop.active = False), but I would still keep them working when called from python scripts even if autopack is enabled. | |
Added changes as suggested by @Brecht Van Lommel (brecht), from my side good to go now i guess!
Using an icon to mimic toggle functionality, and more specifically misusing an icon with a previous connotation (Save icon) felt like a shady stunt on my behalf right from where I went down that way of implementing it, so I felt like I needed to review and redo this once more ...
- I replaced the icon-toggle hack with an actual RNA property toggle (hope this is the correct term)
- I removed the toggle operator, as it's not needed anymore (to me the RNA property seems a better way to represent this process anyway)
- I tried quite a few ways to carry over the included "pack all" operation that the toggle operator performed on toggling autopack ON to the RNA property setter code, but failed (I couldn't really get hold of some context (ot, reports, etc.) to run the packAll functionality against, maybe my failure was "by design" though, I don't understand the architecture well enough yet, I must admit).
You indeed can't access context or reports from RNA property set functions. They are supposed to be context-less and require no user interaction to make them work well for things like scripting, batch editing, etc. This autopack thing is kind of a hybrid property-operator thing that we don't have a good fit for, so this is why I suggested to have both the operator and property, and then glue them together in the python UI code.
I'll commit that version of the patch with some tweaks.
Closed by commit rB632c29fef3a5 (authored by @Simon Repp (simonrepp), committed by @Brecht Van Lommel (brecht)).