[Bf-blender-cvs] [7d0ad0d4419] greasepencil-object: UI: Check if the material has gpencil data to show panel

Antonio Vazquez noreply at git.blender.org
Tue Jun 12 15:38:53 CEST 2018


Commit: 7d0ad0d4419700bf900c19a62cebaa54f710d1d5
Author: Antonio Vazquez
Date:   Tue Jun 12 15:38:45 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB7d0ad0d4419700bf900c19a62cebaa54f710d1d5

UI: Check if the material has gpencil data to show panel

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

M	release/scripts/startup/bl_ui/properties_material_gpencil.py

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

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 7084dadef82..592c301f646 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -140,6 +140,15 @@ class MATERIAL_PT_gpencil_slots(Panel):
 class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel):
     bl_label = "Surface"
 
+    @classmethod
+    def poll(cls, context):
+        ob = context.object
+        ma = context.object.active_material
+        if ma is None or ma.grease_pencil is None:
+            return False
+
+        return ob and ob.type == 'GPENCIL'
+
     @staticmethod
     def draw(self, context):
         layout = self.layout



More information about the Bf-blender-cvs mailing list