Allow Quick Favorites menu to execute Python Files
Situation
Recently I've been doing a lot of repetitive work and I made myself a few custom operators to do very simple things such as running a bunch of existing operators with specific settings.
The simplest ones I made were to just make a first UV unwrap and then pack islands, the other is just to switch the local view to another selected object:
I selected the parts of the code that actually "do" what I need. You can see it doesn't take much, but I need way more because of how I need to wrap this all up into operators. Imagine for more complicated things.
But on top of that, for each new operator, I need to make changes in multiple places, and register them again at each modification or file opening.
Proposed Solution
What if, instead of having all that, we could be able to write as little as what we need in the text editor:
Then we could Right 🖱️ > Assign to Quick Favorites (and why not assign a shortcut while we're at it?)
The gain in efficiency in making those quick temporary tools is pretty significant, updating or making more of them is also way quicker.
Pictures being worth a thousand words, the idea would be to go from this:
To this:
Further considerations:
-
I suspect how it would function under the hood is the QF menu entry actually runs a form of super-operator which then runs whatever is in the targeted py file.
In that regard, I doubt it can be as simple as I hope in my second screenshot. We would probably steel need an
execute()function and apoll()to make sure we have the right context. But:- Is it yet possible? I'll take it!
- Could it be envisionned to have that also simplified? For example:
-
I thought it would be nice not having to
import bpyall the time (for maximized efficiency), I hoped it is possible to have this Scripted Quick Favorites system to somehow have bpy imported for all scripts it runs.- Perhaps it would prevent other imports to be done manually if needed?
- If so: the system aiming for speed and simplicity over versatility, is it a reasonable tradeoff ?
0 Comments