diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 81596e5715c..99700a870b9 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -337,10 +337,6 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op) /* set mode */ if (gpd->flag & GP_DATA_STROKE_PAINTMODE) { mode = OB_MODE_PAINT_GPENCIL; - BKE_brush_gpencil_paint_presets(bmain, ts, false); - - /* Ensure Palette by default. */ - BKE_gpencil_palette_ensure(bmain, CTX_data_scene(C)); } else { mode = OB_MODE_OBJECT; @@ -356,8 +352,16 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op) } if (mode == OB_MODE_PAINT_GPENCIL) { - /* be sure we have brushes */ + /* Be sure we have brushes and Paint settings. + * Need Draw and Vertex (used fro Tint). */ BKE_paint_ensure(ts, (Paint **)&ts->gp_paint); + BKE_paint_ensure(ts, (Paint **)&ts->gp_vertexpaint); + + BKE_brush_gpencil_paint_presets(bmain, ts, false); + + /* Ensure Palette by default. */ + BKE_gpencil_palette_ensure(bmain, CTX_data_scene(C)); + Paint *paint = &ts->gp_paint->paint; /* if not exist, create a new one */ if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) { @@ -445,7 +449,6 @@ static int gpencil_sculptmode_toggle_exec(bContext *C, wmOperator *op) /* set mode */ if (gpd->flag & GP_DATA_STROKE_SCULPTMODE) { mode = OB_MODE_SCULPT_GPENCIL; - BKE_brush_gpencil_sculpt_presets(bmain, ts, false); } else { mode = OB_MODE_OBJECT; @@ -464,6 +467,8 @@ static int gpencil_sculptmode_toggle_exec(bContext *C, wmOperator *op) /* be sure we have brushes */ BKE_paint_ensure(ts, (Paint **)&ts->gp_sculptpaint); BKE_paint_toolslots_brush_validate(bmain, &ts->gp_sculptpaint->paint); + + BKE_brush_gpencil_sculpt_presets(bmain, ts, false); } /* setup other modes */ @@ -545,7 +550,6 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op) /* set mode */ if (gpd->flag & GP_DATA_STROKE_WEIGHTMODE) { mode = OB_MODE_WEIGHT_GPENCIL; - BKE_brush_gpencil_weight_presets(bmain, ts, false); } else { mode = OB_MODE_OBJECT; @@ -564,6 +568,8 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op) /* be sure we have brushes */ BKE_paint_ensure(ts, (Paint **)&ts->gp_weightpaint); BKE_paint_toolslots_brush_validate(bmain, &ts->gp_weightpaint->paint); + + BKE_brush_gpencil_weight_presets(bmain, ts, false); } /* setup other modes */ @@ -644,10 +650,6 @@ static int gpencil_vertexmode_toggle_exec(bContext *C, wmOperator *op) /* set mode */ if (gpd->flag & GP_DATA_STROKE_VERTEXMODE) { mode = OB_MODE_VERTEX_GPENCIL; - BKE_brush_gpencil_vertex_presets(bmain, ts, false); - - /* Ensure Palette by default. */ - BKE_gpencil_palette_ensure(bmain, CTX_data_scene(C)); } else { mode = OB_MODE_OBJECT; @@ -666,6 +668,11 @@ static int gpencil_vertexmode_toggle_exec(bContext *C, wmOperator *op) /* be sure we have brushes */ BKE_paint_ensure(ts, (Paint **)&ts->gp_vertexpaint); BKE_paint_toolslots_brush_validate(bmain, &ts->gp_vertexpaint->paint); + + BKE_brush_gpencil_vertex_presets(bmain, ts, false); + + /* Ensure Palette by default. */ + BKE_gpencil_palette_ensure(bmain, CTX_data_scene(C)); } /* setup other modes */ |