diff --git a/mesh_looptools.py b/mesh_looptools.py index dc37e4dc4be838ba3778fb472893fd83d16e1bc6..9454f35494342226deb7461d026927778cc92546 100644 --- a/mesh_looptools.py +++ b/mesh_looptools.py @@ -61,10 +61,11 @@ looptools_cache = {} def get_annotation(self, context): - if 'Annotations' in bpy.data.grease_pencils.keys(): + try: + layer = bpy.data.grease_pencils[0].layers.active return True - else: - self.report({'WARNING'}, "Annotation not found") + except: + self.report({'WARNING'}, "active Annotation not found") return False # force a full recalculation next time @@ -2840,7 +2841,7 @@ def gstretch_get_strokes(self, context): gp = get_annotation(self, context) if not gp: return(None) - layer = bpy.data.grease_pencils["Annotations"].layers["Note"] + layer = bpy.data.grease_pencils[0].layers.active if not layer: return(None) frame = layer.active_frame @@ -3818,15 +3819,15 @@ class Flatten(Operator): # gstretch operator class RemoveGP(Operator): bl_idname = "remove.gp" - bl_label = "Remove GP" + bl_label = "Remove Annotation" bl_description = "Remove all Annotation Strokes" bl_options = {'REGISTER', 'UNDO'} def execute(self, context): - if get_annotation(self, context): - bpy.data.grease_pencils["Annotations"].layers["Note"].clear() - else: + try: + bpy.data.grease_pencils[0].layers.active.clear() + except: self.report({'INFO'}, "No Annotation data to Unlink") return {'CANCELLED'} @@ -3836,7 +3837,7 @@ class RemoveGP(Operator): class GStretch(Operator): bl_idname = "mesh.looptools_gstretch" bl_label = "Gstretch" - bl_description = "Stretch selected vertices to Annotation stroke" + bl_description = "Stretch selected vertices to active Annotation stroke" bl_options = {'REGISTER', 'UNDO'} conversion: EnumProperty( @@ -3973,7 +3974,7 @@ class GStretch(Operator): row.prop(self, "lock_z", text="Z", icon='UNLOCKED') col_move.prop(self, "influence") col.separator() - col.operator("remove.gp", text="Delete GP Strokes") + col.operator("remove.gp", text="Cancel and delete annotation strokes") def invoke(self, context, event): # flush cached strokes @@ -5042,7 +5043,6 @@ class LoopToolsProps(PropertyGroup): default=False ) - # draw function for integration in menus def menu_func(self, context): self.layout.menu("VIEW3D_MT_edit_mesh_looptools")