Cleanup: simplify poll function
authorCampbell Barton <ideasman42@gmail.com>
Sun, 2 Dec 2018 02:59:43 +0000 (13:59 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 2 Dec 2018 03:02:03 +0000 (14:02 +1100)
release/scripts/startup/bl_ui/properties_material_gpencil.py

index b62b251163e2463c071473f23a083ee0888f03ae..282f8d77515789428bcead97c7a0abae138d4d74 100644 (file)
@@ -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)