diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 16:28:38 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 16:47:43 +0300 |
commit | a351eb072658ce6fb84290f80d8f17bb397fb7ff (patch) | |
tree | 8db60cbddbafddd69ceb2f9b3ad32fa82a8dc022 /source/blender/editors/gpencil/gpencil_edit.c | |
parent | 399dbb1aa391f04357f91ab875241db3c6041aa5 (diff) |
GPencil: Cleanup function names replace gp_ by gpencil_ prefix
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_edit.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 265 |
1 files changed, 134 insertions, 131 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 8c738917722..78e2812fdef 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -95,7 +95,7 @@ * \{ */ /* poll callback for all stroke editing operators */ -static bool gp_stroke_edit_poll(bContext *C) +static bool gpencil_stroke_edit_poll(bContext *C) { /* edit only supported with grease pencil objects */ Object *ob = CTX_data_active_object(C); @@ -108,7 +108,7 @@ static bool gp_stroke_edit_poll(bContext *C) } /* poll callback to verify edit mode in 3D view only */ -static bool gp_strokes_edit3d_poll(bContext *C) +static bool gpencil_strokes_edit3d_poll(bContext *C) { /* edit only supported with grease pencil objects */ Object *ob = CTX_data_active_object(C); @@ -120,7 +120,7 @@ static bool gp_strokes_edit3d_poll(bContext *C) * - 1) Editable GP data * - 2) 3D View only */ - return (gp_stroke_edit_poll(C) && ED_operator_view3d_active(C)); + return (gpencil_stroke_edit_poll(C) && ED_operator_view3d_active(C)); } static bool gpencil_editmode_toggle_poll(bContext *C) @@ -789,7 +789,7 @@ void GPENCIL_OT_selection_opacity_toggle(wmOperatorType *ot) /* callbacks */ ot->exec = gpencil_hideselect_toggle_exec; - ot->poll = gp_stroke_edit_poll; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER; @@ -802,9 +802,9 @@ void GPENCIL_OT_selection_opacity_toggle(wmOperatorType *ot) * \{ */ /* Make copies of selected point segments in a selected stroke */ -static void gp_duplicate_points(const bGPDstroke *gps, - ListBase *new_strokes, - const char *layername) +static void gpencil_duplicate_points(const bGPDstroke *gps, + ListBase *new_strokes, + const char *layername) { bGPDspoint *pt; int i; @@ -880,7 +880,7 @@ static void gp_duplicate_points(const bGPDstroke *gps, } } -static int gp_duplicate_exec(bContext *C, wmOperator *op) +static int gpencil_duplicate_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -933,7 +933,7 @@ static int gp_duplicate_exec(bContext *C, wmOperator *op) } else { /* delegate to a helper, as there's too much to fit in here (for copying subsets)... */ - gp_duplicate_points(gps, &new_strokes, gpl->info); + gpencil_duplicate_points(gps, &new_strokes, gpl->info); } /* deselect original stroke, or else the originals get moved too @@ -969,8 +969,8 @@ void GPENCIL_OT_duplicate(wmOperatorType *ot) ot->description = "Duplicate the selected Grease Pencil strokes"; /* callbacks */ - ot->exec = gp_duplicate_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_duplicate_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -983,12 +983,12 @@ void GPENCIL_OT_duplicate(wmOperatorType *ot) * \{ */ /* helper to copy a point to temp area */ -static void copy_move_point(bGPDstroke *gps, - bGPDspoint *temp_points, - MDeformVert *temp_dverts, - int from_idx, - int to_idx, - const bool copy) +static void gpencil_copy_move_point(bGPDstroke *gps, + bGPDspoint *temp_points, + MDeformVert *temp_dverts, + int from_idx, + int to_idx, + const bool copy) { bGPDspoint *pt = &temp_points[from_idx]; bGPDspoint *pt_final = &gps->points[to_idx]; @@ -1053,7 +1053,7 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) BLI_insertlinkafter(&gpf->strokes, gps, gps_new); /* copy selected point data to new stroke */ - copy_move_point(gps_new, gps->points, gps->dvert, i, 0, true); + gpencil_copy_move_point(gps_new, gps->points, gps->dvert, i, 0, true); /* Calc geometry data. */ BKE_gpencil_stroke_geometry_update(gps); @@ -1098,13 +1098,13 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) /* move points to new position */ for (int i = 0; i < oldtotpoints; i++) { - copy_move_point(gps, temp_points, temp_dverts, i, i2, false); + gpencil_copy_move_point(gps, temp_points, temp_dverts, i, i2, false); i2++; } /* If first point, add new point at the beginning. */ if (do_first) { - copy_move_point(gps, temp_points, temp_dverts, 0, 0, true); + gpencil_copy_move_point(gps, temp_points, temp_dverts, 0, 0, true); /* deselect old */ pt = &gps->points[1]; pt->flag &= ~GP_SPOINT_SELECT; @@ -1115,7 +1115,8 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) /* if last point, add new point at the end */ if (do_last) { - copy_move_point(gps, temp_points, temp_dverts, oldtotpoints - 1, gps->totpoints - 1, true); + gpencil_copy_move_point( + gps, temp_points, temp_dverts, oldtotpoints - 1, gps->totpoints - 1, true); /* deselect old */ pt = &gps->points[gps->totpoints - 2]; @@ -1138,7 +1139,7 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) } } -static int gp_extrude_exec(bContext *C, wmOperator *op) +static int gpencil_extrude_exec(bContext *C, wmOperator *op) { Object *obact = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)obact->data; @@ -1194,8 +1195,8 @@ void GPENCIL_OT_extrude(wmOperatorType *ot) ot->description = "Extrude the selected Grease Pencil points"; /* callbacks */ - ot->exec = gp_extrude_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_extrude_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1223,9 +1224,9 @@ ListBase gpencil_strokes_copypastebuf = {NULL, NULL}; * This is needed to prevent dangling and unsafe pointers when pasting across data-blocks, * or after a color used by a stroke in the buffer gets deleted (via user action or undo). */ -static GHash *gp_strokes_copypastebuf_colors = NULL; +static GHash *gpencil_strokes_copypastebuf_colors = NULL; -static GHash *gp_strokes_copypastebuf_colors_material_to_name_create(Main *bmain) +static GHash *gpencil_strokes_copypastebuf_colors_material_to_name_create(Main *bmain) { GHash *ma_to_name = BLI_ghash_ptr_new(__func__); @@ -1237,12 +1238,12 @@ static GHash *gp_strokes_copypastebuf_colors_material_to_name_create(Main *bmain return ma_to_name; } -static void gp_strokes_copypastebuf_colors_material_to_name_free(GHash *ma_to_name) +static void gpencil_strokes_copypastebuf_colors_material_to_name_free(GHash *ma_to_name) { BLI_ghash_free(ma_to_name, NULL, MEM_freeN); } -static GHash *gp_strokes_copypastebuf_colors_name_to_material_create(Main *bmain) +static GHash *gpencil_strokes_copypastebuf_colors_name_to_material_create(Main *bmain) { GHash *name_to_ma = BLI_ghash_str_new(__func__); @@ -1254,7 +1255,7 @@ static GHash *gp_strokes_copypastebuf_colors_name_to_material_create(Main *bmain return name_to_ma; } -static void gp_strokes_copypastebuf_colors_name_to_material_free(GHash *name_to_ma) +static void gpencil_strokes_copypastebuf_colors_name_to_material_free(GHash *name_to_ma) { BLI_ghash_free(name_to_ma, MEM_freeN, NULL); } @@ -1267,9 +1268,9 @@ void ED_gpencil_strokes_copybuf_free(void) /* Free the colors buffer * NOTE: This is done before the strokes so that the ptrs are still safe */ - if (gp_strokes_copypastebuf_colors) { - BLI_ghash_free(gp_strokes_copypastebuf_colors, NULL, MEM_freeN); - gp_strokes_copypastebuf_colors = NULL; + if (gpencil_strokes_copypastebuf_colors) { + BLI_ghash_free(gpencil_strokes_copypastebuf_colors, NULL, MEM_freeN); + gpencil_strokes_copypastebuf_colors = NULL; } /* Free the stroke buffer */ @@ -1304,9 +1305,9 @@ GHash *gpencil_copybuf_validate_colormap(bContext *C) GHashIterator gh_iter; /* For each color, check if exist and add if not */ - GHash *name_to_ma = gp_strokes_copypastebuf_colors_name_to_material_create(bmain); + GHash *name_to_ma = gpencil_strokes_copypastebuf_colors_name_to_material_create(bmain); - GHASH_ITER (gh_iter, gp_strokes_copypastebuf_colors) { + GHASH_ITER (gh_iter, gpencil_strokes_copypastebuf_colors) { int *key = BLI_ghashIterator_getKey(&gh_iter); char *ma_name = BLI_ghashIterator_getValue(&gh_iter); Material *ma = BLI_ghash_lookup(name_to_ma, ma_name); @@ -1319,7 +1320,7 @@ GHash *gpencil_copybuf_validate_colormap(bContext *C) } } - gp_strokes_copypastebuf_colors_name_to_material_free(name_to_ma); + gpencil_strokes_copypastebuf_colors_name_to_material_free(name_to_ma); return new_colors; } @@ -1330,7 +1331,7 @@ GHash *gpencil_copybuf_validate_colormap(bContext *C) /** \name Copy Selected Strokes Operator * \{ */ -static int gp_strokes_copy_exec(bContext *C, wmOperator *op) +static int gpencil_strokes_copy_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Object *ob = CTX_data_active_object(C); @@ -1393,7 +1394,7 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) } else { /* delegate to a helper, as there's too much to fit in here (for copying subsets)... */ - gp_duplicate_points(gps, &gpencil_strokes_copypastebuf, gpl->info); + gpencil_duplicate_points(gps, &gpencil_strokes_copypastebuf, gpl->info); } } } @@ -1402,8 +1403,8 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) /* Build up hash of material colors used in these strokes */ if (gpencil_strokes_copypastebuf.first) { - gp_strokes_copypastebuf_colors = BLI_ghash_int_new("GPencil CopyBuf Colors"); - GHash *ma_to_name = gp_strokes_copypastebuf_colors_material_to_name_create(bmain); + gpencil_strokes_copypastebuf_colors = BLI_ghash_int_new("GPencil CopyBuf Colors"); + GHash *ma_to_name = gpencil_strokes_copypastebuf_colors_material_to_name_create(bmain); LISTBASE_FOREACH (bGPDstroke *, gps, &gpencil_strokes_copypastebuf) { if (ED_gpencil_stroke_can_use(C, gps)) { Material *ma = BKE_object_material_get(ob, gps->mat_nr + 1); @@ -1414,13 +1415,13 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) char **ma_name_val; if (!BLI_ghash_ensure_p( - gp_strokes_copypastebuf_colors, &gps->mat_nr, (void ***)&ma_name_val)) { + gpencil_strokes_copypastebuf_colors, &gps->mat_nr, (void ***)&ma_name_val)) { char *ma_name = BLI_ghash_lookup(ma_to_name, ma); *ma_name_val = MEM_dupallocN(ma_name); } } } - gp_strokes_copypastebuf_colors_material_to_name_free(ma_to_name); + gpencil_strokes_copypastebuf_colors_material_to_name_free(ma_to_name); } /* updates (to ensure operator buttons are refreshed, when used via hotkeys) */ @@ -1438,8 +1439,8 @@ void GPENCIL_OT_copy(wmOperatorType *ot) ot->description = "Copy selected Grease Pencil points and strokes"; /* callbacks */ - ot->exec = gp_strokes_copy_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_strokes_copy_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ // ot->flag = OPTYPE_REGISTER; @@ -1451,7 +1452,7 @@ void GPENCIL_OT_copy(wmOperatorType *ot) /** \name Paste Selected Strokes Operator * \{ */ -static bool gp_strokes_paste_poll(bContext *C) +static bool gpencil_strokes_paste_poll(bContext *C) { ScrArea *area = CTX_wm_area(C); if (!((area != NULL) && (area->spacetype == SPACE_VIEW3D))) { @@ -1472,7 +1473,7 @@ typedef enum eGP_PasteMode { GP_COPY_TO_ACTIVE = 1, } eGP_PasteMode; -static int gp_strokes_paste_exec(bContext *C, wmOperator *op) +static int gpencil_strokes_paste_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -1607,8 +1608,8 @@ void GPENCIL_OT_paste(wmOperatorType *ot) ot->description = "Paste previously copied strokes to active layer or to original layer"; /* callbacks */ - ot->exec = gp_strokes_paste_exec; - ot->poll = gp_strokes_paste_poll; + ot->exec = gpencil_strokes_paste_exec; + ot->poll = gpencil_strokes_paste_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1627,7 +1628,7 @@ void GPENCIL_OT_paste(wmOperatorType *ot) /** \name Move To Layer Operator * \{ */ -static int gp_move_to_layer_exec(bContext *C, wmOperator *op) +static int gpencil_move_to_layer_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -1733,8 +1734,8 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot) "Move selected strokes to another layer"; // XXX: allow moving individual points too? /* callbacks */ - ot->exec = gp_move_to_layer_exec; - ot->poll = gp_stroke_edit_poll; // XXX? + ot->exec = gpencil_move_to_layer_exec; + ot->poll = gpencil_stroke_edit_poll; // XXX? /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1751,7 +1752,7 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot) /** \name Add Blank Frame Operator * \{ */ -static int gp_blank_frame_add_exec(bContext *C, wmOperator *op) +static int gpencil_blank_frame_add_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Scene *scene = CTX_data_scene(C); @@ -1809,7 +1810,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot) "(all subsequently existing frames, if any, are shifted right by one frame)"; /* callbacks */ - ot->exec = gp_blank_frame_add_exec; + ot->exec = gpencil_blank_frame_add_exec; ot->poll = gpencil_add_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1829,7 +1830,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot) /** \name Delete Active Frame Operator * \{ */ -static bool gp_actframe_delete_poll(bContext *C) +static bool gpencil_actframe_delete_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -1838,7 +1839,7 @@ static bool gp_actframe_delete_poll(bContext *C) return (gpl && gpl->actframe); } -static bool gp_annotation_actframe_delete_poll(bContext *C) +static bool annotation_actframe_delete_poll(bContext *C) { bGPdata *gpd = ED_annotation_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -1848,7 +1849,7 @@ static bool gp_annotation_actframe_delete_poll(bContext *C) } /* delete active frame - wrapper around API calls */ -static int gp_actframe_delete_exec(bContext *C, wmOperator *op) +static int gpencil_actframe_delete_exec(bContext *C, wmOperator *op) { const bool is_annotation = STREQ(op->idname, "GPENCIL_OT_annotation_active_frame_delete"); @@ -1891,8 +1892,8 @@ void GPENCIL_OT_active_frame_delete(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_actframe_delete_exec; - ot->poll = gp_actframe_delete_poll; + ot->exec = gpencil_actframe_delete_exec; + ot->poll = gpencil_actframe_delete_poll; } void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot) @@ -1905,8 +1906,8 @@ void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_actframe_delete_exec; - ot->poll = gp_annotation_actframe_delete_poll; + ot->exec = gpencil_actframe_delete_exec; + ot->poll = annotation_actframe_delete_poll; } /** \} */ @@ -1915,7 +1916,7 @@ void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot) /** \name Delete All Active Frames * \{ */ -static bool gp_actframe_delete_all_poll(bContext *C) +static bool gpencil_actframe_delete_all_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -1925,7 +1926,7 @@ static bool gp_actframe_delete_all_poll(bContext *C) return (gpd && gpd->layers.first); } -static int gp_actframe_delete_all_exec(bContext *C, wmOperator *op) +static int gpencil_actframe_delete_all_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Scene *scene = CTX_data_scene(C); @@ -1970,8 +1971,8 @@ void GPENCIL_OT_active_frames_delete_all(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_actframe_delete_all_exec; - ot->poll = gp_actframe_delete_all_poll; + ot->exec = gpencil_actframe_delete_all_exec; + ot->poll = gpencil_actframe_delete_all_poll; } /** \} */ @@ -1999,7 +2000,7 @@ typedef enum eGP_DissolveMode { } eGP_DissolveMode; /* Delete selected strokes */ -static int gp_delete_selected_strokes(bContext *C) +static int gpencil_delete_selected_strokes(bContext *C) { bool changed = false; bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -2057,7 +2058,7 @@ static int gp_delete_selected_strokes(bContext *C) /* ----------------------------------- */ /* Delete selected points but keep the stroke */ -static int gp_dissolve_selected_points(bContext *C, eGP_DissolveMode mode) +static int gpencil_dissolve_selected_points(bContext *C, eGP_DissolveMode mode) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -2283,7 +2284,9 @@ typedef struct tGPDeleteIsland { int end_idx; } tGPDeleteIsland; -static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDstroke *gps_last) +static void gpencil_stroke_join_islands(bGPDframe *gpf, + bGPDstroke *gps_first, + bGPDstroke *gps_last) { bGPDspoint *pt = NULL; bGPDspoint *pt_final = NULL; @@ -2518,7 +2521,7 @@ void gpencil_stroke_delete_tagged_points(bGPDframe *gpf, } /* if cyclic, need to join last stroke with first stroke */ if ((is_cyclic) && (gps_first != NULL) && (gps_first != new_stroke)) { - gp_stroke_join_islands(gpf, gps_first, new_stroke); + gpencil_stroke_join_islands(gpf, gps_first, new_stroke); } } @@ -2531,7 +2534,7 @@ void gpencil_stroke_delete_tagged_points(bGPDframe *gpf, } /* Split selected strokes into segments, splitting on selected points */ -static int gp_delete_selected_points(bContext *C) +static int gpencil_delete_selected_points(bContext *C) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -2588,7 +2591,7 @@ static int gp_delete_selected_points(bContext *C) /* simple wrapper to external call */ int gpencil_delete_selected_point_wrap(bContext *C) { - return gp_delete_selected_points(C); + return gpencil_delete_selected_points(C); } /** \} */ @@ -2597,22 +2600,22 @@ int gpencil_delete_selected_point_wrap(bContext *C) /** \name Delete Operator * \{ */ -static int gp_delete_exec(bContext *C, wmOperator *op) +static int gpencil_delete_exec(bContext *C, wmOperator *op) { eGP_DeleteMode mode = RNA_enum_get(op->ptr, "type"); int result = OPERATOR_CANCELLED; switch (mode) { case GP_DELETEOP_STROKES: /* selected strokes */ - result = gp_delete_selected_strokes(C); + result = gpencil_delete_selected_strokes(C); break; case GP_DELETEOP_POINTS: /* selected points (breaks the stroke into segments) */ - result = gp_delete_selected_points(C); + result = gpencil_delete_selected_points(C); break; case GP_DELETEOP_FRAME: /* active frame */ - result = gp_actframe_delete_exec(C, op); + result = gpencil_actframe_delete_exec(C, op); break; } @@ -2639,8 +2642,8 @@ void GPENCIL_OT_delete(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_delete_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_delete_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER; @@ -2660,11 +2663,11 @@ void GPENCIL_OT_delete(wmOperatorType *ot) /** \name Dissolve Operator * \{ */ -static int gp_dissolve_exec(bContext *C, wmOperator *op) +static int gpencil_dissolve_exec(bContext *C, wmOperator *op) { eGP_DissolveMode mode = RNA_enum_get(op->ptr, "type"); - return gp_dissolve_selected_points(C, mode); + return gpencil_dissolve_selected_points(C, mode); } void GPENCIL_OT_dissolve(wmOperatorType *ot) @@ -2687,8 +2690,8 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_dissolve_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_dissolve_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER; @@ -2712,7 +2715,7 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot) /* NOTE: For now, we only allow these in the 3D view, as other editors do not * define a cursor or gridstep which can be used */ -static bool gp_snap_poll(bContext *C) +static bool gpencil_snap_poll(bContext *C) { ScrArea *area = CTX_wm_area(C); Object *ob = CTX_data_active_object(C); @@ -2721,7 +2724,7 @@ static bool gp_snap_poll(bContext *C) ((area != NULL) && (area->spacetype == SPACE_VIEW3D)); } -static int gp_snap_to_grid(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_snap_to_grid(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); RegionView3D *rv3d = CTX_wm_region_data(C); @@ -2788,8 +2791,8 @@ void GPENCIL_OT_snap_to_grid(wmOperatorType *ot) ot->description = "Snap selected points to the nearest grid points"; /* callbacks */ - ot->exec = gp_snap_to_grid; - ot->poll = gp_snap_poll; + ot->exec = gpencil_snap_to_grid; + ot->poll = gpencil_snap_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2801,7 +2804,7 @@ void GPENCIL_OT_snap_to_grid(wmOperatorType *ot) /** \name Snapping Selection to Cursor Operator * \{ */ -static int gp_snap_to_cursor(bContext *C, wmOperator *op) +static int gpencil_snap_to_cursor(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -2877,8 +2880,8 @@ void GPENCIL_OT_snap_to_cursor(wmOperatorType *ot) ot->description = "Snap selected points/strokes to the cursor"; /* callbacks */ - ot->exec = gp_snap_to_cursor; - ot->poll = gp_snap_poll; + ot->exec = gpencil_snap_to_cursor; + ot->poll = gpencil_snap_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2897,7 +2900,7 @@ void GPENCIL_OT_snap_to_cursor(wmOperatorType *ot) /** \name Snapping Cursor to Selection Operator * \{ */ -static int gp_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op)) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Object *obact = CTX_data_active_object(C); @@ -2982,8 +2985,8 @@ void GPENCIL_OT_snap_cursor_to_selected(wmOperatorType *ot) ot->description = "Snap cursor to center of selected points"; /* callbacks */ - ot->exec = gp_snap_cursor_to_sel; - ot->poll = gp_snap_poll; + ot->exec = gpencil_snap_cursor_to_sel; + ot->poll = gpencil_snap_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2995,7 +2998,7 @@ void GPENCIL_OT_snap_cursor_to_selected(wmOperatorType *ot) /** \name Apply Layer Thickness Change to Strokes Operator * \{ */ -static int gp_stroke_apply_thickness_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_apply_thickness_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -3036,7 +3039,7 @@ void GPENCIL_OT_stroke_apply_thickness(wmOperatorType *ot) ot->description = "Apply the thickness change of the layer to its strokes"; /* api callbacks */ - ot->exec = gp_stroke_apply_thickness_exec; + ot->exec = gpencil_stroke_apply_thickness_exec; ot->poll = gpencil_active_layer_poll; } @@ -3052,7 +3055,7 @@ enum { GP_STROKE_CYCLIC_TOGGLE = 3, }; -static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_cyclical_set_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Object *ob = CTX_data_active_object(C); @@ -3151,7 +3154,7 @@ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot) ot->description = "Close or open the selected stroke adding an edge from last to first point"; /* api callbacks */ - ot->exec = gp_stroke_cyclical_set_exec; + ot->exec = gpencil_stroke_cyclical_set_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3177,7 +3180,7 @@ enum { GP_STROKE_CAPS_TOGGLE_DEFAULT = 3, }; -static int gp_stroke_caps_set_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_caps_set_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Object *ob = CTX_data_active_object(C); @@ -3254,7 +3257,7 @@ void GPENCIL_OT_stroke_caps_set(wmOperatorType *ot) ot->description = "Change Stroke caps mode (rounded or flat)"; /* api callbacks */ - ot->exec = gp_stroke_caps_set_exec; + ot->exec = gpencil_stroke_caps_set_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3426,7 +3429,7 @@ static void gpencil_stroke_join_strokes(bGPDstroke *gps_a, } } -static int gp_stroke_join_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_join_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *activegpl = BKE_gpencil_layer_active_get(gpd); @@ -3553,7 +3556,7 @@ void GPENCIL_OT_stroke_join(wmOperatorType *ot) ot->description = "Join selected strokes (optionally as new stroke)"; /* api callbacks */ - ot->exec = gp_stroke_join_exec; + ot->exec = gpencil_stroke_join_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3574,7 +3577,7 @@ void GPENCIL_OT_stroke_join(wmOperatorType *ot) /** \name Stroke Flip Operator * \{ */ -static int gp_stroke_flip_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_flip_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); Object *ob = CTX_data_active_object(C); @@ -3624,7 +3627,7 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot) ot->description = "Change direction of the points of the selected strokes"; /* api callbacks */ - ot->exec = gp_stroke_flip_exec; + ot->exec = gpencil_stroke_flip_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3637,7 +3640,7 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot) /** \name Stroke Re-project Operator * \{ */ -static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) +static int gpencil_strokes_reproject_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Scene *scene = CTX_data_scene(C); @@ -3722,8 +3725,8 @@ void GPENCIL_OT_reproject(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_strokes_reproject_exec; - ot->poll = gp_strokes_edit3d_poll; + ot->exec = gpencil_strokes_reproject_exec; + ot->poll = gpencil_strokes_edit3d_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3740,7 +3743,7 @@ void GPENCIL_OT_reproject(wmOperatorType *ot) "Keep original strokes and create a copy before reprojecting instead of reproject them"); } -static int gp_recalc_geometry_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_recalc_geometry_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = CTX_data_active_object(C); if ((ob == NULL) || (ob->type != OB_GPENCIL)) { @@ -3769,7 +3772,7 @@ void GPENCIL_OT_recalc_geometry(wmOperatorType *ot) ot->description = "Update all internal geometry data"; /* callbacks */ - ot->exec = gp_recalc_geometry_exec; + ot->exec = gpencil_recalc_geometry_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3783,7 +3786,7 @@ void GPENCIL_OT_recalc_geometry(wmOperatorType *ot) * \{ */ /* helper to smooth */ -static void gp_smooth_stroke(bContext *C, wmOperator *op) +static void gpencil_smooth_stroke(bContext *C, wmOperator *op) { const int repeat = RNA_int_get(op->ptr, "repeat"); float factor = RNA_float_get(op->ptr, "factor"); @@ -3830,7 +3833,7 @@ static void gp_smooth_stroke(bContext *C, wmOperator *op) } /* helper: Count how many points need to be inserted */ -static int gp_count_subdivision_cuts(bGPDstroke *gps) +static int gpencil_count_subdivision_cuts(bGPDstroke *gps) { bGPDspoint *pt; int i; @@ -3848,7 +3851,7 @@ static int gp_count_subdivision_cuts(bGPDstroke *gps) return totnewpoints; } -static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_subdivide_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDspoint *temp_points; @@ -3867,7 +3870,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) if (gps->flag & GP_STROKE_SELECT) { /* loop as many times as cuts */ for (int s = 0; s < cuts; s++) { - totnewpoints = gp_count_subdivision_cuts(gps); + totnewpoints = gpencil_count_subdivision_cuts(gps); if (totnewpoints == 0) { continue; } @@ -3967,7 +3970,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) GP_EDITABLE_STROKES_END(gpstroke_iter); /* smooth stroke */ - gp_smooth_stroke(C, op); + gpencil_smooth_stroke(C, op); /* notifiers */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); @@ -3988,7 +3991,7 @@ void GPENCIL_OT_stroke_subdivide(wmOperatorType *ot) "them"; /* api callbacks */ - ot->exec = gp_stroke_subdivide_exec; + ot->exec = gpencil_stroke_subdivide_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4015,7 +4018,7 @@ void GPENCIL_OT_stroke_subdivide(wmOperatorType *ot) } /* ** simplify stroke *** */ -static int gp_stroke_simplify_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_simplify_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); float factor = RNA_float_get(op->ptr, "factor"); @@ -4051,7 +4054,7 @@ void GPENCIL_OT_stroke_simplify(wmOperatorType *ot) ot->description = "Simplify selected stroked reducing number of points"; /* api callbacks */ - ot->exec = gp_stroke_simplify_exec; + ot->exec = gpencil_stroke_simplify_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4064,7 +4067,7 @@ void GPENCIL_OT_stroke_simplify(wmOperatorType *ot) } /* ** simplify stroke using fixed algorithm *** */ -static int gp_stroke_simplify_fixed_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_simplify_fixed_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); int steps = RNA_int_get(op->ptr, "step"); @@ -4101,7 +4104,7 @@ void GPENCIL_OT_stroke_simplify_fixed(wmOperatorType *ot) ot->description = "Simplify selected stroked reducing number of points using fixed algorithm"; /* api callbacks */ - ot->exec = gp_stroke_simplify_fixed_exec; + ot->exec = gpencil_stroke_simplify_fixed_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4115,7 +4118,7 @@ void GPENCIL_OT_stroke_simplify_fixed(wmOperatorType *ot) } /* ** Resample stroke *** */ -static int gp_stroke_sample_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_sample_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); const float length = RNA_float_get(op->ptr, "length"); @@ -4150,7 +4153,7 @@ void GPENCIL_OT_stroke_sample(wmOperatorType *ot) ot->description = "Sample stroke points to predefined segment length"; /* api callbacks */ - ot->exec = gp_stroke_sample_exec; + ot->exec = gpencil_stroke_sample_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4168,7 +4171,7 @@ void GPENCIL_OT_stroke_sample(wmOperatorType *ot) /** \name Stroke Trim Operator * \{ */ -static int gp_stroke_trim_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_trim_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -4225,7 +4228,7 @@ void GPENCIL_OT_stroke_trim(wmOperatorType *ot) ot->description = "Trim selected stroke to first loop or intersection"; /* api callbacks */ - ot->exec = gp_stroke_trim_exec; + ot->exec = gpencil_stroke_trim_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4247,7 +4250,7 @@ typedef enum eGP_SeparateModes { GP_SEPARATE_LAYER, } eGP_SeparateModes; -static int gp_stroke_separate_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) { Base *base_new; Main *bmain = CTX_data_main(C); @@ -4447,8 +4450,8 @@ void GPENCIL_OT_stroke_separate(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_stroke_separate_exec; - ot->poll = gp_strokes_edit3d_poll; + ot->exec = gpencil_stroke_separate_exec; + ot->poll = gpencil_strokes_edit3d_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4463,7 +4466,7 @@ void GPENCIL_OT_stroke_separate(wmOperatorType *ot) /** \name Stroke Split Operator * \{ */ -static int gp_stroke_split_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_split_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -4552,8 +4555,8 @@ void GPENCIL_OT_stroke_split(wmOperatorType *ot) ot->description = "Split selected points as new stroke on same frame"; /* callbacks */ - ot->exec = gp_stroke_split_exec; - ot->poll = gp_strokes_edit3d_poll; + ot->exec = gpencil_stroke_split_exec; + ot->poll = gpencil_strokes_edit3d_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4565,7 +4568,7 @@ void GPENCIL_OT_stroke_split(wmOperatorType *ot) /** \name Stroke Smooth Operator * \{ */ -static int gp_stroke_smooth_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_smooth_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -4574,7 +4577,7 @@ static int gp_stroke_smooth_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - gp_smooth_stroke(C, op); + gpencil_smooth_stroke(C, op); /* notifiers */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); @@ -4593,7 +4596,7 @@ void GPENCIL_OT_stroke_smooth(wmOperatorType *ot) ot->description = "Smooth selected strokes"; /* api callbacks */ - ot->exec = gp_stroke_smooth_exec; + ot->exec = gpencil_stroke_smooth_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4884,7 +4887,7 @@ bool ED_object_gpencil_exit(struct Main *bmain, Object *ob) /** \name Merge By Distance Operator * \{ */ -static bool gp_merge_by_distance_poll(bContext *C) +static bool gpencil_merge_by_distance_poll(bContext *C) { Object *ob = CTX_data_active_object(C); if ((ob == NULL) || (ob->type != OB_GPENCIL)) { @@ -4900,7 +4903,7 @@ static bool gp_merge_by_distance_poll(bContext *C) return ((gpl != NULL) && (ob->mode == OB_MODE_EDIT_GPENCIL)); } -static int gp_merge_by_distance_exec(bContext *C, wmOperator *op) +static int gpencil_merge_by_distance_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -4937,8 +4940,8 @@ void GPENCIL_OT_stroke_merge_by_distance(wmOperatorType *ot) ot->description = "Merge points by distance"; /* api callbacks */ - ot->exec = gp_merge_by_distance_exec; - ot->poll = gp_merge_by_distance_poll; + ot->exec = gpencil_merge_by_distance_exec; + ot->poll = gpencil_merge_by_distance_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |