[Bf-blender-cvs] [a56b024964b] blender2.8: Cleanup: simplify poll function

Campbell Barton noreply at git.blender.org
Sun Dec 2 04:02:27 CET 2018


Commit: a56b024964b186e3ffbc5b234184757d2113a470
Author: Campbell Barton
Date:   Sun Dec 2 13:59:43 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBa56b024964b186e3ffbc5b234184757d2113a470

Cleanup: simplify poll function

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

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 b62b251163e..282f8d77515 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -102,14 +102,14 @@ class MATERIAL_PT_gpencil_surface(GPMaterialButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         ob = context.object
-        if ob is None:
+        if not (ob and ob.type == 'GPENCIL'):
             return False
 
-        ma = context.object.active_material
-        if ma is None or ma.grease_pencil is None:
+        ma = ob.active_material
+        if not (ma and ma.grease_pencil):
             return False
 
-        return ob.type == 'GPENCIL'
+        return True
 
     def draw_header_preset(self, context):
         MATERIAL_PT_gpencil_material_presets.draw_panel_header(self.layout)



More information about the Bf-blender-cvs mailing list