Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2019-05-04 17:54:56 +0300
committerSpivak Vladimir (cwolf3d) <cwolf3d@gmail.com>2019-05-04 17:54:56 +0300
commitb23f15603088f2e382ce9a53093b58debc3d70e6 (patch)
tree61f736d9dece1bd4a3053d396477bf5a2fca38cf /mesh_looptools.py
parent1efa00c323609a571fb1456a02f39e6909c4500d (diff)
LoopTools: Gstretch fix.
Grease pencil must have name 'GPencil'. Script take only the first strokes.
Diffstat (limited to 'mesh_looptools.py')
-rw-r--r--mesh_looptools.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/mesh_looptools.py b/mesh_looptools.py
index ef472964..d9348670 100644
--- a/mesh_looptools.py
+++ b/mesh_looptools.py
@@ -61,7 +61,7 @@ looptools_cache = {}
def get_grease_pencil(object, context):
- gp = bpy.data.grease_pencils
+ gp = bpy.context.scene.objects['GPencil']
if not gp:
gp = context.view_layers.grease_pencils
return gp
@@ -2843,13 +2843,13 @@ def gstretch_get_strokes(object, context):
gp = get_grease_pencil(object, context)
if not gp:
return(None)
- layer = context.active_gpencil_layer
+ layer = gp.data.layers[0]
if not layer:
return(None)
- frame = context.active_gpencil_frame
+ frame = layer.frames[0]
if not frame:
return(None)
- strokes = context.editable_gpencil_strokes
+ strokes = frame.strokes
if len(strokes) < 1:
return(None)
@@ -3828,8 +3828,15 @@ class RemoveGP(Operator):
def execute(self, context):
- if context.gpencil_data is not None:
- bpy.ops.gpencil.data_unlink()
+ gp = bpy.context.scene.objects['GPencil']
+ if len(gp.data.layers[0].frames) is not 0:
+ bpy.ops.object.mode_set(mode='OBJECT')
+ bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
+ gp.select_set(True)
+ bpy.context.view_layer.objects.active = gp
+ bpy.ops.object.mode_set(mode='PAINT_GPENCIL')
+ bpy.ops.gpencil.active_frame_delete('INVOKE_REGION_WIN')
+ bpy.ops.object.mode_set(mode='OBJECT')
else:
self.report({'INFO'}, "No Grease Pencil data to Unlink")
return {'CANCELLED'}