From 9e5e04e9151ed3e431966ac3ac08e1a0099996cc Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Tue, 12 Sep 2023 09:32:18 +0200 Subject: [PATCH] Animation: Rename Graph_OT_sample After Renaming "Bake Curve" to "Samples to Keys" in #111049, the name of the `GRAPH_OT_sample` operator needed renaming. That is because the word "sample" is now used to describe FCurve data in an uneditable state. Rename to `GRAPH_OT_bake_keys` since baking is the term used in animation to describe the action of creating dense key data. Pull Request: https://projects.blender.org/blender/blender/pulls/112148 --- .../keyconfig/keymap_data/blender_default.py | 2 +- scripts/startup/bl_ui/space_graph.py | 2 +- .../editors/animation/keyframes_general.cc | 2 +- .../editors/include/ED_keyframes_edit.hh | 2 +- .../editors/space_action/action_edit.cc | 2 +- .../blender/editors/space_graph/graph_edit.cc | 18 +++++++++--------- .../blender/editors/space_graph/graph_intern.h | 2 +- .../blender/editors/space_graph/graph_ops.cc | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/presets/keyconfig/keymap_data/blender_default.py b/scripts/presets/keyconfig/keymap_data/blender_default.py index 1583732797c..f587b309dac 100644 --- a/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -1893,7 +1893,7 @@ def km_graph_editor(params): ("graph.interpolation_type", {"type": 'T', "value": 'PRESS'}, None), ("graph.easing_type", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), ("graph.smooth", {"type": 'O', "value": 'PRESS', "alt": True}, None), - ("graph.sample", {"type": 'O', "value": 'PRESS', "shift": True, "alt": True}, None), + ("graph.bake_keys", {"type": 'O', "value": 'PRESS', "shift": True, "alt": True}, None), ("graph.keys_to_samples", {"type": 'C', "value": 'PRESS', "alt": True}, None), op_menu("GRAPH_MT_delete", {"type": 'X', "value": 'PRESS'}), ("graph.delete", {"type": 'DEL', "value": 'PRESS'}, {"properties": [("confirm", False)]}), diff --git a/scripts/startup/bl_ui/space_graph.py b/scripts/startup/bl_ui/space_graph.py index 3a47f88b0a9..1c26744956f 100644 --- a/scripts/startup/bl_ui/space_graph.py +++ b/scripts/startup/bl_ui/space_graph.py @@ -305,7 +305,7 @@ class GRAPH_MT_key_density(Menu): # as we do not have a modal mode for it, so just execute it. with operator_context(layout, 'EXEC_REGION_WIN'): layout.operator("graph.decimate", text="Decimate (Allowed Change)").mode = 'ERROR' - layout.operator("graph.sample") + layout.operator("graph.bake_keys") layout.separator() layout.operator("graph.clean").channels = False diff --git a/source/blender/editors/animation/keyframes_general.cc b/source/blender/editors/animation/keyframes_general.cc index 34edfc38dd7..e5a5d7c5aa9 100644 --- a/source/blender/editors/animation/keyframes_general.cc +++ b/source/blender/editors/animation/keyframes_general.cc @@ -1152,7 +1152,7 @@ void sample_fcurve_segment(FCurve *fcu, } } -void sample_fcurve(FCurve *fcu) +void bake_fcurve_segments(FCurve *fcu) { BezTriple *bezt, *start = nullptr, *end = nullptr; TempFrameValCache *value_cache, *fp; diff --git a/source/blender/editors/include/ED_keyframes_edit.hh b/source/blender/editors/include/ED_keyframes_edit.hh index df5c858c2f1..b0aca9b86cd 100644 --- a/source/blender/editors/include/ED_keyframes_edit.hh +++ b/source/blender/editors/include/ED_keyframes_edit.hh @@ -487,7 +487,7 @@ void blend_to_default_fcurve(PointerRNA *id_ptr, FCurve *fcu, float factor); * Use a weighted moving-means method to reduce intensity of fluctuations. */ void smooth_fcurve(FCurve *fcu); -void sample_fcurve(FCurve *fcu); +void bake_fcurve_segments(FCurve *fcu); /** * \param sample_rate: indicates how many samples per frame should be generated. */ diff --git a/source/blender/editors/space_action/action_edit.cc b/source/blender/editors/space_action/action_edit.cc index c1ab80da647..8633be31a8c 100644 --- a/source/blender/editors/space_action/action_edit.cc +++ b/source/blender/editors/space_action/action_edit.cc @@ -1261,7 +1261,7 @@ static void sample_action_keys(bAnimContext *ac) /* Loop through filtered data and add keys between selected keyframes on every frame. */ LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { - sample_fcurve((FCurve *)ale->key_data); + bake_fcurve_segments((FCurve *)ale->key_data); ale->update |= ANIM_UPDATE_DEPS; } diff --git a/source/blender/editors/space_graph/graph_edit.cc b/source/blender/editors/space_graph/graph_edit.cc index cecd61151e6..a89cbb0f175 100644 --- a/source/blender/editors/space_graph/graph_edit.cc +++ b/source/blender/editors/space_graph/graph_edit.cc @@ -1305,7 +1305,7 @@ void GRAPH_OT_sound_to_samples(wmOperatorType *ot) * \{ */ /* Evaluates the curves between each selected keyframe on each frame, and keys the value. */ -static void sample_graph_keys(bAnimContext *ac) +static void bake_graph_keys(bAnimContext *ac) { ListBase anim_data = {nullptr, nullptr}; int filter; @@ -1318,7 +1318,7 @@ static void sample_graph_keys(bAnimContext *ac) /* Loop through filtered data and add keys between selected keyframes on every frame. */ LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { - sample_fcurve((FCurve *)ale->key_data); + bake_fcurve_segments((FCurve *)ale->key_data); ale->update |= ANIM_UPDATE_DEPS; } @@ -1329,7 +1329,7 @@ static void sample_graph_keys(bAnimContext *ac) /* ------------------- */ -static int graphkeys_sample_exec(bContext *C, wmOperator * /*op*/) +static int graphkeys_bake_exec(bContext *C, wmOperator * /*op*/) { bAnimContext ac; @@ -1338,8 +1338,8 @@ static int graphkeys_sample_exec(bContext *C, wmOperator * /*op*/) return OPERATOR_CANCELLED; } - /* Sample keyframes. */ - sample_graph_keys(&ac); + /* Bake keyframes. */ + bake_graph_keys(&ac); /* Set notifier that keyframes have changed. */ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr); @@ -1347,15 +1347,15 @@ static int graphkeys_sample_exec(bContext *C, wmOperator * /*op*/) return OPERATOR_FINISHED; } -void GRAPH_OT_sample(wmOperatorType *ot) +void GRAPH_OT_bake_keys(wmOperatorType *ot) { /* Identifiers */ - ot->name = "Sample Keyframes"; - ot->idname = "GRAPH_OT_sample"; + ot->name = "Bake Keyframes"; + ot->idname = "GRAPH_OT_bake_keys"; ot->description = "Add keyframes on every frame between the selected keyframes"; /* API callbacks */ - ot->exec = graphkeys_sample_exec; + ot->exec = graphkeys_bake_exec; ot->poll = graphop_editable_keyframes_poll; /* Flags */ diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index 1aa5cf4fdc3..e744a46346e 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -128,7 +128,7 @@ void GRAPH_OT_decimate(struct wmOperatorType *ot); void GRAPH_OT_blend_to_default(struct wmOperatorType *ot); void GRAPH_OT_butterworth_smooth(struct wmOperatorType *ot); void GRAPH_OT_gaussian_smooth(struct wmOperatorType *ot); -void GRAPH_OT_sample(struct wmOperatorType *ot); +void GRAPH_OT_bake_keys(struct wmOperatorType *ot); void GRAPH_OT_keys_to_samples(struct wmOperatorType *ot); void GRAPH_OT_samples_to_keys(struct wmOperatorType *ot); void GRAPH_OT_sound_to_samples(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_graph/graph_ops.cc b/source/blender/editors/space_graph/graph_ops.cc index 02cc813237a..6c2ec17a7b2 100644 --- a/source/blender/editors/space_graph/graph_ops.cc +++ b/source/blender/editors/space_graph/graph_ops.cc @@ -459,7 +459,7 @@ void graphedit_operatortypes() WM_operatortype_append(GRAPH_OT_interpolation_type); WM_operatortype_append(GRAPH_OT_extrapolation_type); WM_operatortype_append(GRAPH_OT_easing_type); - WM_operatortype_append(GRAPH_OT_sample); + WM_operatortype_append(GRAPH_OT_bake_keys); WM_operatortype_append(GRAPH_OT_keys_to_samples); WM_operatortype_append(GRAPH_OT_samples_to_keys); WM_operatortype_append(GRAPH_OT_sound_to_samples);