[Bf-extensions-cvs] [be673852] master: Addon: LoopTools: Fixed select active Annotation
Spivak Vladimir cwolf3d
noreply at git.blender.org
Tue Jul 23 01:25:48 CEST 2019
Commit: be6738522d23ff5c8ab594a28f024232e11e507a
Author: Spivak Vladimir (cwolf3d)
Date: Tue Jul 23 02:23:53 2019 +0300
Branches: master
https://developer.blender.org/rBAbe6738522d23ff5c8ab594a28f024232e11e507a
Addon: LoopTools: Fixed select active Annotation
===================================================================
M mesh_looptools.py
===================================================================
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")
More information about the Bf-extensions-cvs
mailing list