[Bf-blender-cvs] [3595919cbaa] greasepencil-object: GPencil: Use default Brush material in Popover

Antonioya noreply at git.blender.org
Fri May 3 17:38:51 CEST 2019


Commit: 3595919cbaa8ed3d55e4a92da6c076fdc286bba7
Author: Antonioya
Date:   Fri May 3 17:38:47 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB3595919cbaa8ed3d55e4a92da6c076fdc286bba7

GPencil: Use default Brush material in Popover

For pinned materials, the stroke color must be the brush color, not selected slot.

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

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 162bffc254f..05a8735fc2f 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -881,15 +881,15 @@ class GreasePencilMaterialsPanel:
                     row.operator("gpencil.stroke_change_color", text="Assign")
                     row.operator("gpencil.color_select", text="Select").deselect = False
                     row.operator("gpencil.color_select", text="Deselect").deselect = True
-
-        else:
-            space = context.space_data
-            row.template_ID(space, "pin_id")
-
         # stroke color
-        if ob:
-            idx = ob.active_material_index
-            ma = ob.material_slots[idx].material
+            ma = None
+            if is_view3d and brush is not None:
+                gp_settings = brush.gpencil_settings
+                if gp_settings.use_material_pin is False:
+                    ma = ob.material_slots[ob.active_material_index].material
+                else:
+                    ma = gp_settings.material
+
             if ma is not None and ma.grease_pencil is not None:
                 gpcolor = ma.grease_pencil
                 if gpcolor.stroke_style == 'SOLID' or \
@@ -898,6 +898,10 @@ class GreasePencilMaterialsPanel:
                     row = layout.row()
                     row.prop(gpcolor, "color", text="Stroke Color")
 
+        else:
+            space = context.space_data
+            row.template_ID(space, "pin_id")
+
 
 class GPENCIL_UL_layer(UIList):
     def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):



More information about the Bf-blender-cvs mailing list