3
$\begingroup$

Is it possible to access operator's class for builtin operators?

For addons, I can either import them from addon's module from node_wrangler.operators import NWLazyMix or from bpy.types -> bpy.types.NODE_OT_nw_lazy_mix.

I wanted to use operator's class to override .execute or modal to have a general solution to solve issues like this and this.

$\endgroup$

1 Answer 1

2
$\begingroup$

No Idea, how to access the class, but if the operator is written in Python, you can find its code. There is a bunch of operators in Blender's installation folder(on Windows they are at C:\Program Files\Blender Foundation\Blender 4.0\4.0\scripts\startup\bl_operators) So you can just copy the code defining the operator, change it and register it again. This works as we see from the tooltip that I changed for Select Camera operator:

enter image description here

If the operator is not written in Python, it seems it's no longer possible to override it this way in recent versions:

enter image description here

That's what happens if I try to register an operator with mesh.primitive_cube_add bl_idname.

It used to be possible in previous versions and was useful in some cases. You can still write a new operator entirely and change the UI and keymap to replace some operator, but that's a lot of work.

$\endgroup$
1
  • $\begingroup$ Yeah, unfortunately it seems only pure python operators classes are accessible, not the C-defined operators. $\endgroup$ Commented Dec 3, 2023 at 20:22

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.