diff options
author | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-07-25 00:59:33 +0300 |
---|---|---|
committer | Spivak Vladimir (cwolf3d) <cwolf3d@gmail.com> | 2019-07-25 01:00:13 +0300 |
commit | 705801c799b0a1ab20249163633c2a2707e08fe1 (patch) | |
tree | c9aa9bf437aa54919ac7218eb7e2e2e771688657 /mesh_looptools.py | |
parent | 4d0e15ae1d5d54d9b1af826b5c8a218010471424 (diff) |
Addon: LoopTools: GStretch: Fixed work without Annotation
Diffstat (limited to 'mesh_looptools.py')
-rw-r--r-- | mesh_looptools.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/mesh_looptools.py b/mesh_looptools.py index 9454f354..383bbbed 100644 --- a/mesh_looptools.py +++ b/mesh_looptools.py @@ -61,11 +61,14 @@ looptools_cache = {} def get_annotation(self, context): - try: - layer = bpy.data.grease_pencils[0].layers.active - return True - except: - self.report({'WARNING'}, "active Annotation not found") + if self.use_annotation: + try: + strokes = bpy.data.grease_pencils[0].layers.active.active_frame.strokes + return True + except: + self.report({'WARNING'}, "active Annotation strokes not found") + return False + else: return False # force a full recalculation next time @@ -3933,6 +3936,10 @@ class GStretch(Operator): "stroke", default='regular' ) + use_annotation: BoolProperty( + name="Use Annotation", + default=True + ) @classmethod def poll(cls, context): @@ -3942,7 +3949,10 @@ class GStretch(Operator): def draw(self, context): layout = self.layout col = layout.column() - + + col.separator() + col.prop(self, "use_annotation") + col.separator() col.prop(self, "method") col.separator() @@ -4500,6 +4510,7 @@ class VIEW3D_PT_tools_looptools(Panel): # gstretch settings if lt.display_gstretch: box = col.column(align=True).box().column() + box.prop(lt, "gstretch_use_annotation") box.prop(lt, "gstretch_method") col_conv = box.column(align=True) @@ -4971,6 +4982,10 @@ class LoopToolsProps(PropertyGroup): "Pencil stroke", default='regular' ) + gstretch_use_annotation: BoolProperty( + name="Use Annotation", + default=False + ) # relax properties relax_input: EnumProperty(name="Input", |