Ability to overwrite builtin operators
Since Blender 3.5 we are no longer allowed to override builtin operators by registering one with the same name. Instead a RuntimeError is raised
Error: Registering operator class: '<classname>', bl_idname '<bl_idname>' could not be unregistered
.
I have a user-case where I want the old behaviour. When using
bqt
there are some buttons and functionality that no longer works as intended, I would like to "reimplement" some of them by replacing their functionality while keeping the button/menu location.
As an example the fullscreen button (Window -> Toggle Window Fullscreen) no longer works (due to the window being wrapped in QT), I would like to replace the functionality of the button but keep it in the same location so if someone relies on muscle memory to use the button it is still in the same location.
This operator raises a RuntimeError as it's
bl_idname
is in use by a builtin operator, I want this operator to called over builtin one when whatever calls the operator is used.
class FullscreenOperator(bpy.types.Operator):
bl_idname = "wm.window_fullscreen_toggle"
bl_label = "Toggle Window Fullscreen"
bl_description = "Toggle the current window full-screen"
def execute(self, context):
print("Fullscreen toggle")
return {"FINISHED"}
0 Comments