[Bf-extensions-cvs] [705801c7] master: Addon: LoopTools: GStretch: Fixed work without Annotation

Spivak Vladimir cwolf3d noreply at git.blender.org
Thu Jul 25 00:00:22 CEST 2019


Commit: 705801c799b0a1ab20249163633c2a2707e08fe1
Author: Spivak Vladimir (cwolf3d)
Date:   Thu Jul 25 00:59:33 2019 +0300
Branches: master
https://developer.blender.org/rBA705801c799b0a1ab20249163633c2a2707e08fe1

Addon: LoopTools: GStretch: Fixed work without Annotation

===================================================================

M	mesh_looptools.py

===================================================================

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",



More information about the Bf-extensions-cvs mailing list