diff options
author | Bastien Montagne <bastien@blender.org> | 2022-05-25 13:23:11 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-05-25 13:23:11 +0300 |
commit | c64e9c6ae239adf0be09599cd9ea56522d43a42b (patch) | |
tree | 63e6dda91e89dd3bdc127e603b097f9d1c312022 /source/blender/makesrna/intern/rna_scene.c | |
parent | 4949dd54eb4576442050690f44b2c6ec7366e011 (diff) |
Cleanup: Add more const'ness to RNA API.
This commit makes PointerRNA passed to RNA path API const.
Main change was in the `path` callback for RNA structs, and indirectly
the `getlength` callback of properties.
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 63a68d04a97..0e423b71f1d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1100,12 +1100,12 @@ static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter) iter->valid = (internal->link != NULL); } -static char *rna_SceneEEVEE_path(PointerRNA *UNUSED(ptr)) +static char *rna_SceneEEVEE_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("eevee"); } -static char *rna_SceneGpencil_path(PointerRNA *UNUSED(ptr)) +static char *rna_SceneGpencil_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("grease_pencil_settings"); } @@ -1129,17 +1129,17 @@ static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *ite rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip); } -static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_RenderSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("render"); } -static char *rna_BakeSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_BakeSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("render.bake"); } -static char *rna_ImageFormatSettings_path(PointerRNA *ptr) +static char *rna_ImageFormatSettings_path(const PointerRNA *ptr) { ImageFormatData *imf = (ImageFormatData *)ptr->data; ID *id = ptr->owner_id; @@ -1787,10 +1787,11 @@ void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) rna_Scene_glsl_update(bmain, activescene, ptr); } -static char *rna_ViewLayerEEVEE_path(PointerRNA *ptr) +static char *rna_ViewLayerEEVEE_path(const PointerRNA *ptr) { - ViewLayerEEVEE *view_layer_eevee = (ViewLayerEEVEE *)ptr->data; - ViewLayer *view_layer = (ViewLayer *)((uint8_t *)view_layer_eevee - offsetof(ViewLayer, eevee)); + const ViewLayerEEVEE *view_layer_eevee = (ViewLayerEEVEE *)ptr->data; + const ViewLayer *view_layer = (ViewLayer *)((uint8_t *)view_layer_eevee - + offsetof(ViewLayer, eevee)); char rna_path[sizeof(view_layer->name) * 3]; const size_t view_layer_path_len = rna_ViewLayer_path_buffer_get( @@ -1801,9 +1802,9 @@ static char *rna_ViewLayerEEVEE_path(PointerRNA *ptr) return BLI_strdup(rna_path); } -static char *rna_SceneRenderView_path(PointerRNA *ptr) +static char *rna_SceneRenderView_path(const PointerRNA *ptr) { - SceneRenderView *srv = (SceneRenderView *)ptr->data; + const SceneRenderView *srv = (SceneRenderView *)ptr->data; char srv_name_esc[sizeof(srv->name) * 2]; BLI_str_escape(srv_name_esc, srv->name, sizeof(srv_name_esc)); return BLI_sprintfN("render.views[\"%s\"]", srv_name_esc); @@ -2071,10 +2072,10 @@ static void rna_View3DCursor_matrix_set(PointerRNA *ptr, const float *values) BKE_scene_cursor_from_mat4(cursor, unit_mat, false); } -static char *rna_TransformOrientationSlot_path(PointerRNA *ptr) +static char *rna_TransformOrientationSlot_path(const PointerRNA *ptr) { - Scene *scene = (Scene *)ptr->owner_id; - TransformOrientationSlot *orientation_slot = ptr->data; + const Scene *scene = (Scene *)ptr->owner_id; + const TransformOrientationSlot *orientation_slot = ptr->data; if (!ELEM(NULL, scene, orientation_slot)) { for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) { @@ -2089,7 +2090,7 @@ static char *rna_TransformOrientationSlot_path(PointerRNA *ptr) return BLI_strdup("transform_orientation_slots[0]"); } -static char *rna_View3DCursor_path(PointerRNA *UNUSED(ptr)) +static char *rna_View3DCursor_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("cursor"); } @@ -2188,17 +2189,17 @@ static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr) rna_UnifiedPaintSettings_update(C, ptr); } -static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_UnifiedPaintSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.unified_paint_settings"); } -static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_CurvePaintSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.curve_paint_settings"); } -static char *rna_SequencerToolSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_SequencerToolSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.sequencer_tool_settings"); } @@ -2222,7 +2223,7 @@ static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr)) } } -static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr)) +static char *rna_MeshStatVis_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings.statvis"); } @@ -2260,7 +2261,7 @@ static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), SEQ_cache_cleanup((Scene *)ptr->owner_id); } -static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_ToolSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("tool_settings"); } @@ -2701,12 +2702,12 @@ static void rna_UnitSettings_system_update(Main *UNUSED(bmain), } } -static char *rna_UnitSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_UnitSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("unit_settings"); } -static char *rna_FFmpegSettings_path(PointerRNA *UNUSED(ptr)) +static char *rna_FFmpegSettings_path(const PointerRNA *UNUSED(ptr)) { return BLI_strdup("render.ffmpeg"); } |