Is it safe to Overwrite an built-in bpy.ops.Operator?

I would very much like to detect execution of some built-in operators (such as mesh.primitive_cube_add).
I found that if I register_class a Operator class with the same bl_idname, I can easily overwrite the Operator.
Is this safe?
Is there any best practices?

1 Like

If Blender code or another addon relies and this operator doing a specific thing, then overriding it can break that. Other than that I’m not aware of anything that would make it unsafe.

It’s not a particularly elegant way to do things, but if you really need to detect this there may not exist a better solution at the moment.

2 Likes