From 1a7837596cb983fd3328eb680007147761f29f5b Mon Sep 17 00:00:00 2001 From: Antonioya Date: Fri, 24 Aug 2018 23:59:56 +0200 Subject: GP: Select color in Brush or in Properties After some artist feedback the material selection was not clear. Now, the material can be selected in the top bar or in the properties panel. 1) If the material is selected in properties panel, all Brushes except pinned will be assigned to this material. 2) If the material is selected in the brush, the properties panel is updated to set the active material. Added a new Pin icon to keep locked the material to one brush --- source/blender/blenkernel/intern/brush.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/blender/blenkernel/intern/brush.c') diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index e1cc3984601..1444cc6deaf 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -525,6 +525,24 @@ void BKE_brush_gpencil_presets(bContext *C) } +void BKE_brush_update_material(Main *bmain, Material *ma, Brush *exclude_brush) +{ + for (Brush *brush = bmain->brush.first; brush; brush = brush->id.next) { + if ((exclude_brush != NULL) && (brush == exclude_brush)) { + continue; + } + + if (brush->gpencil_settings != NULL) { + BrushGpencilSettings *gpencil_settings = brush->gpencil_settings; + if (((gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) == 0) && + (gpencil_settings->material != ma)) + { + gpencil_settings->material = ma; + } + } + } +} + /* get the active gp-brush for editing */ Brush *BKE_brush_getactive_gpencil(ToolSettings *ts) { -- cgit v1.2.3