Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-03-25 19:02:42 +0300
committerAntonioya <blendergit@gmail.com>2019-03-25 19:06:07 +0300
commit7021bd527380b4d87cf48057f0039509326b03dd (patch)
tree55126437da17d736a789d236c8a98d199a1e6260 /release
parent84240ebb3ebde58f6bfba256e49d37697fb6bc9f (diff)
GPencil: Only brushes with pinned materials have materials
Using GP_BRUSH_MATERIAL_PINNED to switch between active material and brush material, instead of updating all brushes on active material changes. This will allow brushes to have no material and therefore to not inflate the user count. This fix T62465. Patch contributed by @matc Reviewers: @brecht @antoniov @billreynish @mendio
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_ui/properties_grease_pencil_common.py11
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py3
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py10
3 files changed, 22 insertions, 2 deletions
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 5f2ac7e7123..bb059d6befc 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -832,6 +832,11 @@ class GreasePencilMaterialsPanel:
layout = self.layout
show_full_ui = (self.bl_space_type == 'PROPERTIES')
+ is_view3d = (self.bl_space_type == 'VIEW_3D')
+ tool_settings = context.scene.tool_settings
+ gpencil_paint = tool_settings.gpencil_paint
+ brush = gpencil_paint.brush
+
ob = context.object
row = layout.row()
@@ -841,6 +846,12 @@ class GreasePencilMaterialsPanel:
row.template_list("GPENCIL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows)
+ # if topbar popover and brush pinned, disable
+ if is_view3d and brush is not None:
+ gp_settings = brush.gpencil_settings
+ if gp_settings.use_material_pin:
+ row.enabled = False
+
col = row.column(align=True)
if show_full_ui:
col.operator("object.material_slot_add", icon='ADD', text="")
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 0e687452e5c..7b9b324066a 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -316,7 +316,8 @@ class _draw_left_context_mode:
def draw_color_selector():
ma = gp_settings.material
row = layout.row(align=True)
-
+ if not gp_settings.use_material_pin:
+ ma = context.object.active_material
icon_id = 0
if ma:
icon_id = ma.id_data.preview.icon_id
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 212427dead9..17dd35d9fc4 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1679,7 +1679,15 @@ class VIEW3D_PT_tools_grease_pencil_brush(View3DPanel, Panel):
gp_settings = brush.gpencil_settings
if brush.gpencil_tool in {'DRAW', 'FILL'}:
- layout.row(align=True).template_ID(gp_settings, "material")
+ row = layout.row(align=True)
+ row_mat = row.row()
+ if gp_settings.use_material_pin:
+ row_mat.template_ID(gp_settings, "material", live_icon=True)
+ else:
+ row_mat.template_ID(context.active_object, "active_material", live_icon=True)
+ row_mat.enabled = False # will otherwise allow to change material in active slot
+
+ row.prop(gp_settings, "use_material_pin", text="")
if not self.is_popover:
from .properties_paint_common import (