[Bf-blender-cvs] [76f914d36cd] greasepencil-object: Fix: Errors in console when using annotations in viewport

Joshua Leung noreply at git.blender.org
Thu Jun 28 09:14:09 CEST 2018


Commit: 76f914d36cd3fa35ad60387f63ca004d62c50e6e
Author: Joshua Leung
Date:   Thu Jun 28 16:53:49 2018 +1200
Branches: greasepencil-object
https://developer.blender.org/rB76f914d36cd3fa35ad60387f63ca004d62c50e6e

Fix: Errors in console when using annotations in viewport

Was caused by a missing poll callback for a GP object panel

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

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

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

diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index a3b7b428168..ccc450acaa2 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -279,18 +279,25 @@ class GreasePencilStrokeSculptPanel:
             layout.prop(brush, "direction", expand=True)
 
 
-
+# GP Object Tool Settings
 class GreasePencilAppearancePanel:
     bl_label = "Brush Appearance"
     bl_options = {'DEFAULT_CLOSED'}
 
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return ob and ob.type == 'GPENCIL'
+
     @staticmethod
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
         layout.use_property_decorate = False
 
-        if context.active_object.mode == 'GPENCIL_PAINT':
+        ob = context.active_object
+
+        if ob.mode == 'GPENCIL_PAINT':
             brush = context.active_gpencil_brush
             gp_settings = brush.gpencil_settings
 
@@ -310,7 +317,7 @@ class GreasePencilAppearancePanel:
             if gp_settings.gpencil_brush_type == 'FILL':
                 layout.prop(brush, "cursor_color_add", text="Color")
 
-        elif context.active_object.mode in ('GPENCIL_SCULPT', 'GPENCIL_WEIGHT'):
+        elif ob.mode in ('GPENCIL_SCULPT', 'GPENCIL_WEIGHT'):
             settings = context.tool_settings.gpencil_sculpt
             brush = settings.brush



More information about the Bf-blender-cvs mailing list