Animation: Rename Graph_OT_sample #112148

Merged
Christoph Lendenfeld merged 2 commits from ChrisLend/blender:rename_graph_ot_sample into main 2023-09-12 09:32:29 +02:00
8 changed files with 16 additions and 16 deletions

View File

@ -1893,7 +1893,7 @@ def km_graph_editor(params):
("graph.interpolation_type", {"type": 'T', "value": 'PRESS'}, None), ("graph.interpolation_type", {"type": 'T', "value": 'PRESS'}, None),
("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.bake_keys", {"type": 'O', "value": 'PRESS', "shift": True, "alt": True}, None),
("graph.keys_to_samples", {"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)]}),

View File

@ -305,7 +305,7 @@ class GRAPH_MT_key_density(Menu):
# as we do not have a modal mode for it, so just execute it. # as we do not have a modal mode for it, so just execute it.
with operator_context(layout, 'EXEC_REGION_WIN'): with operator_context(layout, 'EXEC_REGION_WIN'):
layout.operator("graph.decimate", text="Decimate (Allowed Change)").mode = 'ERROR' layout.operator("graph.decimate", text="Decimate (Allowed Change)").mode = 'ERROR'
layout.operator("graph.sample") layout.operator("graph.bake_keys")
layout.separator() layout.separator()
layout.operator("graph.clean").channels = False layout.operator("graph.clean").channels = False

View File

@ -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; BezTriple *bezt, *start = nullptr, *end = nullptr;
TempFrameValCache *value_cache, *fp; TempFrameValCache *value_cache, *fp;

View File

@ -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. * Use a weighted moving-means method to reduce intensity of fluctuations.
*/ */
void smooth_fcurve(FCurve *fcu); 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. * \param sample_rate: indicates how many samples per frame should be generated.
*/ */

View File

@ -1248,7 +1248,7 @@ static void sample_action_keys(bAnimContext *ac)
/* Loop through filtered data and add keys between selected keyframes on every frame. */ /* Loop through filtered data and add keys between selected keyframes on every frame. */
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
sample_fcurve((FCurve *)ale->key_data); bake_fcurve_segments((FCurve *)ale->key_data);
ale->update |= ANIM_UPDATE_DEPS; ale->update |= ANIM_UPDATE_DEPS;
} }

View File

@ -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. */ /* 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}; ListBase anim_data = {nullptr, nullptr};
int filter; 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. */ /* Loop through filtered data and add keys between selected keyframes on every frame. */
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
sample_fcurve((FCurve *)ale->key_data); bake_fcurve_segments((FCurve *)ale->key_data);
ale->update |= ANIM_UPDATE_DEPS; 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; bAnimContext ac;
@ -1338,8 +1338,8 @@ static int graphkeys_sample_exec(bContext *C, wmOperator * /*op*/)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
/* Sample keyframes. */ /* Bake keyframes. */
sample_graph_keys(&ac); bake_graph_keys(&ac);
/* Set notifier that keyframes have changed. */ /* Set notifier that keyframes have changed. */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr); 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; return OPERATOR_FINISHED;
} }
void GRAPH_OT_sample(wmOperatorType *ot) void GRAPH_OT_bake_keys(wmOperatorType *ot)
{ {
/* Identifiers */ /* Identifiers */
ot->name = "Sample Keyframes"; ot->name = "Bake Keyframes";

Any reason "Bake Keys" and Not "Bake Keyframes"?

Any reason "Bake Keys" and Not "Bake Keyframes"?

good catch, keeps it consistent with the ACTION_... operator

good catch, keeps it consistent with the ACTION_... operator
ot->idname = "GRAPH_OT_sample"; ot->idname = "GRAPH_OT_bake_keys";
ot->description = "Add keyframes on every frame between the selected keyframes"; ot->description = "Add keyframes on every frame between the selected keyframes";
/* API callbacks */ /* API callbacks */
ot->exec = graphkeys_sample_exec; ot->exec = graphkeys_bake_exec;
ot->poll = graphop_editable_keyframes_poll; ot->poll = graphop_editable_keyframes_poll;
/* Flags */ /* Flags */

View File

@ -128,7 +128,7 @@ void GRAPH_OT_decimate(struct wmOperatorType *ot);
void GRAPH_OT_blend_to_default(struct wmOperatorType *ot); 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_bake_keys(struct wmOperatorType *ot);
void GRAPH_OT_keys_to_samples(struct wmOperatorType *ot); void GRAPH_OT_keys_to_samples(struct wmOperatorType *ot);
void GRAPH_OT_samples_to_keys(struct wmOperatorType *ot); void GRAPH_OT_samples_to_keys(struct wmOperatorType *ot);
void GRAPH_OT_sound_to_samples(struct wmOperatorType *ot); void GRAPH_OT_sound_to_samples(struct wmOperatorType *ot);

View File

@ -459,7 +459,7 @@ void graphedit_operatortypes()
WM_operatortype_append(GRAPH_OT_interpolation_type); WM_operatortype_append(GRAPH_OT_interpolation_type);
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_bake_keys);
WM_operatortype_append(GRAPH_OT_keys_to_samples); WM_operatortype_append(GRAPH_OT_keys_to_samples);
WM_operatortype_append(GRAPH_OT_samples_to_keys); WM_operatortype_append(GRAPH_OT_samples_to_keys);
WM_operatortype_append(GRAPH_OT_sound_to_samples); WM_operatortype_append(GRAPH_OT_sound_to_samples);