← All ideas
  • Published 31 Jan 2025

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:

2025-01-31_09h12_blender_2623.png

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:

2025-01-31_09h18_blender_2624.png

Then we could Right 🖱️ > Assign to Quick Favorites (and why not assign a shortcut while we're at it?)

2025-01-31_09h20_blender_2626.png

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:

2024-08-27-1259 (1).png

To this:

2024-08-27-1259 excalidraw proposition.png

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 a poll() 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:

    2025-01-31_09h43_blender_2627.png

  • I thought it would be nice not having to import bpy all 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.

    1. Perhaps it would prevent other imports to be done manually if needed?
    2. If so: the system aiming for speed and simplicity over versatility, is it a reasonable tradeoff ?

Link to schematics

100%

Development Status: Open

Upvote 7 Downvote 0
Lauloque
31 Jan 2025

0 Comments