From ab7ebf2b10f67b002447fb0e2cb352c2c178e128 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 18 Oct 2017 15:07:26 +1100 Subject: Cleanup: Use const for RNA EnumPropertyItem args Practically all access to enum data is read-only. --- source/blender/editors/gpencil/gpencil_convert.c | 8 ++++---- source/blender/editors/gpencil/gpencil_data.c | 8 ++++---- source/blender/editors/gpencil/gpencil_edit.c | 10 +++++----- source/blender/editors/gpencil/gpencil_intern.h | 18 ++++++++++++------ source/blender/editors/gpencil/gpencil_paint.c | 2 +- source/blender/editors/gpencil/gpencil_select.c | 2 +- source/blender/editors/gpencil/gpencil_utils.c | 10 ++++++---- 7 files changed, 33 insertions(+), 25 deletions(-) (limited to 'source/blender/editors/gpencil') diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index d0f68c4b8f3..7d455f214db 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -106,20 +106,20 @@ enum { }; /* RNA enum define */ -static EnumPropertyItem prop_gpencil_convertmodes[] = { +static const EnumPropertyItem prop_gpencil_convertmodes[] = { {GP_STROKECONVERT_PATH, "PATH", ICON_CURVE_PATH, "Path", "Animation path"}, {GP_STROKECONVERT_CURVE, "CURVE", ICON_CURVE_BEZCURVE, "Bezier Curve", "Smooth Bezier curve"}, {GP_STROKECONVERT_POLY, "POLY", ICON_MESH_DATA, "Polygon Curve", "Bezier curve with straight-line segments (vector handles)"}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_gpencil_convert_timingmodes_restricted[] = { +static const EnumPropertyItem prop_gpencil_convert_timingmodes_restricted[] = { {GP_STROKECONVERT_TIMING_NONE, "NONE", 0, "No Timing", "Ignore timing"}, {GP_STROKECONVERT_TIMING_LINEAR, "LINEAR", 0, "Linear", "Simple linear timing"}, {0, NULL, 0, NULL, NULL}, }; -static EnumPropertyItem prop_gpencil_convert_timingmodes[] = { +static const EnumPropertyItem prop_gpencil_convert_timingmodes[] = { {GP_STROKECONVERT_TIMING_NONE, "NONE", 0, "No Timing", "Ignore timing"}, {GP_STROKECONVERT_TIMING_LINEAR, "LINEAR", 0, "Linear", "Simple linear timing"}, {GP_STROKECONVERT_TIMING_FULL, "FULL", 0, "Original", "Use the original timing, gaps included"}, @@ -128,7 +128,7 @@ static EnumPropertyItem prop_gpencil_convert_timingmodes[] = { {0, NULL, 0, NULL, NULL}, }; -static EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), +static const EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { if (RNA_boolean_get(ptr, "use_timing_data")) { diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 6980ad46241..93c9d21e717 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -302,7 +302,7 @@ static int gp_layer_move_exec(bContext *C, wmOperator *op) void GPENCIL_OT_layer_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_LAYER_MOVE_UP, "UP", 0, "Up", ""}, {GP_LAYER_MOVE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -831,7 +831,7 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) void GPENCIL_OT_stroke_arrange(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_STROKE_MOVE_UP, "UP", 0, "Bring Forward", ""}, {GP_STROKE_MOVE_DOWN, "DOWN", 0, "Send Backward", ""}, {GP_STROKE_MOVE_TOP, "TOP", 0, "Bring to Front", ""}, @@ -1165,7 +1165,7 @@ static int gp_brush_move_exec(bContext *C, wmOperator *op) void GPENCIL_OT_brush_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_BRUSH_MOVE_UP, "UP", 0, "Up", ""}, {GP_BRUSH_MOVE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL } @@ -1922,7 +1922,7 @@ static int gp_palettecolor_move_exec(bContext *C, wmOperator *op) void GPENCIL_OT_palettecolor_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_COLOR_MOVE_UP, "UP", 0, "Up", ""}, {GP_COLOR_MOVE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 55a3fc09f2e..bd5a42df99a 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -651,7 +651,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) void GPENCIL_OT_paste(wmOperatorType *ot) { - static EnumPropertyItem copy_type[] = { + static const EnumPropertyItem copy_type[] = { {GP_COPY_ONLY, "COPY", 0, "Copy", ""}, {GP_COPY_MERGE, "MERGE", 0, "Merge", ""}, {0, NULL, 0, NULL, NULL} @@ -1316,7 +1316,7 @@ static int gp_delete_exec(bContext *C, wmOperator *op) void GPENCIL_OT_delete(wmOperatorType *ot) { - static EnumPropertyItem prop_gpencil_delete_types[] = { + static const EnumPropertyItem prop_gpencil_delete_types[] = { {GP_DELETEOP_POINTS, "POINTS", 0, "Points", "Delete selected points and split strokes into segments"}, {GP_DELETEOP_STROKES, "STROKES", 0, "Strokes", "Delete selected strokes"}, {GP_DELETEOP_FRAME, "FRAME", 0, "Frame", "Delete active frame"}, @@ -1736,7 +1736,7 @@ static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op) */ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot) { - static EnumPropertyItem cyclic_type[] = { + static const EnumPropertyItem cyclic_type[] = { {GP_STROKE_CYCLIC_CLOSE, "CLOSE", 0, "Close all", ""}, {GP_STROKE_CYCLIC_OPEN, "OPEN", 0, "Open all", ""}, {GP_STROKE_CYCLIC_TOGGLE, "TOGGLE", 0, "Toggle", ""}, @@ -1998,7 +1998,7 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op) void GPENCIL_OT_stroke_join(wmOperatorType *ot) { - static EnumPropertyItem join_type[] = { + static const EnumPropertyItem join_type[] = { {GP_STROKE_JOIN, "JOIN", 0, "Join", ""}, {GP_STROKE_JOINCOPY, "JOINCOPY", 0, "Join and Copy", ""}, {0, NULL, 0, NULL, NULL} @@ -2184,7 +2184,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) void GPENCIL_OT_reproject(wmOperatorType *ot) { - static EnumPropertyItem reproject_type[] = { + static const EnumPropertyItem reproject_type[] = { {GP_REPROJECT_PLANAR, "PLANAR", 0, "Planar", "Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint " "using 'Cursor' Stroke Placement"}, diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index a3734c56c59..04bcea02c9b 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -121,16 +121,22 @@ void gp_randomize_stroke(bGPDstroke *gps, bGPDbrush *brush); /* Layers Enums -------------------------------------- */ -struct EnumPropertyItem *ED_gpencil_layers_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -struct EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const struct EnumPropertyItem *ED_gpencil_layers_enum_itemf( + struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, + bool *r_free); +const struct EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf( + struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, + bool *r_free); /* Enums of GP Brushes */ -EnumPropertyItem *ED_gpencil_brushes_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), - bool *r_free); +const EnumPropertyItem *ED_gpencil_brushes_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), + bool *r_free); /* Enums of GP palettes */ -EnumPropertyItem *ED_gpencil_palettes_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), - bool *r_free); +const EnumPropertyItem *ED_gpencil_palettes_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), + bool *r_free); /* ***************************************************** */ /* Operator Defines */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index ea87364d67f..cff198db6c0 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2735,7 +2735,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* ------------------------------- */ -static EnumPropertyItem prop_gpencil_drawmodes[] = { +static const EnumPropertyItem prop_gpencil_drawmodes[] = { {GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", "Draw freehand stroke(s)"}, {GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", "Draw straight line segment(s)"}, {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", "Click to place endpoints of straight line segments (connected)"}, diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 3d9689ab54f..07abab8af2e 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -371,7 +371,7 @@ static int gpencil_select_grouped_exec(bContext *C, wmOperator *op) void GPENCIL_OT_select_grouped(wmOperatorType *ot) { - static EnumPropertyItem prop_select_grouped_types[] = { + static const EnumPropertyItem prop_select_grouped_types[] = { {GP_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"}, {GP_SEL_SAME_COLOR, "COLOR", 0, "Color", "Shared colors"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index ed05b8be9ca..672c87ed6fd 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -307,7 +307,8 @@ int gp_active_palettecolor_poll(bContext *C) /* NOTE: These include an option to create a new layer and use that... */ /* Just existing layers */ -EnumPropertyItem *ED_gpencil_layers_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *ED_gpencil_layers_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { bGPdata *gpd = CTX_data_gpencil_data(C); bGPDlayer *gpl; @@ -340,7 +341,8 @@ EnumPropertyItem *ED_gpencil_layers_enum_itemf(bContext *C, PointerRNA *UNUSED(p } /* Existing + Option to add/use new layer */ -EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { bGPdata *gpd = CTX_data_gpencil_data(C); bGPDlayer *gpl; @@ -1098,7 +1100,7 @@ bool ED_gpencil_stroke_minmax( } /* Dynamic Enums of GP Brushes */ -EnumPropertyItem *ED_gpencil_brushes_enum_itemf( +const EnumPropertyItem *ED_gpencil_brushes_enum_itemf( bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { @@ -1133,7 +1135,7 @@ EnumPropertyItem *ED_gpencil_brushes_enum_itemf( } /* Dynamic Enums of GP Palettes */ -EnumPropertyItem *ED_gpencil_palettes_enum_itemf( +const EnumPropertyItem *ED_gpencil_palettes_enum_itemf( bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { -- cgit v1.2.3