[Bf-blender-cvs] [3d7b3954f81] greasepencil-object: GPencil: Changes to Header of the Vertex Color panel

Antonio Vazquez noreply at git.blender.org
Thu Feb 27 14:22:08 CET 2020


Commit: 3d7b3954f81d13cce323cdff99931dc5c8d5f625
Author: Antonio Vazquez
Date:   Thu Feb 27 14:21:59 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB3d7b3954f81d13cce323cdff99931dc5c8d5f625

GPencil: Changes to Header of the Vertex Color panel

We need see the panel in Material mode.

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 84c4beb5b66..980ad7cfcaa 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -2033,8 +2033,6 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
 
         col = layout.column()
 
-        col.prop(gp_settings, "vertex_mode", text="Mode")
-
         col.prop(brush, "color", text="")
         col.template_color_picker(brush, "color", value_slider=True)
 
@@ -2044,6 +2042,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
 
         sub_row.operator("gpencil.tint_flip", icon='FILE_REFRESH', text="")
 
+        col.prop(gp_settings, "vertex_mode", text="Mode")
+
 
 class VIEW3D_PT_tools_grease_pencil_brush_vertex_falloff(GreasePencilBrushFalloff, Panel, View3DPaintPanel):
     bl_context = ".greasepencil_vertex"
@@ -2096,7 +2096,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_palette(View3DPanel, Panel):
 
 class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
     bl_context = ".greasepencil_paint"
-    bl_label = "Vertex Color"
+    bl_label = "Paint Mode"
     bl_category = "Tool"
     bl_options = {'DEFAULT_CLOSED'}
 
@@ -2110,9 +2110,6 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
         if ob is None or brush is None:
             return False
 
-        if settings.use_vertex_color != 'VERTEXCOLOR':
-            return False
-
         if context.region.type == 'TOOL_HEADER':
             return False
 
@@ -2122,16 +2119,16 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
         if brush.gpencil_tool not in {'DRAW', 'FILL'}:
             return False
 
-        gp_settings = brush.gpencil_settings
-        ma = None
-        if gp_settings.use_material_pin is False:
-            if ob.active_material_index >= 0:
-                ma = ob.material_slots[ob.active_material_index].material
-            else:
-                ma = gp_settings.material
-
         return True
 
+    def draw_header(self, context):
+        ts = context.tool_settings
+        settings = ts.gpencil_paint
+        brush = settings.brush
+
+        if brush.gpencil_tool != 'TINT':
+            self.layout.prop(settings, "use_vertex_color", text="", expand=True)
+
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
@@ -2141,6 +2138,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_mixcolor(View3DPanel, Panel):
         brush = settings.brush
         gp_settings = brush.gpencil_settings
 
+        layout.enabled = settings.use_vertex_color == 'VERTEXCOLOR' or brush.gpencil_tool == 'TINT'
         col = layout.column()
         col.enabled = settings.use_vertex_color == 'VERTEXCOLOR' or brush.gpencil_tool == 'TINT'
 
@@ -2183,13 +2181,6 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel):
         if brush.gpencil_tool not in {'DRAW', 'FILL'}:
             return False
 
-        gp_settings = brush.gpencil_settings
-        if gp_settings.use_material_pin is False:
-            if ob.active_material_index >= 0:
-                ma = ob.material_slots[ob.active_material_index].material
-            else:
-                ma = gp_settings.material
-
         return True
 
     def draw(self, context):
@@ -2199,6 +2190,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_mix_palette(View3DPanel, Panel):
         ts = context.tool_settings
         settings = ts.gpencil_paint
         brush = settings.brush
+        layout.enabled = settings.use_vertex_color == 'VERTEXCOLOR' or brush.gpencil_tool == 'TINT'
 
         col = layout.column()
         col.enabled = settings.use_vertex_color == 'VERTEXCOLOR' or brush.gpencil_tool == 'TINT'



More information about the Bf-blender-cvs mailing list