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:
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_brush.h3
-rw-r--r--source/blender/blenkernel/intern/brush.c18
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 42399835b53..ebfe47c2f99 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -37,6 +37,8 @@ struct Main;
struct Scene;
struct ToolSettings;
struct UnifiedPaintSettings;
+struct Material;
+
// enum eCurveMappingPreset;
#include "DNA_object_enums.h"
@@ -58,6 +60,7 @@ void BKE_brush_free(struct Brush *brush);
void BKE_brush_sculpt_reset(struct Brush *brush);
void BKE_brush_gpencil_presets(struct bContext *C);
+void BKE_brush_update_material(struct Main *bmain, struct Material *ma, struct Brush *exclude_brush);
struct Brush *BKE_brush_getactive_gpencil(struct ToolSettings *ts);
struct Paint *BKE_brush_get_gpencil_paint(struct ToolSettings *ts);
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)
{