Hi, I’m encountering an issue with the bpy.ops.workspace.reorder_to_front()
function in the latest Blender version. This code worked fine in Blender 3.0 but now seems to be broken. I’m trying to reorder a specific workspace to the front of the list. Here’s the simplified code I’m using:
import bpy
from bpy.types import Operator
class CustomAddAndReorderWorkspace(Operator):
"""Add and reorder a custom workspace"""
bl_idname = "clarsen.add_reorder_workspace"
bl_label = "Add Workspace"
def execute(self, context):
if bpy.context.workspace.name == "Archiblender":
self.report({'ERROR'}, "Project already started.")
else:
bpy.ops.workspace.append_activate(idname="Archiblender", filepath=bpy.utils.user_resource("SCRIPTS", path="addons\\Archiblender.blend"))
# Reorder Archiblender workspace to front
available_workspaces = bpy.data.workspaces
bpy.ops.workspace.reorder_to_front({"workspace": available_workspaces["Archiblender"]})
return {"FINISHED"}
# Registration and main function
def register():
bpy.utils.register_class(CustomAddAndReorderWorkspace)
def unregister():
bpy.utils.unregister_class(CustomAddAndReorderWorkspace)
if __name__ == "__main__":
register()