Is there a way to build a comprehensive list of operator overrides?

Operator overrides are awesome for using overrides without the need to destructively set everything up beforehand (selecting objects, etc.) . However the documentation is not really clear on how the override dictionary should look like, and it can differ a lot from operator to operator. I would like to know if there has already been an effort made to build a list of operator overrides, or if it is possible and doable to generate it from the source code ?

FWIW I’ve started a Q&A on BSE where I’m planning on gathering it in one place. If I could do that not-manually that would be awesome since there are 2 000+ of them.

Cheers

There is not comprehensive list of required operator contexts, so far as I am aware. There should be a way to compile a list programmatically, but it would not be easy- some operators have very complex polling methods that aren’t a simple “return context.area==X”.

For reference, I recently posted a short walkthrough on how to find any operator’s required context- you’d need an automatic way to do all of this, with additional logic to parse out the poll function itself and structure that information into something that a human could read and understand. Not impossible, but no walk in the park either.

Thanks for the feedback. I feared that would not be that easy, but maybe one could parse operator functions and check if eg it contains Object *ob = ED_object_active_context(C); then the override should contain a key named "object"

I’m using the exact method you described in your linked post currently but I’m not yet that familiar with the source code so it takes closer to 5 min than to 15 seconds for me :stuck_out_tongue: