Animation: Rename "Bake Curve" to "Keys to Samples" #111049

Merged
Christoph Lendenfeld merged 5 commits from ChrisLend/blender:bake_curve_rename into main 2023-09-08 14:01:55 +02:00
5 changed files with 42 additions and 42 deletions

View File

@ -1894,7 +1894,7 @@ def km_graph_editor(params):
("graph.easing_type", {"type": 'E', "value": 'PRESS', "ctrl": True}, None), ("graph.easing_type", {"type": 'E', "value": 'PRESS', "ctrl": True}, None),
("graph.smooth", {"type": 'O', "value": 'PRESS', "alt": True}, None), ("graph.smooth", {"type": 'O', "value": 'PRESS', "alt": True}, None),
("graph.sample", {"type": 'O', "value": 'PRESS', "shift": True, "alt": True}, None), ("graph.sample", {"type": 'O', "value": 'PRESS', "shift": True, "alt": True}, None),
("graph.bake", {"type": 'C', "value": 'PRESS', "alt": True}, None), ("graph.keys_to_samples", {"type": 'C', "value": 'PRESS', "alt": True}, None),
op_menu("GRAPH_MT_delete", {"type": 'X', "value": 'PRESS'}), op_menu("GRAPH_MT_delete", {"type": 'X', "value": 'PRESS'}),
("graph.delete", {"type": 'DEL', "value": 'PRESS'}, {"properties": [("confirm", False)]}), ("graph.delete", {"type": 'DEL', "value": 'PRESS'}, {"properties": [("confirm", False)]}),
("graph.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None), ("graph.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True}, None),

View File

@ -283,8 +283,8 @@ class GRAPH_MT_channel(Menu):
layout.operator("anim.channels_fcurves_enable") layout.operator("anim.channels_fcurves_enable")
layout.separator() layout.separator()
layout.operator("graph.bake") layout.operator("graph.keys_to_samples")
layout.operator("graph.unbake") layout.operator("graph.samples_to_keys")
layout.operator("graph.sound_bake") layout.operator("graph.sound_bake")
layout.separator() layout.separator()

View File

@ -894,13 +894,13 @@ void GRAPH_OT_clean(wmOperatorType *ot)
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/** \name Bake F-Curve Operator /** \name Keys to Samples Operator
* *
* This operator bakes the data of the selected F-Curves to F-Points. * This operator bakes the data of the selected F-Curves to F-Points.
* \{ */ * \{ */
/* Bake each F-Curve into a set of samples. */ /* Bake each F-Curve into a set of samples. */
static void bake_graph_curves(bAnimContext *ac, int start, int end) static void convert_keys_to_samples(bAnimContext *ac, int start, int end)
{ {
ListBase anim_data = {nullptr, nullptr}; ListBase anim_data = {nullptr, nullptr};
int filter; int filter;
@ -934,7 +934,7 @@ static void bake_graph_curves(bAnimContext *ac, int start, int end)
/* ------------------- */ /* ------------------- */
static int graphkeys_bake_exec(bContext *C, wmOperator * /*op*/) static int graphkeys_keys_to_samples_exec(bContext *C, wmOperator * /*op*/)
{ {
bAnimContext ac; bAnimContext ac;
Scene *scene = nullptr; Scene *scene = nullptr;
@ -951,8 +951,8 @@ static int graphkeys_bake_exec(bContext *C, wmOperator * /*op*/)
start = PSFRA; start = PSFRA;
end = PEFRA; end = PEFRA;
/* Bake keyframes. */ /* Sample keyframes. */
bake_graph_curves(&ac, start, end); convert_keys_to_samples(&ac, start, end);
/* Set notifier that keyframes have changed. */ /* Set notifier that keyframes have changed. */
/* NOTE: some distinction between order/number of keyframes and type should be made? */ /* NOTE: some distinction between order/number of keyframes and type should be made? */
@ -961,16 +961,17 @@ static int graphkeys_bake_exec(bContext *C, wmOperator * /*op*/)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
void GRAPH_OT_bake(wmOperatorType *ot) void GRAPH_OT_keys_to_samples(wmOperatorType *ot)
{ {
/* Identifiers */ /* Identifiers */
ot->name = "Bake Curve"; ot->name = "Keys to Samples";
ot->idname = "GRAPH_OT_bake"; ot->idname = "GRAPH_OT_keys_to_samples";
ot->description = "Bake selected F-Curves to a set of sampled points defining a similar curve"; ot->description =
"Convert selected channels to an uneditable set of samples to save storage space";
/* API callbacks */ /* API callbacks */
ot->invoke = WM_operator_confirm_or_exec; ot->invoke = WM_operator_confirm_or_exec;
ot->exec = graphkeys_bake_exec; ot->exec = graphkeys_keys_to_samples_exec;
ot->poll = graphop_selected_fcurve_poll; ot->poll = graphop_selected_fcurve_poll;
/* Flags */ /* Flags */
@ -983,13 +984,13 @@ void GRAPH_OT_bake(wmOperatorType *ot)
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/** \name Un-Bake F-Curve Operator /** \name Samples to Keys Operator
* *
* This operator un-bakes the data of the selected F-Points to F-Curves. * This operator converts the data of the selected F-Points to F-Curves.
* \{ */ * \{ */
/* Un-Bake F-Points into F-Curves. */ /* Convert F-Points into F-Curves. */
static void unbake_graph_curves(bAnimContext *ac, int start, int end) static void convert_samples_to_keys(bAnimContext *ac, int start, int end)
{ {
ListBase anim_data = {nullptr, nullptr}; ListBase anim_data = {nullptr, nullptr};
@ -1014,7 +1015,7 @@ static void unbake_graph_curves(bAnimContext *ac, int start, int end)
/* ------------------- */ /* ------------------- */
static int graphkeys_unbake_exec(bContext *C, wmOperator * /*op*/) static int graphkeys_samples_to_keys_exec(bContext *C, wmOperator * /*op*/)
{ {
bAnimContext ac; bAnimContext ac;
Scene *scene = nullptr; Scene *scene = nullptr;
@ -1029,8 +1030,7 @@ static int graphkeys_unbake_exec(bContext *C, wmOperator * /*op*/)
start = PSFRA; start = PSFRA;
end = PEFRA; end = PEFRA;
/* Unbake keyframes. */ convert_samples_to_keys(&ac, start, end);
unbake_graph_curves(&ac, start, end);
/* Set notifier that keyframes have changed. */ /* Set notifier that keyframes have changed. */
/* NOTE: some distinction between order/number of keyframes and type should be made? */ /* NOTE: some distinction between order/number of keyframes and type should be made? */
@ -1039,15 +1039,15 @@ static int graphkeys_unbake_exec(bContext *C, wmOperator * /*op*/)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
void GRAPH_OT_unbake(wmOperatorType *ot) void GRAPH_OT_samples_to_keys(wmOperatorType *ot)
{ {
/* Identifiers */ /* Identifiers */
ot->name = "Un-Bake Curve"; ot->name = "Samples to Keys";
ot->idname = "GRAPH_OT_unbake"; ot->idname = "GRAPH_OT_samples_to_keys";
ot->description = "Un-Bake selected F-Points to F-Curves"; ot->description = "Convert selected channels from samples to keyframes";
/* API callbacks */ /* API callbacks */
ot->exec = graphkeys_unbake_exec; ot->exec = graphkeys_samples_to_keys_exec;
ot->poll = graphop_selected_fcurve_poll; ot->poll = graphop_selected_fcurve_poll;
/* Flags */ /* Flags */
@ -1059,9 +1059,9 @@ void GRAPH_OT_unbake(wmOperatorType *ot)
/** \} */ /** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/** \name Sound Bake F-Curve Operator /** \name Sound to Samples Operator
* *
* This operator bakes the given sound to the selected F-Curves. * This operator converts the given sound to samples on the selected F-Curves.
* \{ */ * \{ */
/* ------------------- */ /* ------------------- */
@ -1094,7 +1094,7 @@ static float fcurve_samplingcb_sound(FCurve * /*fcu*/, void *data, float evaltim
/* ------------------- */ /* ------------------- */
static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op) static int graphkeys_sound_to_samples_exec(bContext *C, wmOperator *op)
{ {
bAnimContext ac; bAnimContext ac;
ListBase anim_data = {nullptr, nullptr}; ListBase anim_data = {nullptr, nullptr};
@ -1175,7 +1175,7 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op)
#else /* WITH_AUDASPACE */ #else /* WITH_AUDASPACE */
static int graphkeys_sound_bake_exec(bContext * /*C*/, wmOperator *op) static int graphkeys_sound_to_samples_exec(bContext * /*C*/, wmOperator *op)
{ {
BKE_report(op->reports, RPT_ERROR, "Compiled without sound support"); BKE_report(op->reports, RPT_ERROR, "Compiled without sound support");
@ -1184,7 +1184,7 @@ static int graphkeys_sound_bake_exec(bContext * /*C*/, wmOperator *op)
#endif /* WITH_AUDASPACE */ #endif /* WITH_AUDASPACE */
static int graphkeys_sound_bake_invoke(bContext *C, wmOperator *op, const wmEvent *event) static int graphkeys_sound_to_samples_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{ {
bAnimContext ac; bAnimContext ac;
@ -1196,16 +1196,16 @@ static int graphkeys_sound_bake_invoke(bContext *C, wmOperator *op, const wmEven
return WM_operator_filesel(C, op, event); return WM_operator_filesel(C, op, event);
} }
void GRAPH_OT_sound_bake(wmOperatorType *ot) void GRAPH_OT_sound_to_samples(wmOperatorType *ot)
{ {
/* Identifiers */ /* Identifiers */
ot->name = "Bake Sound to F-Curves"; ot->name = "Sound to Samples";
ot->idname = "GRAPH_OT_sound_bake"; ot->idname = "GRAPH_OT_sound_to_samples";
ot->description = "Bakes a sound wave to selected F-Curves"; ot->description = "Bakes a sound wave to samples on selected channels";
nathanvegdahl marked this conversation as resolved Outdated

For the description, maybe:

Bakes a sound wave to samples on selected channels

(Precises phrasing can probably be improved.) To keep the key vs samples distinction clear.

For the description, maybe: > Bakes a sound wave to samples on selected channels (Precises phrasing can probably be improved.) To keep the key vs samples distinction clear.

I like it. Changed :)

I like it. Changed :)
/* API callbacks */ /* API callbacks */
ot->invoke = graphkeys_sound_bake_invoke; ot->invoke = graphkeys_sound_to_samples_invoke;
ot->exec = graphkeys_sound_bake_exec; ot->exec = graphkeys_sound_to_samples_exec;
ot->poll = graphop_selected_fcurve_poll; ot->poll = graphop_selected_fcurve_poll;
/* Flags */ /* Flags */

View File

@ -128,9 +128,9 @@ void GRAPH_OT_blend_to_default(struct wmOperatorType *ot);
void GRAPH_OT_butterworth_smooth(struct wmOperatorType *ot); void GRAPH_OT_butterworth_smooth(struct wmOperatorType *ot);
void GRAPH_OT_gaussian_smooth(struct wmOperatorType *ot); void GRAPH_OT_gaussian_smooth(struct wmOperatorType *ot);
void GRAPH_OT_sample(struct wmOperatorType *ot); void GRAPH_OT_sample(struct wmOperatorType *ot);
void GRAPH_OT_bake(struct wmOperatorType *ot); void GRAPH_OT_keys_to_samples(struct wmOperatorType *ot);
void GRAPH_OT_unbake(struct wmOperatorType *ot); void GRAPH_OT_samples_to_keys(struct wmOperatorType *ot);
void GRAPH_OT_sound_bake(struct wmOperatorType *ot); void GRAPH_OT_sound_to_samples(struct wmOperatorType *ot);
void GRAPH_OT_smooth(struct wmOperatorType *ot); void GRAPH_OT_smooth(struct wmOperatorType *ot);
void GRAPH_OT_euler_filter(struct wmOperatorType *ot); void GRAPH_OT_euler_filter(struct wmOperatorType *ot);

View File

@ -460,9 +460,9 @@ void graphedit_operatortypes()
WM_operatortype_append(GRAPH_OT_extrapolation_type); WM_operatortype_append(GRAPH_OT_extrapolation_type);
WM_operatortype_append(GRAPH_OT_easing_type); WM_operatortype_append(GRAPH_OT_easing_type);
WM_operatortype_append(GRAPH_OT_sample); WM_operatortype_append(GRAPH_OT_sample);
WM_operatortype_append(GRAPH_OT_bake); WM_operatortype_append(GRAPH_OT_keys_to_samples);
WM_operatortype_append(GRAPH_OT_unbake); WM_operatortype_append(GRAPH_OT_samples_to_keys);
WM_operatortype_append(GRAPH_OT_sound_bake); WM_operatortype_append(GRAPH_OT_sound_to_samples);
WM_operatortype_append(GRAPH_OT_smooth); WM_operatortype_append(GRAPH_OT_smooth);
WM_operatortype_append(GRAPH_OT_clean); WM_operatortype_append(GRAPH_OT_clean);
WM_operatortype_append(GRAPH_OT_decimate); WM_operatortype_append(GRAPH_OT_decimate);