fix context issues and drawing
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
+1
-3
@@ -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
|
draw_title(self)
|
||||||
if sima.show_uvedit:
|
|
||||||
draw_title(self)
|
|
||||||
+2
-4
@@ -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
|
row = layout.row(align=True)
|
||||||
if sima.show_uvedit:
|
row.operator(AvatarToolkit_OT_AlignUVEdgesToTarget.bl_idname, text=t("avatar_toolkit.align_uv_edges_to_target.label"), icon='GP_MULTIFRAME_EDITING')
|
||||||
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')
|
|
||||||
Reference in New Issue
Block a user