diff --git a/functions/uv_tools.py b/functions/uv_tools.py index a72216a..d93e5e7 100644 --- a/functions/uv_tools.py +++ b/functions/uv_tools.py @@ -31,6 +31,10 @@ class AvatarToolkit_OT_AlignUVEdgesToTarget(Operator): for obj in context.view_layer.objects.selected: if obj.type != "MESH": return False + if not context.space_data: + return False + if not context.space_data.show_uvedit: + return False return True def execute(self, context: Context): diff --git a/ui/uv_panel.py b/ui/uv_panel.py index 950d9de..8221e31 100644 --- a/ui/uv_panel.py +++ b/ui/uv_panel.py @@ -14,6 +14,4 @@ class UVTools_PT_MainPanel(bpy.types.Panel): def draw(self: bpy.types.Panel, context: bpy.types.Context): layout = self.layout - sima = context.space_data - if sima.show_uvedit: - draw_title(self) \ No newline at end of file + draw_title(self) \ No newline at end of file diff --git a/ui/uv_tools.py b/ui/uv_tools.py index 89b24f4..d5a6d83 100644 --- a/ui/uv_tools.py +++ b/ui/uv_tools.py @@ -18,7 +18,5 @@ class UVTools_PT_Tools(bpy.types.Panel): def draw(self, context: bpy.types.Context): layout = self.layout - sima = context.space_data - if sima.show_uvedit: - row = layout.row(align=True) - row.operator(AvatarToolkit_OT_AlignUVEdgesToTarget.bl_idname, text=t("avatar_toolkit.align_uv_edges_to_target.label"), icon='GP_MULTIFRAME_EDITING') \ No newline at end of file + row = layout.row(align=True) + row.operator(AvatarToolkit_OT_AlignUVEdgesToTarget.bl_idname, text=t("avatar_toolkit.align_uv_edges_to_target.label"), icon='GP_MULTIFRAME_EDITING') \ No newline at end of file