diff options
author | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-07-23 02:23:53 +0300 |
---|---|---|
committer | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-07-23 02:25:35 +0300 |
commit | be6738522d23ff5c8ab594a28f024232e11e507a (patch) | |
tree | c5161a55e83ecfea7cdbdbbdfbd5c2399734a776 /mesh_looptools.py | |
parent | e27ec695f107371ee811f8d9488ebaf7672fb9be (diff) |
Addon: LoopTools: Fixed select active Annotation
Diffstat (limited to 'mesh_looptools.py')
-rw-r--r-- | mesh_looptools.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/mesh_looptools.py b/mesh_looptools.py index dc37e4dc..9454f354 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") |