fix context issues and drawing

This commit is contained in:
989onan
2024-09-09 21:26:45 -04:00
parent fba59faa50
commit 94dcc3ed7a
3 changed files with 7 additions and 7 deletions
+4
View File
@@ -31,6 +31,10 @@ class AvatarToolkit_OT_AlignUVEdgesToTarget(Operator):
for obj in context.view_layer.objects.selected: for obj in context.view_layer.objects.selected:
if obj.type != "MESH": if obj.type != "MESH":
return False return False
if not context.space_data:
return False
if not context.space_data.show_uvedit:
return False
return True return True
def execute(self, context: Context): def execute(self, context: Context):
-2
View File
@@ -14,6 +14,4 @@ class UVTools_PT_MainPanel(bpy.types.Panel):
def draw(self: bpy.types.Panel, context: bpy.types.Context): def draw(self: bpy.types.Panel, context: bpy.types.Context):
layout = self.layout layout = self.layout
sima = context.space_data
if sima.show_uvedit:
draw_title(self) draw_title(self)
-2
View File
@@ -18,7 +18,5 @@ class UVTools_PT_Tools(bpy.types.Panel):
def draw(self, context: bpy.types.Context): def draw(self, context: bpy.types.Context):
layout = self.layout layout = self.layout
sima = context.space_data
if sima.show_uvedit:
row = layout.row(align=True) 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') row.operator(AvatarToolkit_OT_AlignUVEdgesToTarget.bl_idname, text=t("avatar_toolkit.align_uv_edges_to_target.label"), icon='GP_MULTIFRAME_EDITING')