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/editors/sculpt_paint/paint_ops.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 994ae4011b4..b78c60e7964 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -361,7 +361,6 @@ static int palette_color_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Paint *paint = BKE_paint_get_active_from_context(C);
- Brush *brush = paint->brush;
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
Palette *palette = paint->palette;
PaletteColor *color;
@@ -369,17 +368,20 @@ static int palette_color_add_exec(bContext *C, wmOperator *UNUSED(op))
color = BKE_palette_color_add(palette);
palette->active_color = BLI_listbase_count(&palette->colors) - 1;
- if (ELEM(mode,
- PAINT_MODE_TEXTURE_3D,
- PAINT_MODE_TEXTURE_2D,
- PAINT_MODE_VERTEX,
- PAINT_MODE_SCULPT)) {
- copy_v3_v3(color->rgb, BKE_brush_color_get(scene, brush));
- color->value = 0.0;
- }
- else if (mode == PAINT_MODE_WEIGHT) {
- zero_v3(color->rgb);
- color->value = brush->weight;
+ if (paint->brush) {
+ const Brush *brush = paint->brush;
+ if (ELEM(mode,
+ PAINT_MODE_TEXTURE_3D,
+ PAINT_MODE_TEXTURE_2D,
+ PAINT_MODE_VERTEX,
+ PAINT_MODE_SCULPT)) {
+ copy_v3_v3(color->rgb, BKE_brush_color_get(scene, brush));
+ color->value = 0.0;
+ }
+ else if (mode == PAINT_MODE_WEIGHT) {
+ zero_v3(color->rgb);
+ color->value = brush->weight;
+ }
}
return OPERATOR_FINISHED;