GPencil: Verify Brush has GPencil data
This avoid errors in old files.
This commit is contained in:
parent
fb3e138cee
commit
6da953ad1d
|
@ -314,7 +314,7 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op)
|
|||
BKE_paint_ensure(ts, (Paint **)&ts->gp_paint);
|
||||
Paint *paint = &ts->gp_paint->paint;
|
||||
/* if not exist, create a new one */
|
||||
if (paint->brush == NULL) {
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
BKE_brush_gpencil_presets(C);
|
||||
}
|
||||
BKE_paint_toolslots_brush_validate(bmain, &ts->gp_paint->paint);
|
||||
|
|
|
@ -110,7 +110,7 @@ static bGPDstroke *gpencil_prepare_stroke(bContext *C, wmOperator *op, int totpo
|
|||
|
||||
Paint *paint = &ts->gp_paint->paint;
|
||||
/* if not exist, create a new one */
|
||||
if (paint->brush == NULL) {
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
/* create new brushes */
|
||||
BKE_brush_gpencil_presets(C);
|
||||
}
|
||||
|
|
|
@ -1819,7 +1819,7 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
|
|||
Paint *paint = &ts->gp_paint->paint;
|
||||
bool changed = false;
|
||||
/* if not exist, create a new one */
|
||||
if (paint->brush == NULL) {
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
/* create new brushes */
|
||||
BKE_brush_gpencil_presets(C);
|
||||
changed = true;
|
||||
|
|
|
@ -314,7 +314,7 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
|
|||
/* if brush doesn't exist, create a new one */
|
||||
Paint *paint = &ts->gp_paint->paint;
|
||||
/* if not exist, create a new one */
|
||||
if (paint->brush == NULL) {
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
/* create new brushes */
|
||||
BKE_brush_gpencil_presets(C);
|
||||
}
|
||||
|
|
|
@ -1387,7 +1387,7 @@ void ED_gpencil_add_defaults(bContext *C, Object *ob)
|
|||
BKE_paint_ensure(ts, (Paint **)&ts->gp_paint);
|
||||
Paint *paint = &ts->gp_paint->paint;
|
||||
/* if not exist, create a new one */
|
||||
if (paint->brush == NULL) {
|
||||
if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) {
|
||||
/* create new brushes */
|
||||
BKE_brush_gpencil_presets(C);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue