[Bf-blender-cvs] [2f963f1c581] greasepencil-object: GPencil: Fix error in Bake when no mesh is selected

Antonio Vazquez noreply at git.blender.org
Thu Apr 2 18:22:59 CEST 2020


Commit: 2f963f1c5814ec643d7f0f6eff61ba3dc1b4f870
Author: Antonio Vazquez
Date:   Thu Apr 2 18:22:52 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2f963f1c5814ec643d7f0f6eff61ba3dc1b4f870

GPencil: Fix error in Bake when no mesh is selected

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

M	release/scripts/startup/bl_operators/gpencil_mesh_bake.py

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

diff --git a/release/scripts/startup/bl_operators/gpencil_mesh_bake.py b/release/scripts/startup/bl_operators/gpencil_mesh_bake.py
index f6f29110e29..e2056b03311 100644
--- a/release/scripts/startup/bl_operators/gpencil_mesh_bake.py
+++ b/release/scripts/startup/bl_operators/gpencil_mesh_bake.py
@@ -86,7 +86,19 @@ class GPENCIL_OT_mesh_bake(Operator):
         unit='LENGTH',
     )
 
+    @classmethod
+    def poll(self, context):
+        ob = context.active_object
+        return ((ob is not None) and
+                (ob.type == 'MESH') and
+                (context.mode == 'OBJECT'))
+
     def execute(self, context):
+        # ob = context.object
+        # if ob is None or ob.type != 'MESH':
+        #     self.report({'INFO'}, "No Mesh selected to bake")
+        #     return {'CANCELLED'}
+
         bpy.ops.gpencil.bake_mesh_animation(
             frame_start=self.frame_start,
             frame_end=self.frame_end,



More information about the Bf-blender-cvs mailing list