diff options
author | Christoph Lendenfeld <chris.lend@gmx.at> | 2021-10-31 14:19:40 +0300 |
---|---|---|
committer | Christoph Lendenfeld <chris.lend@gmx.at> | 2021-10-31 14:19:40 +0300 |
commit | 1b6daa871da9acc7c17aae9965633a4da604ba63 (patch) | |
tree | 070f179e97ae5b512c7561873441b62474b3ef62 /source | |
parent | 4e502bb6d2ac9e5629a6bc908319584f99c488c2 (diff) |
Cleanup: Extract keyframe filter to constant
An int flag is used to filter animation channels for
operators to work on. The flag was duplicated multiple times.
This patch removes the duplication by creating a constant
Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12486
Ref: D12486
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_graph/graph_slider_ops.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/source/blender/editors/space_graph/graph_slider_ops.c b/source/blender/editors/space_graph/graph_slider_ops.c index f04336cab84..958745ff281 100644 --- a/source/blender/editors/space_graph/graph_slider_ops.c +++ b/source/blender/editors/space_graph/graph_slider_ops.c @@ -48,6 +48,11 @@ #include "graph_intern.h" +/* Used to obtain a list of animation channels for the operators to work on. */ +#define OPERATOR_DATA_FILTER \ + (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_SEL | \ + ANIMFILTER_NODUPLIS) + /* ******************** GRAPH SLIDER OPERATORS ************************* */ /* This file contains a collection of operators to modify keyframes in the graph editor. All * operators are modal and use a slider that allows the user to define a percentage to modify the @@ -59,12 +64,9 @@ static void decimate_graph_keys(bAnimContext *ac, float remove_ratio, float erro { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; - int filter; /* Filter data. */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | - ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); - ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + ANIM_animdata_filter(ac, &anim_data, OPERATOR_DATA_FILTER, ac->data, ac->datatype); /* Loop through filtered data and clean curves. */ for (ale = anim_data.first; ale; ale = ale->next) { @@ -116,14 +118,11 @@ static void decimate_reset_bezts(tDecimateGraphOp *dgo) ListBase anim_data = {NULL, NULL}; LinkData *link_bezt; bAnimListElem *ale; - int filter; bAnimContext *ac = &dgo->ac; /* Filter data. */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | - ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); - ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + ANIM_animdata_filter(ac, &anim_data, OPERATOR_DATA_FILTER, ac->data, ac->datatype); /* Loop through filtered data and reset bezts. */ for (ale = anim_data.first, link_bezt = dgo->bezt_arr_list.first; ale; ale = ale->next) { @@ -242,12 +241,8 @@ static int graphkeys_decimate_invoke(bContext *C, wmOperator *op, const wmEvent bAnimContext *ac = &dgo->ac; bAnimListElem *ale; - int filter; - /* Filter data. */ - filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FOREDIT | - ANIMFILTER_SEL | ANIMFILTER_NODUPLIS); - ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); + ANIM_animdata_filter(ac, &anim_data, OPERATOR_DATA_FILTER, ac->data, ac->datatype); /* Loop through filtered data and copy the curves. */ for (ale = anim_data.first; ale; ale = ale->next) { |