diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 16:46:59 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 16:47:49 +0300 |
commit | 164a49f04706a74477fb7be987fe7c5e578807a2 (patch) | |
tree | 5ba9a127d7b0999312492adb8a7f1cfb97cb1d42 /source/blender/editors/gpencil/gpencil_weight_paint.c | |
parent | a351eb072658ce6fb84290f80d8f17bb397fb7ff (diff) |
GPencil: Cleanup function names replace gp_ by gpencil_ prefix (cont)
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_weight_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_weight_paint.c | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c index 057074b5bf0..e41146575e4 100644 --- a/source/blender/editors/gpencil/gpencil_weight_paint.c +++ b/source/blender/editors/gpencil/gpencil_weight_paint.c @@ -268,7 +268,7 @@ static bool brush_draw_apply(tGP_BrushWeightpaintData *gso, /* ************************************************ */ /* Header Info */ -static void gp_weightpaint_brush_header_set(bContext *C) +static void gpencil_weightpaint_brush_header_set(bContext *C) { ED_workspace_status_text(C, TIP_("GPencil Weight Paint: LMB to paint | RMB/Escape to Exit")); } @@ -278,7 +278,7 @@ static void gp_weightpaint_brush_header_set(bContext *C) /* Init/Exit ----------------------------------------------- */ -static bool gp_weightpaint_brush_init(bContext *C, wmOperator *op) +static bool gpencil_weightpaint_brush_init(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -333,12 +333,12 @@ static bool gp_weightpaint_brush_init(bContext *C, wmOperator *op) gpencil_point_conversion_init(C, &gso->gsc); /* Update header. */ - gp_weightpaint_brush_header_set(C); + gpencil_weightpaint_brush_header_set(C); return true; } -static void gp_weightpaint_brush_exit(bContext *C, wmOperator *op) +static void gpencil_weightpaint_brush_exit(bContext *C, wmOperator *op) { tGP_BrushWeightpaintData *gso = op->customdata; @@ -352,17 +352,17 @@ static void gp_weightpaint_brush_exit(bContext *C, wmOperator *op) } /* Poll callback for stroke weight paint operator. */ -static bool gp_weightpaint_brush_poll(bContext *C) +static bool gpencil_weightpaint_brush_poll(bContext *C) { /* NOTE: this is a bit slower, but is the most accurate... */ return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0; } /* Helper to save the points selected by the brush. */ -static void gp_save_selected_point(tGP_BrushWeightpaintData *gso, - bGPDstroke *gps, - int index, - int pc[2]) +static void gpencil_save_selected_point(tGP_BrushWeightpaintData *gso, + bGPDstroke *gps, + int index, + int pc[2]) { tGP_Selected *selected; bGPDspoint *pt = &gps->points[index]; @@ -381,9 +381,9 @@ static void gp_save_selected_point(tGP_BrushWeightpaintData *gso, } /* Select points in this stroke and add to an array to be used later. */ -static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, - bGPDstroke *gps, - const float diff_mat[4][4]) +static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, + bGPDstroke *gps, + const float diff_mat[4][4]) { GP_SpaceConversion *gsc = &gso->gsc; rcti *rect = &gso->brush_rect; @@ -421,7 +421,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, if (len_v2v2_int(mval_i, pc1) <= radius) { /* apply operation to this point */ if (pt_active != NULL) { - gp_save_selected_point(gso, gps_active, 0, pc1); + gpencil_save_selected_point(gso, gps_active, 0, pc1); } } } @@ -456,7 +456,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; if (pt_active != NULL) { - gp_save_selected_point(gso, gps_active, index, pc1); + gpencil_save_selected_point(gso, gps_active, index, pc1); } /* Only do the second point if this is the last segment, @@ -472,7 +472,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1; if (pt_active != NULL) { - gp_save_selected_point(gso, gps_active, index, pc2); + gpencil_save_selected_point(gso, gps_active, index, pc2); include_last = false; } } @@ -490,7 +490,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i; if (pt_active != NULL) { - gp_save_selected_point(gso, gps_active, index, pc1); + gpencil_save_selected_point(gso, gps_active, index, pc1); include_last = false; } @@ -501,11 +501,11 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, } /* Apply weight paint brushes to strokes in the given frame. */ -static bool gp_weightpaint_brush_do_frame(bContext *C, - tGP_BrushWeightpaintData *gso, - bGPDlayer *gpl, - bGPDframe *gpf, - const float diff_mat[4][4]) +static bool gpencil_weightpaint_brush_do_frame(bContext *C, + tGP_BrushWeightpaintData *gso, + bGPDlayer *gpl, + bGPDframe *gpf, + const float diff_mat[4][4]) { Object *ob = CTX_data_active_object(C); char tool = gso->brush->gpencil_weight_tool; @@ -531,7 +531,7 @@ static bool gp_weightpaint_brush_do_frame(bContext *C, } /* Check points below the brush. */ - gp_weightpaint_select_stroke(gso, gps, diff_mat); + gpencil_weightpaint_select_stroke(gso, gps, diff_mat); } /*--------------------------------------------------------------------- @@ -561,7 +561,7 @@ static bool gp_weightpaint_brush_do_frame(bContext *C, } /* Apply brush effect to all layers. */ -static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpaintData *gso) +static bool gpencil_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpaintData *gso) { ToolSettings *ts = CTX_data_tool_settings(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -608,7 +608,7 @@ static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpai } /* affect strokes in this frame */ - changed |= gp_weightpaint_brush_do_frame(C, gso, gpl, gpf, diff_mat); + changed |= gpencil_weightpaint_brush_do_frame(C, gso, gpl, gpf, diff_mat); } } } @@ -616,7 +616,7 @@ static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpai if (gpl->actframe != NULL) { /* Apply to active frame's strokes */ gso->mf_falloff = 1.0f; - changed |= gp_weightpaint_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat); + changed |= gpencil_weightpaint_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat); } } } @@ -625,7 +625,7 @@ static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpai } /* Calculate settings for applying brush */ -static void gp_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) +static void gpencil_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) { tGP_BrushWeightpaintData *gso = op->customdata; Brush *brush = gso->brush; @@ -658,7 +658,7 @@ static void gp_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA * /* Calculate 2D direction vector and relative angle. */ brush_calc_dvec_2d(gso); - changed = gp_weightpaint_brush_apply_to_layers(C, gso); + changed = gpencil_weightpaint_brush_apply_to_layers(C, gso); /* Updates */ if (changed) { @@ -676,7 +676,9 @@ static void gp_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA * /* Running --------------------------------------------- */ /* helper - a record stroke, and apply paint event */ -static void gp_weightpaint_brush_apply_event(bContext *C, wmOperator *op, const wmEvent *event) +static void gpencil_weightpaint_brush_apply_event(bContext *C, + wmOperator *op, + const wmEvent *event) { tGP_BrushWeightpaintData *gso = op->customdata; PointerRNA itemptr; @@ -698,28 +700,28 @@ static void gp_weightpaint_brush_apply_event(bContext *C, wmOperator *op, const RNA_float_set(&itemptr, "pressure", pressure); /* apply */ - gp_weightpaint_brush_apply(C, op, &itemptr); + gpencil_weightpaint_brush_apply(C, op, &itemptr); } /* reapply */ -static int gp_weightpaint_brush_exec(bContext *C, wmOperator *op) +static int gpencil_weightpaint_brush_exec(bContext *C, wmOperator *op) { - if (!gp_weightpaint_brush_init(C, op)) { + if (!gpencil_weightpaint_brush_init(C, op)) { return OPERATOR_CANCELLED; } RNA_BEGIN (op->ptr, itemptr, "stroke") { - gp_weightpaint_brush_apply(C, op, &itemptr); + gpencil_weightpaint_brush_apply(C, op, &itemptr); } RNA_END; - gp_weightpaint_brush_exit(C, op); + gpencil_weightpaint_brush_exit(C, op); return OPERATOR_FINISHED; } /* start modal painting */ -static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event) +static int gpencil_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event) { tGP_BrushWeightpaintData *gso = NULL; const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input"); @@ -733,7 +735,7 @@ static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven } /* init painting data */ - if (!gp_weightpaint_brush_init(C, op)) { + if (!gpencil_weightpaint_brush_init(C, op)) { return OPERATOR_CANCELLED; } @@ -748,7 +750,7 @@ static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven /* apply first dab... */ gso->is_painting = true; - gp_weightpaint_brush_apply_event(C, op, event); + gpencil_weightpaint_brush_apply_event(C, op, event); /* redraw view with feedback */ ED_region_tag_redraw(region); @@ -758,7 +760,7 @@ static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven } /* painting - handle events */ -static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent *event) +static int gpencil_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent *event) { tGP_BrushWeightpaintData *gso = op->customdata; const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input"); @@ -773,7 +775,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent case MOUSEMOVE: case INBETWEEN_MOUSEMOVE: /* apply brush effect at new position */ - gp_weightpaint_brush_apply_event(C, op, event); + gpencil_weightpaint_brush_apply_event(C, op, event); /* force redraw, so that the cursor will at least be valid */ redraw_region = true; @@ -789,7 +791,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent /* end painting, since we're not modal */ gso->is_painting = false; - gp_weightpaint_brush_exit(C, op); + gpencil_weightpaint_brush_exit(C, op); return OPERATOR_FINISHED; } break; @@ -798,7 +800,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent case MIDDLEMOUSE: case RIGHTMOUSE: case EVT_ESCKEY: - gp_weightpaint_brush_exit(C, op); + gpencil_weightpaint_brush_exit(C, op); return OPERATOR_FINISHED; } } @@ -813,13 +815,13 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent gso->is_painting = true; gso->first = true; - gp_weightpaint_brush_apply_event(C, op, event); + gpencil_weightpaint_brush_apply_event(C, op, event); break; /* Exit modal operator, based on the "standard" ops */ case RIGHTMOUSE: case EVT_ESCKEY: - gp_weightpaint_brush_exit(C, op); + gpencil_weightpaint_brush_exit(C, op); return OPERATOR_FINISHED; /* MMB is often used for view manipulations */ @@ -881,11 +883,11 @@ void GPENCIL_OT_weight_paint(wmOperatorType *ot) ot->description = "Paint stroke points with a color"; /* api callbacks */ - ot->exec = gp_weightpaint_brush_exec; - ot->invoke = gp_weightpaint_brush_invoke; - ot->modal = gp_weightpaint_brush_modal; - ot->cancel = gp_weightpaint_brush_exit; - ot->poll = gp_weightpaint_brush_poll; + ot->exec = gpencil_weightpaint_brush_exec; + ot->invoke = gpencil_weightpaint_brush_invoke; + ot->modal = gpencil_weightpaint_brush_modal; + ot->cancel = gpencil_weightpaint_brush_exit; + ot->poll = gpencil_weightpaint_brush_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; |