diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-06-30 09:37:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-06-30 09:42:19 +0300 |
commit | 501d2443d03cce18985fab3ffad5d23238748f3e (patch) | |
tree | 1d127d4e4c6d82fc85feedc9826dd5619174e346 /source/blender/blenkernel/intern | |
parent | df9597cfba78deb40009553ab9dcf09c21edd434 (diff) |
Cleanup: use const arguments for accessor functions
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil_geom.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer_utils.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/shader_fx.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/undo_system.c | 4 |
12 files changed, 39 insertions, 35 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 5799f82bf94..d0604f4bfda 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -358,7 +358,7 @@ bArmature *BKE_armature_from_object(Object *ob) return NULL; } -int BKE_armature_bonelist_count(ListBase *lb) +int BKE_armature_bonelist_count(const ListBase *lb) { int i = 0; LISTBASE_FOREACH (Bone *, bone, lb) { diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index fdffe7dca57..24266dc6bea 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -79,7 +79,8 @@ static bool collection_object_remove(Main *bmain, static CollectionChild *collection_find_child(Collection *parent, Collection *collection); static CollectionParent *collection_find_parent(Collection *child, Collection *collection); -static bool collection_find_child_recursive(Collection *parent, Collection *collection); +static bool collection_find_child_recursive(const Collection *parent, + const Collection *collection); /** \} */ @@ -1521,9 +1522,9 @@ static CollectionChild *collection_find_child(Collection *parent, Collection *co return BLI_findptr(&parent->children, collection, offsetof(CollectionChild, collection)); } -static bool collection_find_child_recursive(Collection *parent, Collection *collection) +static bool collection_find_child_recursive(const Collection *parent, const Collection *collection) { - LISTBASE_FOREACH (CollectionChild *, child, &parent->children) { + LISTBASE_FOREACH (const CollectionChild *, child, &parent->children) { if (child->collection == collection) { return true; } @@ -1536,7 +1537,7 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll return false; } -bool BKE_collection_has_collection(Collection *parent, Collection *collection) +bool BKE_collection_has_collection(const Collection *parent, const Collection *collection) { return collection_find_child_recursive(parent, collection); } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 18dac2fb679..7fe7b38e120 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -510,8 +510,11 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C, * with optional argument for precision required. * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -static int BKE_fcurve_bezt_binarysearch_index_ex( - BezTriple array[], float frame, int arraylen, float threshold, bool *r_replace) +static int BKE_fcurve_bezt_binarysearch_index_ex(const BezTriple array[], + const float frame, + const int arraylen, + const float threshold, + bool *r_replace) { int start = 0, end = arraylen; int loopbreaker = 0, maxloop = arraylen * 2; @@ -597,9 +600,9 @@ static int BKE_fcurve_bezt_binarysearch_index_ex( /* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve) * Returns the index to insert at (data already at that index will be offset if replace is 0) */ -int BKE_fcurve_bezt_binarysearch_index(BezTriple array[], - float frame, - int arraylen, +int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[], + const float frame, + const int arraylen, bool *r_replace) { /* This is just a wrapper which uses the default threshold. */ diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index 2b16bbb10b2..53939da08e2 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -2616,7 +2616,7 @@ void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4]) } /* Used for "move only origins" in object_data_transform.c */ -int BKE_gpencil_stroke_point_count(bGPdata *gpd) +int BKE_gpencil_stroke_point_count(const bGPdata *gpd) { int total_points = 0; @@ -2624,7 +2624,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd) return 0; } - LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + LISTBASE_FOREACH (const bGPDlayer *, gpl, &gpd->layers) { /* FIXME: For now, we just skip parented layers. * Otherwise, we have to update each frame to find * the current parent position/effects. @@ -2633,7 +2633,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd) continue; } - LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { + LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) { LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { total_points += gps->totpoints; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 073276b7011..1a988e687db 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -2048,9 +2048,9 @@ void BKE_keyblock_convert_to_lattice(KeyBlock *kb, Lattice *lt) /************************* Curve ************************/ -int BKE_keyblock_curve_element_count(ListBase *nurb) +int BKE_keyblock_curve_element_count(const ListBase *nurb) { - Nurb *nu; + const Nurb *nu; int tot = 0; nu = nurb->first; diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 1edf83b6685..d49eb0d4da8 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -676,10 +676,10 @@ LayerCollection *BKE_layer_collection_activate_parent(ViewLayer *view_layer, Lay /** * Recursively get the count of collections */ -static int collection_count(ListBase *lb) +static int collection_count(const ListBase *lb) { int i = 0; - LISTBASE_FOREACH (LayerCollection *, lc, lb) { + LISTBASE_FOREACH (const LayerCollection *, lc, lb) { i += collection_count(&lc->layer_collections) + 1; } return i; @@ -689,7 +689,7 @@ static int collection_count(ListBase *lb) * Get the total number of collections * (including all the nested collections) */ -int BKE_layer_collection_count(ViewLayer *view_layer) +int BKE_layer_collection_count(const ViewLayer *view_layer) { return collection_count(&view_layer->layer_collections); } @@ -1504,7 +1504,7 @@ static LayerCollection *find_layer_collection_by_scene_collection(LayerCollectio /** * Return the first matching LayerCollection in the ViewLayer for the Collection. */ -LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *view_layer, +LayerCollection *BKE_layer_collection_first_from_scene_collection(const ViewLayer *view_layer, const Collection *collection) { LISTBASE_FOREACH (LayerCollection *, layer_collection, &view_layer->layer_collections) { @@ -1520,7 +1520,7 @@ LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *vie /** * See if view layer has the scene collection linked directly, or indirectly (nested) */ -bool BKE_view_layer_has_collection(ViewLayer *view_layer, const Collection *collection) +bool BKE_view_layer_has_collection(const ViewLayer *view_layer, const Collection *collection) { return BKE_layer_collection_first_from_scene_collection(view_layer, collection) != NULL; } diff --git a/source/blender/blenkernel/intern/layer_utils.c b/source/blender/blenkernel/intern/layer_utils.c index 974a5a24e8a..10ab0a06dd0 100644 --- a/source/blender/blenkernel/intern/layer_utils.c +++ b/source/blender/blenkernel/intern/layer_utils.c @@ -164,11 +164,11 @@ Object **BKE_view_layer_array_from_objects_in_mode_params(ViewLayer *view_layer, /** \name Filter Functions * \{ */ -bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data)) +bool BKE_view_layer_filter_edit_mesh_has_uvs(const Object *ob, void *UNUSED(user_data)) { if (ob->type == OB_MESH) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_mesh; + const Mesh *me = ob->data; + const BMEditMesh *em = me->edit_mesh; if (em != NULL) { if (CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV) != -1) { return true; @@ -178,11 +178,11 @@ bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data) return false; } -bool BKE_view_layer_filter_edit_mesh_has_edges(Object *ob, void *UNUSED(user_data)) +bool BKE_view_layer_filter_edit_mesh_has_edges(const Object *ob, void *UNUSED(user_data)) { if (ob->type == OB_MESH) { - Mesh *me = ob->data; - BMEditMesh *em = me->edit_mesh; + const Mesh *me = ob->data; + const BMEditMesh *em = me->edit_mesh; if (em != NULL) { if (em->bm->totedge != 0) { return true; diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 9f316ec60c0..0d84022da77 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -2985,7 +2985,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m } } -bool pbvh_has_mask(PBVH *pbvh) +bool pbvh_has_mask(const PBVH *pbvh) { switch (pbvh->type) { case PBVH_GRIDS: diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c index 60f0b744e59..b537bdc5479 100644 --- a/source/blender/blenkernel/intern/shader_fx.c +++ b/source/blender/blenkernel/intern/shader_fx.c @@ -58,9 +58,9 @@ static ShaderFxTypeInfo *shader_fx_types[NUM_SHADER_FX_TYPES] = {NULL}; /* Methods - Evaluation Loops, etc. */ /* check if exist grease pencil effects */ -bool BKE_shaderfx_has_gpencil(Object *ob) +bool BKE_shaderfx_has_gpencil(const Object *ob) { - ShaderFxData *fx; + const ShaderFxData *fx; for (fx = ob->shader_fx.first; fx; fx = fx->next) { const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx->type); if (fxi->type == eShaderFxType_GpencilType) { diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 123843c88db..9d871777c61 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3205,7 +3205,7 @@ void sbObjectToSoftbody(Object *ob) free_softbody_intern(ob->soft); } -static bool object_has_edges(Object *ob) +static bool object_has_edges(const Object *ob) { if (ob->type == OB_MESH) { return ((Mesh *)ob->data)->totedge; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 27f5593c2ca..74845e3f1b9 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -781,12 +781,12 @@ static void txt_curs_sel(Text *text, TextLine ***linep, int **charp) *charp = &text->selc; } -bool txt_cursor_is_line_start(Text *text) +bool txt_cursor_is_line_start(const Text *text) { return (text->selc == 0); } -bool txt_cursor_is_line_end(Text *text) +bool txt_cursor_is_line_end(const Text *text) { return (text->selc == text->sell->len); } @@ -1239,7 +1239,7 @@ void txt_order_cursors(Text *text, const bool reverse) } } -bool txt_has_sel(Text *text) +bool txt_has_sel(const Text *text) { return ((text->curl != text->sell) || (text->curc != text->selc)); } diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index 377802f1af7..14dd286a315 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -368,10 +368,10 @@ void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C) } /* name optional */ -bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name) +bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name) { if (name) { - UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name)); + const UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name)); return us && us->prev; } |