[Bf-blender-cvs] [59b38297d11] greasepencil-object: GPencil: More changes after merge

Antonio Vazquez noreply at git.blender.org
Thu Dec 19 14:41:55 CET 2019


Commit: 59b38297d11223537b228e5bd82d7b8dd5aae124
Author: Antonio Vazquez
Date:   Thu Dec 19 14:39:59 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB59b38297d11223537b228e5bd82d7b8dd5aae124

GPencil: More changes after merge

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index d6c12cf84e8..4a21660776d 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -129,15 +129,18 @@ class VIEW3D_HT_tool_header(Header):
 
                     layout.popover("VIEW3D_PT_tools_grease_pencil_paint_appearance")
         elif tool_mode == 'SCULPT_GPENCIL':
-            brush = context.tool_settings.gpencil_sculpt_paint.brush
-            tool = brush.gpencil_tool
-            if tool in ('SMOOTH', 'RANDOMIZE'):
-                layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_options")
-            layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance")
+            if is_valid_context:
+                brush = context.tool_settings.gpencil_sculpt_paint.brush
+                tool = brush.gpencil_tool
+                if tool in ('SMOOTH', 'RANDOMIZE'):
+                    layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_options")
+                layout.popover("VIEW3D_PT_tools_grease_pencil_sculpt_appearance")
         elif tool_mode == 'WEIGHT_GPENCIL':
-            layout.popover("VIEW3D_PT_tools_grease_pencil_weight_appearance")
+            if is_valid_context:
+                layout.popover("VIEW3D_PT_tools_grease_pencil_weight_appearance")
         elif tool_mode == 'VERTEX_GPENCIL':
-            layout.popover("VIEW3D_PT_tools_grease_pencil_vertex_appearance")
+            if is_valid_context:
+                layout.popover("VIEW3D_PT_tools_grease_pencil_vertex_appearance")
 
     def draw_mode_settings(self, context):
         layout = self.layout
@@ -455,7 +458,7 @@ class _draw_tool_settings_context_mode:
     @staticmethod
     def SCULPT_GPENCIL(context, layout, tool):
         if (tool is None) or (not tool.has_datablock):
-            return
+            return False
         paint = context.tool_settings.gpencil_sculpt_paint
         brush = paint.brush
 
@@ -469,7 +472,7 @@ class _draw_tool_settings_context_mode:
     @staticmethod
     def WEIGHT_GPENCIL(context, layout, tool):
         if (tool is None) or (not tool.has_datablock):
-            return
+            return False
         paint = context.tool_settings.gpencil_weight_paint
         brush = paint.brush
 
@@ -483,7 +486,7 @@ class _draw_tool_settings_context_mode:
     @staticmethod
     def VERTEX_GPENCIL(context, layout, tool):
         if (tool is None) or (not tool.has_datablock):
-            return
+            return False
 
         paint = context.tool_settings.gpencil_vertex_paint
         brush = paint.brush
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index c7d01fff54a..d191422887a 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1833,10 +1833,11 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_select(Panel, View3DPanel, GreasePenc
 
         if context.mode == 'SCULPT_GPENCIL':
             brush = tool_settings.gpencil_sculpt_paint.brush
-            col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
+            if brush is not None:
+                col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
 
-            if(brush.use_custom_icon):
-                layout.row().prop(brush, "icon_filepath", text="")
+                if(brush.use_custom_icon):
+                    layout.row().prop(brush, "icon_filepath", text="")
 
 
 class VIEW3D_PT_tools_grease_pencil_sculpt_settings(Panel, View3DPanel, GreasePencilSculptPanel):
@@ -1906,10 +1907,11 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint_select(View3DPanel, Panel, Grea
 
         if context.mode == 'WEIGHT_GPENCIL':
             brush = tool_settings.gpencil_weight_paint.brush
-            col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
+            if brush is not None:
+                col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
 
-            if(brush.use_custom_icon):
-                layout.row().prop(brush, "icon_filepath", text="")
+                if(brush.use_custom_icon):
+                    layout.row().prop(brush, "icon_filepath", text="")
 
 
 class VIEW3D_PT_tools_grease_pencil_weight_paint_settings(Panel, View3DPanel, GreasePencilWeightPanel):
@@ -1980,10 +1982,11 @@ class VIEW3D_PT_tools_grease_pencil_vertex_paint_select(View3DPanel, Panel, Grea
 
         if context.mode == 'VERTEX_GPENCIL':
             brush = tool_settings.gpencil_vertex_paint.brush
-            col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
+            if brush is not None:
+                col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
 
-            if(brush.use_custom_icon):
-                layout.row().prop(brush, "icon_filepath", text="")
+                if(brush.use_custom_icon):
+                    layout.row().prop(brush, "icon_filepath", text="")
 
 
 class VIEW3D_PT_tools_grease_pencil_vertex_paint_settings(Panel, View3DPanel, GreasePencilVertexPanel):



More information about the Bf-blender-cvs mailing list