Fix #138869: Select Colums on selected Keys fails in NLA tweakmode
Currently, `columnselect_action_keys` gets "raw" non-NLA-mapped keyframe data via `ANIM_fcurve_keyframes_loop` with the `bezt_to_cfraelem` callback, so the list of `CfraElem` contains frames in "local" FCurve space. Later, this would be (rightfully) NLA-unmapped to "local/strip" time, because this is what `ANIM_editkeyframes_ok(BEZT_OK_FRAME)` expects, it also only compares "raw" `BezTriple` data. But this only makes sense if we would store "global/scene" frame data in `CfraElem` `cfra` already. This is what we now do, let `bezt_to_cfraelem` perform the NLATIME_CONVERT_MAP Pull Request: https://projects.blender.org/blender/blender/pulls/138937
This commit is contained in:
committed by
Philipp Oeser
parent
52b8eba9eb
commit
d2ea328a6c
@@ -844,10 +844,19 @@ short bezt_calc_average(KeyframeEditData *ked, BezTriple *bezt)
|
||||
short bezt_to_cfraelem(KeyframeEditData *ked, BezTriple *bezt)
|
||||
{
|
||||
/* only if selected */
|
||||
if (bezt->f2 & SELECT) {
|
||||
CfraElem *ce = MEM_callocN<CfraElem>("cfraElem");
|
||||
BLI_addtail(&ked->list, ce);
|
||||
if ((bezt->f2 & SELECT) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CfraElem *ce = MEM_callocN<CfraElem>("cfraElem");
|
||||
BLI_addtail(&ked->list, ce);
|
||||
|
||||
/* bAnimListElem so we can do NLA mapping, we want the cfra to be in "global" time */
|
||||
bAnimListElem *ale = static_cast<bAnimListElem *>(ked->data);
|
||||
if (ale != nullptr) {
|
||||
ce->cfra = ANIM_nla_tweakedit_remap(ale, bezt->vec[1][0], NLATIME_CONVERT_MAP);
|
||||
}
|
||||
else {
|
||||
ce->cfra = bezt->vec[1][0];
|
||||
}
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@ ENUM_OPERATORS(eKeyframeIterFlags, KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE)
|
||||
*/
|
||||
struct CfraElem {
|
||||
CfraElem *next, *prev;
|
||||
/* Expected to be in global scene time (e.g. not NLA unmapped). */
|
||||
float cfra;
|
||||
int sel;
|
||||
};
|
||||
|
||||
@@ -1165,6 +1165,7 @@ static void columnselect_action_keys(bAnimContext *ac, short mode)
|
||||
ED_gpencil_layer_make_cfra_list(static_cast<bGPDlayer *>(ale->data), &ked.list, true);
|
||||
}
|
||||
else {
|
||||
ked.data = ale;
|
||||
ANIM_fcurve_keyframes_loop(
|
||||
&ked, static_cast<FCurve *>(ale->key_data), nullptr, bezt_to_cfraelem, nullptr);
|
||||
}
|
||||
|
||||
@@ -1219,6 +1219,7 @@ static void columnselect_graph_keys(bAnimContext *ac, short mode)
|
||||
ac, &anim_data, eAnimFilter_Flags(filter), ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
|
||||
ked.data = ale;
|
||||
ANIM_fcurve_keyframes_loop(
|
||||
&ked, static_cast<FCurve *>(ale->key_data), nullptr, bezt_to_cfraelem, nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user