[Bf-blender-cvs] [6188c29603d] master: Cleanup: use const result in `ED_keyframes_find_*` functions.
Jeroen Bakker
noreply at git.blender.org
Fri Aug 6 09:56:08 CEST 2021
Commit: 6188c29603da211b8305d8fe7c082dcae61688ab
Author: Jeroen Bakker
Date: Fri Aug 6 09:54:56 2021 +0200
Branches: master
https://developer.blender.org/rB6188c29603da211b8305d8fe7c082dcae61688ab
Cleanup: use const result in `ED_keyframes_find_*` functions.
===================================================================
M source/blender/editors/animation/anim_draw.c
M source/blender/editors/animation/keyframes_keylist.c
M source/blender/editors/armature/pose_slide.c
M source/blender/editors/include/ED_keyframes_keylist.h
M source/blender/editors/screen/screen_ops.c
===================================================================
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;
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index 238799650a0..bc5cbd92deb 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -1716,7 +1716,7 @@ static float pose_propagate_get_boneHoldEndFrame(tPChanFCurveLink *pfl, float st
/* Find the long keyframe (i.e. hold), and hence obtain the endFrame value
* - the best case would be one that starts on the frame itself
*/
- ActKeyColumn *ab = ED_keylist_find_exact(keylist, startFrame);
+ const ActKeyColumn *ab = ED_keylist_find_exact(keylist, startFrame);
/* There are only two cases for no-exact match:
* 1) the current frame is just before another key but not on a key itself
@@ -1746,7 +1746,7 @@ static float pose_propagate_get_boneHoldEndFrame(tPChanFCurveLink *pfl, float st
if (ab) {
/* Go to next if it is also valid and meets "extension" criteria. */
while (ab->next) {
- ActKeyColumn *abn = ab->next;
+ const ActKeyColumn *abn = ab->next;
/* Must be valid. */
if ((actkeyblock_get_valid_hold(abn) & ACTKEYBLOCK_FLAG_STATIC_HOLD) == 0) {
diff --git a/source/blender/editors/include/ED_keyframes_keylist.h b/source/blender/editors/include/ED_keyframes_keylist.h
index 86741b67698..3a9750c1206 100644
--- a/source/blender/editors/include/ED_keyframes_keylist.h
+++ b/source/blender/editors/include/ED_keyframes_keylist.h
@@ -139,11 +139,11 @@ typedef enum eKeyframeExtremeDrawOpts {
struct AnimKeylist *ED_keylist_create(void);
void ED_keylist_free(struct AnimKeylist *keylist);
-struct ActKeyColumn *ED_keylist_find_exact(const struct AnimKeylist *keylist, float cfra);
-struct ActKeyColumn *ED_keylist_find_next(const struct AnimKeylist *keylist, float cfra);
-struct ActKeyColumn *ED_keylist_find_prev(const struct AnimKeylist *keylist, float cfra);
-struct ActKeyColumn *ED_keylist_find_any_between(const struct AnimKeylist *keylist,
- const Range2f frame_range);
+const struct ActKeyColumn *ED_keylist_find_exact(const struct AnimKeylist *keylist, float cfra);
+const struct ActKeyColumn *ED_keylist_find_next(const struct AnimKeylist *keylist, float cfra);
+const struct ActKeyColumn *ED_keylist_find_prev(const struct AnimKeylist *keylist, float cfra);
+const struct ActKeyColumn *ED_keylist_find_any_between(const struct AnimKeylist *keylist,
+ const Range2f frame_range);
bool ED_keylist_is_empty(const struct AnimKeylist *keylist);
const struct ListBase /* ActKeyColumn */ *ED_keylist_listbase(const struct AnimKeylist *keylist);
bool ED_keylist_frame_range(const struct AnimKeylist *keylist, Range2f *r_frame_range);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e150d7774f9..6af18104336 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -3077,7 +3077,7 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
}
/* find matching keyframe in the right direction */
- ActKeyColumn *ak;
+ const ActKeyColumn *ak;
if (next) {
ak = ED_keylist_find_next(keylist, cfra);
}
More information about the Bf-blender-cvs
mailing list