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:
authorChristoph Lendenfeld <chris.lend@gmx.at>2021-11-05 00:35:28 +0300
committerChristoph Lendenfeld <chris.lend@gmx.at>2021-11-05 00:35:28 +0300
commit3364a5bea6c977069210c3325111dc28051ee1cb (patch)
tree79e8e959520f3c664900347f775d542ea458fa5d /source/blender
parent6986b43b3d2d633fe4bf3be96d0da474cc6ba333 (diff)
Cleanup: move code in graph_slider_ops
Future operators can use the same code, so it is moved up to disassociate it from decimate No functional changes Reviewed by: Sybren A. Stüvel Differential Revision: https://developer.blender.org/D12489 Ref: D12489
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_graph/graph_slider_ops.c68
1 files changed, 33 insertions, 35 deletions
diff --git a/source/blender/editors/space_graph/graph_slider_ops.c b/source/blender/editors/space_graph/graph_slider_ops.c
index f669a7e193d..14a8f73a3a4 100644
--- a/source/blender/editors/space_graph/graph_slider_ops.c
+++ b/source/blender/editors/space_graph/graph_slider_ops.c
@@ -53,7 +53,10 @@
(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
+ * operator. */
/* This data type is only used for modal operation. */
typedef struct tGraphSliderOp {
@@ -78,16 +81,6 @@ typedef struct tBeztCopyData {
BezTriple *bezt;
} tBeztCopyData;
-typedef enum tDecimModes {
- DECIM_RATIO = 1,
- DECIM_ERROR,
-} tDecimModes;
-
-/* ******************** 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
- * operator. */
-
/* ******************** Utility Functions ************************* */
/* Construct a list with the original bezt arrays so we can restore them during modal operation.
@@ -130,30 +123,6 @@ static void store_original_bezt_arrays(tGraphSliderOp *gso)
ANIM_animdata_freelist(&anim_data);
}
-/* ******************** Decimate Keyframes Operator ************************* */
-
-static void decimate_graph_keys(bAnimContext *ac, float remove_ratio, float error_sq_max)
-{
- ListBase anim_data = {NULL, NULL};
- bAnimListElem *ale;
-
- /* Filter data. */
- 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) {
- if (!decimate_fcurve(ale, remove_ratio, error_sq_max)) {
- /* The selection contains unsupported keyframe types! */
- WM_report(RPT_WARNING, "Decimate: Skipping non linear/bezier keyframes!");
- }
-
- ale->update |= ANIM_UPDATE_DEFAULT;
- }
-
- ANIM_animdata_update(ac, &anim_data);
- ANIM_animdata_freelist(&anim_data);
-}
-
/* Overwrite the current bezts arrays with the original data. */
static void reset_bezts(tGraphSliderOp *gso)
{
@@ -192,6 +161,35 @@ static void reset_bezts(tGraphSliderOp *gso)
ANIM_animdata_freelist(&anim_data);
}
+/* ******************** Decimate Keyframes Operator ************************* */
+
+typedef enum tDecimModes {
+ DECIM_RATIO = 1,
+ DECIM_ERROR,
+} tDecimModes;
+
+static void decimate_graph_keys(bAnimContext *ac, float remove_ratio, float error_sq_max)
+{
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+
+ /* Filter data. */
+ 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) {
+ if (!decimate_fcurve(ale, remove_ratio, error_sq_max)) {
+ /* The selection contains unsupported keyframe types! */
+ WM_report(RPT_WARNING, "Decimate: Skipping non linear/bezier keyframes!");
+ }
+
+ ale->update |= ANIM_UPDATE_DEFAULT;
+ }
+
+ ANIM_animdata_update(ac, &anim_data);
+ ANIM_animdata_freelist(&anim_data);
+}
+
static void decimate_exit(bContext *C, wmOperator *op)
{
tGraphSliderOp *gso = op->customdata;