Fix #97202: Channels of animation editors disappearing when applying filters #118006

Merged
Christoph Lendenfeld merged 5 commits from ChrisLend/blender:fix_channels_filter_to_empty into blender-v4.1-release 2024-02-29 10:33:13 +01:00

Note: while the report only mentions the Dope Sheet, this fix is applied to
the Graph Editor and NLA editor as well since they had the same issues.

The issue is that when applying filters, the list of channels shrink, but the View2D isn't updated accordingly.
When you move the viewport, the channels would jump back into view but not before.

The total height of the channel stack is computed every frame,
and the issue is fixed by calling the UI_view2d_curRect_clamp_y after that.

Since this has to be done before UI_view2d_view_ortho is called, I had to extract
the height calculations into the caller function.
I thought about making a generic function for all 3 editors but they were too different
to meaningfully do that.

I removed the fix that stopped the channels going off screen when using the cursor to scroll,
since the new logic already does that.

Also fixes #46649

Note: while the report only mentions the Dope Sheet, this fix is applied to the Graph Editor and NLA editor as well since they had the same issues. The issue is that when applying filters, the list of channels shrink, but the `View2D` isn't updated accordingly. When you move the viewport, the channels would jump back into view but not before. The total height of the channel stack is computed every frame, and the issue is fixed by calling the `UI_view2d_curRect_clamp_y` after that. Since this has to be done before `UI_view2d_view_ortho` is called, I had to extract the height calculations into the caller function. I thought about making a generic function for all 3 editors but they were too different to meaningfully do that. I removed the fix that stopped the channels going off screen when using the cursor to scroll, since the new logic already does that. Also fixes #46649
Christoph Lendenfeld added this to the 4.1 milestone 2024-02-08 17:37:40 +01:00
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2024-02-08 17:37:40 +01:00
Christoph Lendenfeld added 1 commit 2024-02-08 17:37:54 +01:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2024-02-08 18:48:24 +01:00
Christoph Lendenfeld requested review from Nate Rupsis 2024-02-08 18:48:24 +01:00
Nate Rupsis reviewed 2024-02-13 19:40:30 +01:00
@ -31,0 +30,4 @@
void graph_draw_channel_names(struct bContext *C,
struct bAnimContext *ac,
struct ARegion *region,
ListBase /* bAnimElem */ *anim_data);
Member

Would these be bAnimListElem?

Also, why is this a pointer, while the other two are references?

Would these be `bAnimListElem`? Also, why is this a pointer, while the other two are references?
Author
Member

🤦 yes you are right
not sure why I made this one a pointer, changed it to a const reference

🤦 yes you are right not sure why I made this one a pointer, changed it to a const reference
@ -990,7 +984,6 @@ void draw_nla_track_list(const bContext *C, bAnimContext *ac, ARegion *region)
}
/* free temporary tracks */
Member

Comment is now irrelevant.

Comment is now irrelevant.
@ -31,0 +30,4 @@
void draw_nla_track_list(const bContext *C,
bAnimContext *ac,
ARegion *region,
const ListBase /* bAnimElem */ &anim_data);
Member

Same here: would these be bAnimListElem?

Same here: would these be `bAnimListElem`?
Christoph Lendenfeld added 1 commit 2024-02-15 09:54:11 +01:00
Nate Rupsis approved these changes 2024-02-15 17:03:31 +01:00
Nate Rupsis left a comment
Member

LGTM :)

LGTM :)
Nathan Vegdahl requested changes 2024-02-27 14:48:46 +01:00
Dismissed
Nathan Vegdahl left a comment
Member

There are a couple of code comments that look like they don't belong to any code anymore. But otherwise, looks good to me.

There are a couple of code comments that look like they don't belong to any code anymore. But otherwise, looks good to me.
@ -1539,4 +1532,4 @@
/* Update max-extent of channels here (taking into account scrollers):
* - this is done to allow the channel list to be scrollable, but must be done here
* to avoid regenerating the list again and/or also because channels list is drawn first */
Member

Is this comment still relevant? I might be mis-reading it, but I think it was referring to the code that got removed.

Is this comment still relevant? I might be mis-reading it, but I think it was referring to the code that got removed.
@ -932,8 +928,6 @@ void draw_nla_track_list(const bContext *C, bAnimContext *ac, ARegion *region)
* - offset of NLATRACK_HEIGHT*2 is added to the height of the tracks, as first is for
* start of list offset, and the second is as a correction for the scrollers.
*/
Member

This also looks like a comment for now-deleted code. (It also looks out-of-date even for the code that was there.)

This also looks like a comment for now-deleted code. (It also looks out-of-date even for the code that was there.)
Christoph Lendenfeld added 2 commits 2024-02-27 16:14:09 +01:00
Christoph Lendenfeld requested review from Nathan Vegdahl 2024-02-27 16:14:29 +01:00
Nathan Vegdahl approved these changes 2024-02-27 16:48:47 +01:00
Nathan Vegdahl left a comment
Member

Looking through this again, the only remaining (mild) reservation I have is due to the removal of the on_view2d_changed callbacks. The callbacks aren't needed anymore, of course, since the relevant updates are now handled while drawing. So it's not their removal per se that gives me reservations. But rather, it makes me wonder if these kinds of things are supposed to be handled in the on_view2d_changed callback, and thus if this PR is the "right" fix. Some of the discussion in #46649 (particularly @dr.sybren's comments) also make me wonder.

I think another approach that could work would be to split the height calculation out into a separate function that also gets called from the on_view2d_changed callback to make the appropriate updates.

In any case, I don't personally feel strongly one way or the other, so I'm approving. But it might indeed be good to wait for a review from @dr.sybren as well before merging, after all.

Looking through this again, the only remaining (mild) reservation I have is due to the removal of the `on_view2d_changed` callbacks. The callbacks aren't needed anymore, of course, since the relevant updates are now handled while drawing. So it's not their removal per se that gives me reservations. But rather, it makes me wonder if these kinds of things are *supposed* to be handled in the `on_view2d_changed` callback, and thus if this PR is the "right" fix. Some of the discussion in #46649 (particularly @dr.sybren's comments) also make me wonder. I *think* another approach that could work would be to split the height calculation out into a separate function that also gets called from the `on_view2d_changed` callback to make the appropriate updates. In any case, I don't personally feel strongly one way or the other, so I'm approving. But it might indeed be good to wait for a review from @dr.sybren as well before merging, after all.
Author
Member

I will wait for sybren then, but since each view change also triggers a redraw I don't think on_view2d_changed is needed in this case.

What we'd need is a on_view2d_containing_data_changed or similar to fix this issue in a callback.

I will wait for sybren then, but since each view change also triggers a redraw I don't think `on_view2d_changed` is needed in this case. What we'd need is a `on_view2d_containing_data_changed` or similar to fix this issue in a callback.
Sybren A. Stüvel approved these changes 2024-02-29 09:21:57 +01:00
Sybren A. Stüvel left a comment
Member

LGTM, just a few tiny comments that can be addressed when landing.

LGTM, just a few tiny comments that can be addressed when landing.
@ -56,3 +56,3 @@
* \{ */
void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region, const ListBase &anim_data)

Can have a comment here too:

const ListBase /*bAnimListElem*/ &anim_data

Can have a comment here too: `const ListBase /*bAnimListElem*/ &anim_data`
@ -1525,0 +1524,4 @@
void graph_draw_channel_names(bContext *C,
bAnimContext *ac,
ARegion *region,
const ListBase &anim_data)

Same, add comment to ListBase

Same, add comment to `ListBase`
Christoph Lendenfeld added 1 commit 2024-02-29 10:24:09 +01:00
Christoph Lendenfeld merged commit a96f1208cc into blender-v4.1-release 2024-02-29 10:33:13 +01:00
Christoph Lendenfeld deleted branch fix_channels_filter_to_empty 2024-02-29 10:33:22 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#118006
No description provided.