diff options
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_primitive.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_primitive.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index e4b2e5540ea..c42c1c4d4c0 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -330,7 +330,15 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) gps->flag |= GP_STROKE_3DSPACE; - gps->mat_nr = BKE_gpencil_object_material_get_index(tgpi->ob, tgpi->mat); + gps->mat_nr = BKE_gpencil_object_material_get_index_from_brush(tgpi->ob, tgpi->brush); + if (gps->mat_nr < 0) { + if (tgpi->ob->actcol - 1 < 0) { + gps->mat_nr = 0; + } + else { + gps->mat_nr = tgpi->ob->actcol - 1; + } + } /* allocate memory for storage points, but keep empty */ gps->totpoints = 0; @@ -1126,7 +1134,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op) /* if brush doesn't exist, create a new set (fix damaged files from old versions) */ if ((paint->brush == NULL) || (paint->brush->gpencil_settings == NULL)) { - BKE_brush_gpencil_presets(C); + BKE_brush_gpencil_presets(bmain, ts); } /* Set Draw brush. */ @@ -1206,7 +1214,7 @@ static int gpencil_primitive_invoke(bContext *C, wmOperator *op, const wmEvent * op->flag |= OP_IS_MODAL_CURSOR_REGION; /* set cursor to indicate modal */ - WM_cursor_modal_set(win, BC_CROSSCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_CROSS); /* update sindicator in header */ gpencil_primitive_status_indicators(C, tgpi); @@ -1311,18 +1319,18 @@ static void gpencil_primitive_edit_event_handling( if (tgpi->flag == IN_CURVE_EDIT) { if ((a < BIG_SIZE_CTL && tgpi->tot_stored_edges == 0) || b < BIG_SIZE_CTL) { move = MOVE_ENDS; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } else if (tgpi->curve) { move = MOVE_CP; - WM_cursor_modal_set(win, BC_HANDCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_HAND); } else { - WM_cursor_modal_set(win, BC_CROSSCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_CROSS); } } else if (tgpi->flag == IN_PROGRESS) { - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } switch (event->type) { @@ -1394,7 +1402,7 @@ static void gpencil_primitive_edit_event_handling( case EKEY: { if (tgpi->flag == IN_CURVE_EDIT && !ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { tgpi->flag = IN_PROGRESS; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); gpencil_primitive_add_segment(tgpi); copy_v2_v2(tgpi->start, tgpi->end); copy_v2_v2(tgpi->origin, tgpi->start); @@ -1657,7 +1665,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e { if ((event->val == KM_PRESS)) { tgpi->flag = IN_MOVE; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); } break; } @@ -1670,7 +1678,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e else { tgpi->flag = IN_BRUSH_SIZE; } - WM_cursor_modal_set(win, BC_NS_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NS_SCROLL); } break; } @@ -1696,7 +1704,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e case TABKEY: { if (tgpi->flag == IN_CURVE_EDIT) { tgpi->flag = IN_PROGRESS; - WM_cursor_modal_set(win, BC_NSEW_SCROLLCURSOR); + WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); gp_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } |