Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-08-09 13:59:28 +0300
committerJeroen Bakker <jeroen@blender.org>2021-08-09 14:00:30 +0300
commit73b047bcd431c57687bc0c501dea97f44bd28b22 (patch)
tree528063c36aacd2982b8e40838582bf2c8a16234b /source/blender/editors
parent22ed1c7b61d54b5783552d99005be75a3967b8fa (diff)
Cleanup: Changed keyframe_keylist to CPP.
Just a straight-forward change. Not utilizing CPP features.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/CMakeLists.txt2
-rw-r--r--source/blender/editors/animation/keyframes_keylist.cc (renamed from source/blender/editors/animation/keyframes_keylist.c)186
2 files changed, 96 insertions, 92 deletions
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 7a53b54b5a4..d9f52d90766 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -47,7 +47,7 @@ set(SRC
keyframes_draw.c
keyframes_edit.c
keyframes_general.c
- keyframes_keylist.c
+ keyframes_keylist.cc
keyframing.c
keyingsets.c
time_scrub_ui.c
diff --git a/source/blender/editors/animation/keyframes_keylist.c b/source/blender/editors/animation/keyframes_keylist.cc
index 98aedb9cd0c..85036efc983 100644
--- a/source/blender/editors/animation/keyframes_keylist.c
+++ b/source/blender/editors/animation/keyframes_keylist.cc
@@ -23,10 +23,10 @@
/* System includes ----------------------------------------------------- */
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cfloat>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
#include "MEM_guardedalloc.h"
@@ -47,11 +47,12 @@
#include "ED_anim_api.h"
#include "ED_keyframes_keylist.h"
+extern "C" {
/* *************************** Keyframe Processing *************************** */
-typedef struct AnimKeylist {
+struct AnimKeylist {
DLRBT_Tree keys;
-} AnimKeylist;
+};
static void ED_keylist_init(AnimKeylist *keylist)
{
@@ -60,7 +61,7 @@ static void ED_keylist_init(AnimKeylist *keylist)
AnimKeylist *ED_keylist_create(void)
{
- AnimKeylist *keylist = MEM_callocN(sizeof(AnimKeylist), __func__);
+ AnimKeylist *keylist = static_cast<AnimKeylist *>(MEM_callocN(sizeof(AnimKeylist), __func__));
ED_keylist_init(keylist);
return keylist;
}
@@ -93,18 +94,19 @@ const ActKeyColumn *ED_keylist_find_prev(const AnimKeylist *keylist, float cfra)
const ActKeyColumn *ED_keylist_find_any_between(const AnimKeylist *keylist,
const Range2f frame_range)
{
- for (const ActKeyColumn *ak = keylist->keys.root; ak;
- ak = (ak->cfra < frame_range.min) ? ak->right : ak->left) {
+ for (const ActKeyColumn *ak = static_cast<const ActKeyColumn *>(keylist->keys.root); ak;
+ ak = static_cast<const ActKeyColumn *>((ak->cfra < frame_range.min) ? ak->right :
+ ak->left)) {
if (range2f_in_range(&frame_range, ak->cfra)) {
return ak;
}
}
- return NULL;
+ return nullptr;
}
bool ED_keylist_is_empty(const struct AnimKeylist *keylist)
{
- return keylist->keys.root == NULL;
+ return keylist->keys.root == nullptr;
}
const struct ListBase *ED_keylist_listbase(const AnimKeylist *keylist)
@@ -145,7 +147,7 @@ BLI_INLINE bool is_cfra_lt(const float a, const float b)
short compare_ak_cfraPtr(void *node, void *data)
{
ActKeyColumn *ak = (ActKeyColumn *)node;
- const float *cframe = data;
+ const float *cframe = static_cast<const float *>(data);
const float val = *cframe;
if (is_cfra_eq(val, ak->cfra)) {
@@ -161,13 +163,13 @@ short compare_ak_cfraPtr(void *node, void *data)
/* --------------- */
/* Set of references to three logically adjacent keys. */
-typedef struct BezTripleChain {
+struct BezTripleChain {
/* Current keyframe. */
BezTriple *cur;
- /* Logical neighbors. May be NULL. */
+ /* Logical neighbors. May be nullptr. */
BezTriple *prev, *next;
-} BezTripleChain;
+};
/* Categorize the interpolation & handle type of the keyframe. */
static eKeyframeHandleDrawOpts bezt_handle_type(const BezTriple *bezt)
@@ -192,7 +194,7 @@ static eKeyframeHandleDrawOpts bezt_handle_type(const BezTriple *bezt)
*/
static eKeyframeExtremeDrawOpts bezt_extreme_type(const BezTripleChain *chain)
{
- if (chain->prev == NULL && chain->next == NULL) {
+ if (chain->prev == nullptr && chain->next == nullptr) {
return KEYFRAME_EXTREME_NONE;
}
@@ -227,13 +229,15 @@ static eKeyframeExtremeDrawOpts bezt_extreme_type(const BezTripleChain *chain)
if (prev_y < cur_y || next_y < cur_y) {
const bool is_overshoot = (handle_l > cur_y || handle_r > cur_y);
- return KEYFRAME_EXTREME_MAX | (is_overshoot ? KEYFRAME_EXTREME_MIXED : 0);
+ return static_cast<eKeyframeExtremeDrawOpts>(KEYFRAME_EXTREME_MAX |
+ (is_overshoot ? KEYFRAME_EXTREME_MIXED : 0));
}
if (prev_y > cur_y || next_y > cur_y) {
const bool is_overshoot = (handle_l < cur_y || handle_r < cur_y);
- return KEYFRAME_EXTREME_MIN | (is_overshoot ? KEYFRAME_EXTREME_MIXED : 0);
+ return static_cast<eKeyframeExtremeDrawOpts>(KEYFRAME_EXTREME_MIN |
+ (is_overshoot ? KEYFRAME_EXTREME_MIXED : 0));
}
return KEYFRAME_EXTREME_NONE;
@@ -242,7 +246,7 @@ static eKeyframeExtremeDrawOpts bezt_extreme_type(const BezTripleChain *chain)
/* Comparator callback used for ActKeyColumns and BezTripleChain */
static short compare_ak_bezt(void *node, void *data)
{
- BezTripleChain *chain = data;
+ BezTripleChain *chain = static_cast<BezTripleChain *>(data);
return compare_ak_cfraPtr(node, &chain->cur->vec[1][0]);
}
@@ -250,8 +254,9 @@ static short compare_ak_bezt(void *node, void *data)
/* New node callback used for building ActKeyColumns from BezTripleChain */
static DLRBT_Node *nalloc_ak_bezt(void *data)
{
- ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
- const BezTripleChain *chain = data;
+ ActKeyColumn *ak = static_cast<ActKeyColumn *>(
+ MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn"));
+ const BezTripleChain *chain = static_cast<const BezTripleChain *>(data);
const BezTriple *bezt = chain->cur;
/* store settings based on state of BezTriple */
@@ -270,8 +275,8 @@ static DLRBT_Node *nalloc_ak_bezt(void *data)
/* Node updater callback used for building ActKeyColumns from BezTripleChain */
static void nupdate_ak_bezt(void *node, void *data)
{
- ActKeyColumn *ak = node;
- const BezTripleChain *chain = data;
+ ActKeyColumn *ak = static_cast<ActKeyColumn *>(node);
+ const BezTripleChain *chain = static_cast<const BezTripleChain *>(data);
const BezTriple *bezt = chain->cur;
/* set selection status and 'touched' status */
@@ -319,7 +324,8 @@ static short compare_ak_gpframe(void *node, void *data)
/* New node callback used for building ActKeyColumns from GPencil frames */
static DLRBT_Node *nalloc_ak_gpframe(void *data)
{
- ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
+ ActKeyColumn *ak = static_cast<ActKeyColumn *>(
+ MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF"));
const bGPDframe *gpf = (bGPDframe *)data;
/* store settings based on state of BezTriple */
@@ -372,7 +378,8 @@ static short compare_ak_masklayshape(void *node, void *data)
/* New node callback used for building ActKeyColumns from GPencil frames */
static DLRBT_Node *nalloc_ak_masklayshape(void *data)
{
- ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
+ ActKeyColumn *ak = static_cast<ActKeyColumn *>(
+ MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF"));
const MaskLayerShape *masklay_shape = (const MaskLayerShape *)data;
/* store settings based on state of BezTriple */
@@ -405,7 +412,7 @@ static void nupdate_ak_masklayshape(void *node, void *data)
/* Add the given BezTriple to the given 'list' of Keyframes */
static void add_bezt_to_keycolumns_list(AnimKeylist *keylist, BezTripleChain *bezt)
{
- if (ELEM(NULL, keylist, bezt)) {
+ if (ELEM(nullptr, keylist, bezt)) {
return;
}
@@ -415,7 +422,7 @@ static void add_bezt_to_keycolumns_list(AnimKeylist *keylist, BezTripleChain *be
/* Add the given GPencil Frame to the given 'list' of Keyframes */
static void add_gpframe_to_keycolumns_list(AnimKeylist *keylist, bGPDframe *gpf)
{
- if (ELEM(NULL, keylist, gpf)) {
+ if (ELEM(nullptr, keylist, gpf)) {
return;
}
@@ -425,7 +432,7 @@ static void add_gpframe_to_keycolumns_list(AnimKeylist *keylist, bGPDframe *gpf)
/* Add the given MaskLayerShape Frame to the given 'list' of Keyframes */
static void add_masklay_to_keycolumns_list(AnimKeylist *keylist, MaskLayerShape *masklay_shape)
{
- if (ELEM(NULL, keylist, masklay_shape)) {
+ if (ELEM(nullptr, keylist, masklay_shape)) {
return;
}
@@ -507,20 +514,20 @@ static void add_keyblock_info(ActKeyColumn *col, const ActKeyBlockInfo *block)
static void add_bezt_to_keyblocks_list(AnimKeylist *keylist, BezTriple *bezt, const int bezt_len)
{
- ActKeyColumn *col = keylist->keys.first;
+ ActKeyColumn *col = static_cast<ActKeyColumn *>(keylist->keys.first);
if (bezt && bezt_len >= 2) {
ActKeyBlockInfo block;
/* Find the first key column while inserting dummy blocks. */
- for (; col != NULL && is_cfra_lt(col->cfra, bezt[0].vec[1][0]); col = col->next) {
+ for (; col != nullptr && is_cfra_lt(col->cfra, bezt[0].vec[1][0]); col = col->next) {
add_keyblock_info(col, &dummy_keyblock);
}
- BLI_assert(col != NULL);
+ BLI_assert(col != nullptr);
/* Insert real blocks. */
- for (int v = 1; col != NULL && v < bezt_len; v++, bezt++) {
+ for (int v = 1; col != nullptr && v < bezt_len; v++, bezt++) {
/* Wrong order of bezier keys: resync position. */
if (is_cfra_lt(bezt[1].vec[1][0], bezt[0].vec[1][0])) {
/* Backtrack to find the right location. */
@@ -528,11 +535,11 @@ static void add_bezt_to_keyblocks_list(AnimKeylist *keylist, BezTriple *bezt, co
ActKeyColumn *newcol = (ActKeyColumn *)BLI_dlrbTree_search_exact(
&keylist->keys, compare_ak_cfraPtr, &bezt[1].vec[1][0]);
- if (newcol != NULL) {
+ if (newcol != nullptr) {
col = newcol;
/* The previous keyblock is garbage too. */
- if (col->prev != NULL) {
+ if (col->prev != nullptr) {
add_keyblock_info(col->prev, &dummy_keyblock);
}
}
@@ -549,16 +556,16 @@ static void add_bezt_to_keyblocks_list(AnimKeylist *keylist, BezTriple *bezt, co
compute_keyblock_data(&block, bezt, bezt + 1);
- for (; col != NULL && is_cfra_lt(col->cfra, bezt[1].vec[1][0]); col = col->next) {
+ for (; col != nullptr && is_cfra_lt(col->cfra, bezt[1].vec[1][0]); col = col->next) {
add_keyblock_info(col, &block);
}
- BLI_assert(col != NULL);
+ BLI_assert(col != nullptr);
}
}
/* Insert dummy blocks at the end. */
- for (; col != NULL; col = col->next) {
+ for (; col != nullptr; col = col->next) {
add_keyblock_info(col, &dummy_keyblock);
}
}
@@ -581,7 +588,7 @@ static void update_keyblocks(AnimKeylist *keylist, BezTriple *bezt, const int be
}
/* Propagate blocks to inserted keys */
- ActKeyColumn *prev_ready = NULL;
+ ActKeyColumn *prev_ready = nullptr;
LISTBASE_FOREACH (ActKeyColumn *, col, &keylist->keys) {
/* Pre-existing column. */
@@ -589,7 +596,7 @@ static void update_keyblocks(AnimKeylist *keylist, BezTriple *bezt, const int be
prev_ready = col;
}
/* Newly inserted column, so copy block data from previous. */
- else if (prev_ready != NULL) {
+ else if (prev_ready != nullptr) {
col->totblock = prev_ready->totblock;
memcpy(&col->block, &prev_ready->block, sizeof(ActKeyBlockInfo));
}
@@ -605,7 +612,7 @@ static void update_keyblocks(AnimKeylist *keylist, BezTriple *bezt, const int be
bool actkeyblock_is_valid(const ActKeyColumn *ac)
{
- return ac != NULL && ac->next != NULL && ac->totblock > 0;
+ return ac != nullptr && ac->next != nullptr && ac->totblock > 0;
}
/* Checks if ActKeyBlock should exist... */
@@ -625,29 +632,29 @@ int actkeyblock_get_valid_hold(const ActKeyColumn *ac)
void summary_to_keylist(bAnimContext *ac, AnimKeylist *keylist, const int saction_flag)
{
if (ac) {
- ListBase anim_data = {NULL, NULL};
+ ListBase anim_data = {nullptr, nullptr};
/* get F-Curves to take keyframes from */
const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE;
- ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+ ANIM_animdata_filter(
+ ac, &anim_data, filter, ac->data, static_cast<eAnimCont_Types>(ac->datatype));
/* loop through each F-Curve, grabbing the keyframes */
- for (const bAnimListElem *ale = anim_data.first; ale; ale = ale->next) {
+ LISTBASE_FOREACH (const bAnimListElem *, ale, &anim_data) {
/* Why not use all #eAnim_KeyType here?
* All of the other key types are actually "summaries" themselves,
* and will just end up duplicating stuff that comes up through
* standard filtering of just F-Curves. Given the way that these work,
* there isn't really any benefit at all from including them. - Aligorith */
-
switch (ale->datatype) {
case ALE_FCURVE:
- fcurve_to_keylist(ale->adt, ale->data, keylist, saction_flag);
+ fcurve_to_keylist(ale->adt, static_cast<FCurve *>(ale->data), keylist, saction_flag);
break;
case ALE_MASKLAY:
- mask_to_keylist(ac->ads, ale->data, keylist);
+ mask_to_keylist(ac->ads, static_cast<MaskLayer *>(ale->data), keylist);
break;
case ALE_GPFRAME:
- gpl_to_keylist(ac->ads, ale->data, keylist);
+ gpl_to_keylist(ac->ads, static_cast<bGPDlayer *>(ale->data), keylist);
break;
default:
// printf("%s: datatype %d unhandled\n", __func__, ale->datatype);
@@ -661,12 +668,12 @@ void summary_to_keylist(bAnimContext *ac, AnimKeylist *keylist, const int sactio
void scene_to_keylist(bDopeSheet *ads, Scene *sce, AnimKeylist *keylist, const int saction_flag)
{
- bAnimContext ac = {NULL};
- ListBase anim_data = {NULL, NULL};
+ bAnimContext ac = {nullptr};
+ ListBase anim_data = {nullptr, nullptr};
- bAnimListElem dummychan = {NULL};
+ bAnimListElem dummychan = {nullptr};
- if (sce == NULL) {
+ if (sce == nullptr) {
return;
}
@@ -682,11 +689,12 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, AnimKeylist *keylist, const i
/* get F-Curves to take keyframes from */
const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE; /* curves only */
- ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ ANIM_animdata_filter(
+ &ac, &anim_data, filter, ac.data, static_cast<eAnimCont_Types>(ac.datatype));
/* loop through each F-Curve, grabbing the keyframes */
- for (const bAnimListElem *ale = anim_data.first; ale; ale = ale->next) {
- fcurve_to_keylist(ale->adt, ale->data, keylist, saction_flag);
+ LISTBASE_FOREACH (const bAnimListElem *, ale, &anim_data) {
+ fcurve_to_keylist(ale->adt, static_cast<FCurve *>(ale->data), keylist, saction_flag);
}
ANIM_animdata_freelist(&anim_data);
@@ -694,13 +702,13 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, AnimKeylist *keylist, const i
void ob_to_keylist(bDopeSheet *ads, Object *ob, AnimKeylist *keylist, const int saction_flag)
{
- bAnimContext ac = {NULL};
- ListBase anim_data = {NULL, NULL};
+ bAnimContext ac = {nullptr};
+ ListBase anim_data = {nullptr, nullptr};
- bAnimListElem dummychan = {NULL};
- Base dummybase = {NULL};
+ bAnimListElem dummychan = {nullptr};
+ Base dummybase = {nullptr};
- if (ob == NULL) {
+ if (ob == nullptr) {
return;
}
@@ -718,11 +726,12 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, AnimKeylist *keylist, const int
/* get F-Curves to take keyframes from */
const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE; /* curves only */
- ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ ANIM_animdata_filter(
+ &ac, &anim_data, filter, ac.data, static_cast<eAnimCont_Types>(ac.datatype));
/* loop through each F-Curve, grabbing the keyframes */
- for (const bAnimListElem *ale = anim_data.first; ale; ale = ale->next) {
- fcurve_to_keylist(ale->adt, ale->data, keylist, saction_flag);
+ LISTBASE_FOREACH (const bAnimListElem *, ale, &anim_data) {
+ fcurve_to_keylist(ale->adt, static_cast<FCurve *>(ale->data), keylist, saction_flag);
}
ANIM_animdata_freelist(&anim_data);
@@ -733,30 +742,31 @@ void cachefile_to_keylist(bDopeSheet *ads,
AnimKeylist *keylist,
const int saction_flag)
{
- if (cache_file == NULL) {
+ if (cache_file == nullptr) {
return;
}
/* create a dummy wrapper data to work with */
- bAnimListElem dummychan = {NULL};
+ bAnimListElem dummychan = {nullptr};
dummychan.type = ANIMTYPE_DSCACHEFILE;
dummychan.data = cache_file;
dummychan.id = &cache_file->id;
dummychan.adt = cache_file->adt;
- bAnimContext ac = {NULL};
+ bAnimContext ac = {nullptr};
ac.ads = ads;
ac.data = &dummychan;
ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */
- ListBase anim_data = {NULL, NULL};
+ ListBase anim_data = {nullptr, nullptr};
const eAnimFilter_Flags filter = ANIMFILTER_DATA_VISIBLE; /* curves only */
- ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+ ANIM_animdata_filter(
+ &ac, &anim_data, filter, ac.data, static_cast<eAnimCont_Types>(ac.datatype));
/* loop through each F-Curve, grabbing the keyframes */
LISTBASE_FOREACH (const bAnimListElem *, ale, &anim_data) {
- fcurve_to_keylist(ale->adt, ale->data, keylist, saction_flag);
+ fcurve_to_keylist(ale->adt, static_cast<FCurve *>(ale->data), keylist, saction_flag);
}
ANIM_animdata_freelist(&anim_data);
@@ -767,7 +777,7 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const i
if (fcu && fcu->totvert && fcu->bezt) {
/* apply NLA-mapping (if applicable) */
if (adt) {
- ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
+ ANIM_nla_mapping_apply_fcurve(adt, fcu, false, false);
}
/* Check if the curve is cyclic. */
@@ -775,15 +785,19 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const i
bool do_extremes = (saction_flag & SACTION_SHOW_EXTREMES) != 0;
/* loop through beztriples, making ActKeysColumns */
- BezTripleChain chain = {0};
+ BezTripleChain chain = {nullptr};
for (int v = 0; v < fcu->totvert; v++) {
chain.cur = &fcu->bezt[v];
/* Neighbor keys, accounting for being cyclic. */
if (do_extremes) {
- chain.prev = (v > 0) ? &fcu->bezt[v - 1] : is_cyclic ? &fcu->bezt[fcu->totvert - 2] : NULL;
- chain.next = (v + 1 < fcu->totvert) ? &fcu->bezt[v + 1] : is_cyclic ? &fcu->bezt[1] : NULL;
+ chain.prev = (v > 0) ? &fcu->bezt[v - 1] :
+ is_cyclic ? &fcu->bezt[fcu->totvert - 2] :
+ nullptr;
+ chain.next = (v + 1 < fcu->totvert) ? &fcu->bezt[v + 1] :
+ is_cyclic ? &fcu->bezt[1] :
+ nullptr;
}
add_bezt_to_keycolumns_list(keylist, &chain);
@@ -794,7 +808,7 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const i
/* unapply NLA-mapping if applicable */
if (adt) {
- ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0);
+ ANIM_nla_mapping_apply_fcurve(adt, fcu, true, false);
}
}
}
@@ -804,11 +818,9 @@ void agroup_to_keylist(AnimData *adt,
AnimKeylist *keylist,
const int saction_flag)
{
- FCurve *fcu;
-
if (agrp) {
/* loop through F-Curves */
- for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next) {
+ LISTBASE_FOREACH (FCurve *, fcu, &agrp->channels) {
fcurve_to_keylist(adt, fcu, keylist, saction_flag);
}
}
@@ -816,11 +828,9 @@ void agroup_to_keylist(AnimData *adt,
void action_to_keylist(AnimData *adt, bAction *act, AnimKeylist *keylist, const int saction_flag)
{
- FCurve *fcu;
-
if (act) {
/* loop through F-Curves */
- for (fcu = act->curves.first; fcu; fcu = fcu->next) {
+ LISTBASE_FOREACH (FCurve *, fcu, &act->curves) {
fcurve_to_keylist(adt, fcu, keylist, saction_flag);
}
}
@@ -828,11 +838,9 @@ void action_to_keylist(AnimData *adt, bAction *act, AnimKeylist *keylist, const
void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, AnimKeylist *keylist, const bool active)
{
- bGPDlayer *gpl;
-
if (gpd && keylist) {
/* for now, just aggregate out all the frames, but only for visible layers */
- for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) {
+ LISTBASE_FOREACH_BACKWARD (bGPDlayer *, gpl, &gpd->layers) {
if ((gpl->flag & GP_LAYER_HIDE) == 0) {
if ((!active) || ((active) && (gpl->flag & GP_LAYER_SELECT))) {
gpl_to_keylist(ads, gpl, keylist);
@@ -844,29 +852,25 @@ void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, AnimKeylist *keylist, con
void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, AnimKeylist *keylist)
{
- bGPDframe *gpf;
-
if (gpl && keylist) {
/* Although the frames should already be in an ordered list,
* they are not suitable for displaying yet. */
- for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
add_gpframe_to_keycolumns_list(keylist, gpf);
}
- update_keyblocks(keylist, NULL, 0);
+ update_keyblocks(keylist, nullptr, 0);
}
}
void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskLayer *masklay, AnimKeylist *keylist)
{
- MaskLayerShape *masklay_shape;
-
if (masklay && keylist) {
- for (masklay_shape = masklay->splines_shapes.first; masklay_shape;
- masklay_shape = masklay_shape->next) {
+ LISTBASE_FOREACH (MaskLayerShape *, masklay_shape, &masklay->splines_shapes) {
add_masklay_to_keycolumns_list(keylist, masklay_shape);
}
- update_keyblocks(keylist, NULL, 0);
+ update_keyblocks(keylist, nullptr, 0);
}
}
+}