Page MenuHome

Fix T103303: Dbl-click in the Graph Editor wont select all keyframes
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Dec 27 2022, 1:49 PM.

Details

Summary

This was the case when an Annotation is also present as in the report.

Since rB92d7f9ac56e0: Animation: Add GP layers in regular Dopesheet, Dopesheet is aware of greaspencil/annotations
(displays its channels/keyframes, can rename their data, layers, fcurve
groupings etc.). However, the Graph Editor does not display these /
should not be aware of them.

Above commit already had issues that were addressed in the following
commits (mostly adding the new ANIMFILTER_FCURVESONLY to places that
dont handle greasepencil/annotations)

Now in T103303 it was reported that doublicking a channel would not
select all fcurve`s keyframes anymore and this wasnt actually an issue
with that particular operator, but instead with another operator that is
also mapped to doubleclicking: the channel renaming (I assume the
keyconflict here is actually wanted behavior).
Channel renaming would not return OPERATOR_PASS_THROUGH here anymore
in the case nothing cannot be renamed, so we would not actually reach
the 2nd operator at all (the one selecting all keyframes).
Deeper reason for this is that the renaming operator would actually
"see" a channel that could be renamed (in the case of the report: an
annotation layer), but then cannot proceed, because the "real"
underlying data where the doubleclick happens is an fcurve...

So now exclude non-greasepencil channels in filtering as well where
appropriate (namely animdata_filter_dopesheet /
animdata_filter_animchan / animdata_filter_dopesheet_scene /
animdata_filter_dopesheet_ob) by also adding ANIMFILTER_FCURVESONLY
to the filter there.

Fixes T103303.

Diff Detail

Repository
rB Blender

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Dec 27 2022, 1:49 PM

Hey @Philipp Oeser (lichtwerk), thanks for the patch.

Well done for sorting this one out !
The diff does not seem to fix the issue in all cases. Here is a blend file for which the issue remains (double click on Z-location in graph editor for example) :

.

Two remarks on the code :

  • There is a function that checks if an animation container can have grease pencil channels, it may be useful here : ANIM_animdata_can_have_greasepencil (defined in anim_filter.c:420)
  • I am not sure it's a good idea to add a filter in an if inside a loop. Maybe outside the loop would be better.

The fact that the functions animdata_filter_dopesheet and animdata_filter_dopesheet_scene are not always used in the scope of the dopesheet is a bit confusing to me (here there are used in the scope of the graph editor for example).
So I guess these functions have the responsibility to check if their container has fcurve channels or not, but I'm not sure.
Maybe @Sybren A. Stüvel (sybren) knows better about this.

The diff does not seem to fix the issue in all cases.

Ah, was just looking at annotations (not GP objects), so same thing needs to go into animdata_filter_dopesheet_ob as well, will update shortly...

Will also check on your other comments in a bit...

also consider GP objects (not just Annotations)

use ANIM_animdata_can_have_greasepencil (this checks not being in Graph Editor context)

move manipulating the filter outside the loop

I guess the fact that animdata_filter_dopesheetXXX is reused in other Editor contexts has historical reasons.

Another thing is that ANIMFILTER_FCURVESONLY filters out mask layer keyframes as well (44ec91163374). They are not listed in the main mode of the dopesheet, nor in the graph editor.
But if the mask mode of the dopesheet needs to call the animdata_filter_dopesheet*, mask layers will be filtered out.

@Philipp Oeser (lichtwerk) There is another way to do solve this issue, that may be more consistent with the rest of the code of anim_channels_edit.c, and especially with the behavior of the "Mouse Click on Channels" operator (ANIM_OT_channels_click).
It goes like this. Add the context as first parameter of rename_anim_channels, and in the definition add the FCURVES_ONLY filter if the area space is the graph or NLA editor :

anim_channels_edit.c:2840 (in master)

static bool rename_anim_channels(bContext *C, bAnimContext *ac, int channel_index)
{
 ...
  ScrArea *area = CTX_wm_area(C);

 ...
  filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
  if (ELEM(area->spacetype, SPACE_NLA, SPACE_GRAPH)) {
    filter |= ANIMFILTER_FCURVESONLY;
  }
  ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 ...

This way the animdata_filter_dopesheetXXX functions only deal with the existing filters and do not silently add others. What do you think about it ?

Another thing is that ANIMFILTER_FCURVESONLY filters out mask layer keyframes as well (44ec91163374). They are not listed in the main mode of the dopesheet, nor in the graph editor.
But if the mask mode of the dopesheet needs to call the animdata_filter_dopesheet*, mask layers will be filtered out.

Hm, cannot come up with a scenario where this is a problem in practice, can you?

@Philipp Oeser (lichtwerk) There is another way to do solve this issue, that may be more consistent with the rest of the code of anim_channels_edit.c, and especially with the behavior of the "Mouse Click on Channels" operator (ANIM_OT_channels_click).
This way the animdata_filter_dopesheetXXX functions only deal with the existing filters and do not silently add others. What do you think about it ?

That was the obvious first choice (to do it in the rename operator), but I must have somehow made a mistake which forced me on the detour to do it lower level in the filtering code instead.
Not sure what it was tbh, but yeah, doing it there is preferred.

It goes like this. Add the context as first parameter of rename_anim_channels

Dont need to do this, you can check ANIMCONT_FCURVES, ANIMCONT_NLA from bAnimContext directly.

Will update the patch accordingly shortly.

Well, if the mask mode of the dopesheet uses at some point an animdata_filter_dopesheet_XXX function, then ANIM_animdata_can_have_greasepencil returns False (because the mask mode of the dopesheet cannot have grease pencil frames), and then the filter ANIMFILTER_FCURVESONLY is applied, which filters out all mask frames. Such a bug would be difficult to sort out, because the animdata_filter_dopesheet_XXX function silently added this fcurves-only filter.

I never use masks, and thus not very comfortable testing this part of the software, but it seems a bit unlogical, actually maybe the if condition should be something like ANIM_animdata_has_fcurves_only instead of !ANIM_animdata_can_have_greasepencil.

manipulate filter more isolated (namely in rename_anim_channels)

Looks good to me !
The only point that worries me is : are NLA and Graph Editor the only places where such error can happen ? I think for now, these are the two animation containers that have this kind of fcurve-only preventive flags.
Maybe in the future we should test other containers, like drivers, action, shapekey, and a cleanup would be to define the ANIM_animdata_has_fcurves_only to list them all. But I believe it can be done is another patch.

This revision is now accepted and ready to land.Jan 5 2023, 11:25 AM