diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-08-06 10:54:56 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-08-06 10:54:56 +0300 |
commit | 6188c29603da211b8305d8fe7c082dcae61688ab (patch) | |
tree | 118c45f812d39295d8eeb32af7d18bd720a93857 /source/blender/editors/animation | |
parent | 1ab75c1d494422270fa88bbf23cc42f7b203ed4b (diff) |
Cleanup: use const result in `ED_keyframes_find_*` functions.
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframes_keylist.c | 18 |
2 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 735f3b86924..6d272bfc180 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -495,7 +495,7 @@ static bool find_prev_next_keyframes(struct bContext *C, int *r_nextfra, int *r_ Mask *mask = CTX_data_edit_mask(C); bDopeSheet ads = {NULL}; struct AnimKeylist *keylist = ED_keylist_create(); - ActKeyColumn *aknext, *akprev; + const ActKeyColumn *aknext, *akprev; float cfranext, cfraprev; bool donenext = false, doneprev = false; int nextcount = 0, prevcount = 0; diff --git a/source/blender/editors/animation/keyframes_keylist.c b/source/blender/editors/animation/keyframes_keylist.c index a869d8d6388..98aedb9cd0c 100644 --- a/source/blender/editors/animation/keyframes_keylist.c +++ b/source/blender/editors/animation/keyframes_keylist.c @@ -72,26 +72,28 @@ void ED_keylist_free(AnimKeylist *keylist) MEM_freeN(keylist); } -ActKeyColumn *ED_keylist_find_exact(const AnimKeylist *keylist, float cfra) +const ActKeyColumn *ED_keylist_find_exact(const AnimKeylist *keylist, float cfra) { - return (ActKeyColumn *)BLI_dlrbTree_search_exact(&keylist->keys, compare_ak_cfraPtr, &cfra); + return (const ActKeyColumn *)BLI_dlrbTree_search_exact( + &keylist->keys, compare_ak_cfraPtr, &cfra); } -ActKeyColumn *ED_keylist_find_next(const AnimKeylist *keylist, float cfra) +const ActKeyColumn *ED_keylist_find_next(const AnimKeylist *keylist, float cfra) { - return (ActKeyColumn *)BLI_dlrbTree_search_next(&keylist->keys, compare_ak_cfraPtr, &cfra); + return (const ActKeyColumn *)BLI_dlrbTree_search_next(&keylist->keys, compare_ak_cfraPtr, &cfra); } -ActKeyColumn *ED_keylist_find_prev(const AnimKeylist *keylist, float cfra) +const ActKeyColumn *ED_keylist_find_prev(const AnimKeylist *keylist, float cfra) { - return (ActKeyColumn *)BLI_dlrbTree_search_prev(&keylist->keys, compare_ak_cfraPtr, &cfra); + return (const ActKeyColumn *)BLI_dlrbTree_search_prev(&keylist->keys, compare_ak_cfraPtr, &cfra); } /* TODO(jbakker): Should we change this to use `ED_keylist_find_next(keys, min_fra)` and only check * boundary of `max_fra`. */ -ActKeyColumn *ED_keylist_find_any_between(const AnimKeylist *keylist, const Range2f frame_range) +const ActKeyColumn *ED_keylist_find_any_between(const AnimKeylist *keylist, + const Range2f frame_range) { - for (ActKeyColumn *ak = keylist->keys.root; ak; + for (const ActKeyColumn *ak = keylist->keys.root; ak; ak = (ak->cfra < frame_range.min) ? ak->right : ak->left) { if (range2f_in_range(&frame_range, ak->cfra)) { return ak; |