Animation: Clamp V2D so keyframes cannot go offscreen #104516

Merged
Christoph Lendenfeld merged 15 commits from ChrisLend/blender:vertical_scrolling_offscreen into main 2023-02-17 12:47:58 +01:00

In the Dope Sheet and the Timeline, it was possible to drag the view until the keyframes were completely out of view. (Important to drag in the region with the keyframes, dragging in the channel box already did clamping)

This patch adds a clamping mechanism matching that of the channel box. That means the last channel will stick to the bottom of the view.


before

before

after

channels clamped

archived patch comments: https://archive.blender.org/developer/D17182

Steps to reproduce:

Download the demo file (anim_test.blend)
In the dope sheet, drag up with the middle mouse button until all channels are out of view.

In the Dope Sheet and the Timeline, it was possible to drag the view until the keyframes were completely out of view. (Important to drag in the region with the keyframes, dragging in the channel box already did clamping) This patch adds a clamping mechanism matching that of the channel box. That means the last channel will stick to the bottom of the view. ----- before ![before](https://projects.blender.org/attachments/3bb25d0e-fef2-4886-b7a2-bbd57cc475c4) after ![channels clamped](/attachments/f6a2904f-bd59-40b4-9d8b-0a7fcd1d3e5d) archived patch comments: https://archive.blender.org/developer/D17182 **Steps to reproduce:** Download the demo file (anim_test.blend) In the dope sheet, drag up with the middle mouse button until all channels are out of view.
Christoph Lendenfeld added 7 commits 2023-02-09 14:48:11 +01:00
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2023-02-09 14:48:41 +01:00
Christoph Lendenfeld added 3 commits 2023-02-09 16:06:12 +01:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2023-02-09 16:06:32 +01:00
Author
Member

@dr.sybren regarding your comments on phabricator

There is still a way to get "scrolled out of view" animation channels. In the default scene:

    Animate the default cube, expand the channels, scroll them all the way to the top so that only the last one is showing.
    Select the camera.

I tried adding the clamping logic in action_main_region_listener as well. However it doesn't do anything. My suspicion is that v2d->tot is only calculated on draw.
There are also other issues tangential to this patch. Anytime you open the N-Panel or resize the window, the channels jump around. Not sure if that should be addressed here though

@dr.sybren regarding your comments on phabricator ``` There is still a way to get "scrolled out of view" animation channels. In the default scene: Animate the default cube, expand the channels, scroll them all the way to the top so that only the last one is showing. Select the camera. ``` I tried adding the clamping logic in `action_main_region_listener` as well. However it doesn't do anything. My suspicion is that `v2d->tot` is only calculated on draw. There are also other issues tangential to this patch. Anytime you open the N-Panel or resize the window, the channels jump around. Not sure if that should be addressed here though
Brecht Van Lommel added this to the Animation & Rigging project 2023-02-13 09:13:57 +01:00
Sybren A. Stüvel approved these changes 2023-02-14 17:05:18 +01:00
Sybren A. Stüvel left a comment
Member

I found the source of my confusion.

Middle-mouse drag the channel list: scrolling stops when the last channel is fully visible (i.e. the last channel is stuck to the bottom of the area).

Middle-mouse drag the keys: the channel list is allowed to scroll completely off-screen, which is indeed fixed in this PR.

I found the source of my confusion. Middle-mouse drag the *channel list*: scrolling stops when the last channel is fully visible (i.e. the last channel is stuck to the bottom of the area). Middle-mouse drag the *keys*: the channel list is allowed to scroll completely off-screen, which is indeed fixed in this PR.
Sybren A. Stüvel removed this from the Animation & Rigging project 2023-02-14 17:06:18 +01:00
Sybren A. Stüvel added this to the Animation & Rigging project 2023-02-14 17:06:26 +01:00
Author
Member

@dr.sybren that means the middle mouse drag behaviour is now inconsistent between the channel box and the keyframe view (I mean it was already inconsistent before the patch but anyway)
I think it would be better to make it consistent with the channel box.
Even if it means locking the scrolling in a way that makes the last element stick to the bottom of the view

@dr.sybren that means the middle mouse drag behaviour is now inconsistent between the channel box and the keyframe view (I mean it was already inconsistent before the patch but anyway) I think it would be better to make it consistent with the channel box. Even if it means locking the scrolling in a way that makes the last element stick to the bottom of the view

I think it would be better to make it consistent with the channel box.

Agreed.

Even if it means locking the scrolling in a way that makes the last element stick to the bottom of the view

Hmmmmmmmmmmmmm.... I'm a bit torn between "keep PRs small" and "make Blender work conveniently". Personally I don't like editors that have a "greedy bottom" like this; same with text editors, sometimes I just want to be able to look straight up at something and not have it stuck to the bottom of the window. Same with keys: maybe an animator wants to visually align the keys with the header, or for whatever other reason scroll to the top. I don't see the downside of that, and I think we should do that for the channel list as well.

So I think we have these choices:

  • A: also change the channel list behaviour in this patch (so that expands to other editors/modes as well), or
  • B: limit this PR to making the key scrolling the same as the channel list, and then do two more PRs (one non-functional change to have all those limits use the same code, and one functional change to change that limit to allow scrolling all the way to the top).

What would you prefer?

> I think it would be better to make it consistent with the channel box. Agreed. > Even if it means locking the scrolling in a way that makes the last element stick to the bottom of the view Hmmmmmmmmmmmmm.... I'm a bit torn between "keep PRs small" and "make Blender work conveniently". Personally I don't like editors that have a "greedy bottom" like this; same with text editors, sometimes I just want to be able to look straight up at something and not have it stuck to the bottom of the window. Same with keys: maybe an animator wants to visually align the keys with the header, or for whatever other reason scroll to the top. I don't see the downside of that, and I think we should do that for the channel list as well. So I think we have these choices: - `A`: also change the channel list behaviour in this patch (so that expands to other editors/modes as well), or - `B`: limit this PR to making the key scrolling the same as the channel list, and then do two more PRs (one non-functional change to have all those limits use the same code, and one functional change to change that limit to allow scrolling all the way to the top). What would you prefer?
Author
Member

I think B would be better.
Fix it first, then make it better

Also that way we don't have blender in an inconsistent state

I think `B` would be better. Fix it first, then make it better Also that way we don't have blender in an inconsistent state
Christoph Lendenfeld added 3 commits 2023-02-16 16:57:21 +01:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2023-02-16 17:02:37 +01:00
Sybren A. Stüvel approved these changes 2023-02-17 12:30:37 +01:00
Sybren A. Stüvel left a comment
Member

Tiny thing, the rest looks good to me!
No need to re-review after adjusting.

Tiny thing, the rest looks good to me! No need to re-review after adjusting.
@ -403,0 +410,4 @@
v2d->cur.ymax = 0;
}
else {
if (v2d->cur.ymin < v2d->tot.ymin) {

These two lines can be merged as else if (...) {. That reduces the nesting of the block, and makes it clearer this is "a list of alternatives" instead of "nested conditions".

These two lines can be merged as `else if (...) {`. That reduces the nesting of the block, and makes it clearer this is "a list of alternatives" instead of "nested conditions".
Christoph Lendenfeld added 2 commits 2023-02-17 12:46:08 +01:00
Christoph Lendenfeld merged commit cb95f8aea7 into main 2023-02-17 12:47:58 +01:00
Christoph Lendenfeld deleted branch vertical_scrolling_offscreen 2023-02-17 12:47:59 +01:00
First-time contributor

If there are markers in Timeline, in a narrow editor, last animation channel is hidden, not accessible.

Basically, user is forced to expand editor at a scale superior to the one when all channels are displayed or to use filter, in order to see last channel + markers.

In order to reach keyframes of last animation channel, an offset of this limit, equivalent to height of Makers Region would be welcomed.

If there are markers in Timeline, in a narrow editor, last animation channel is hidden, not accessible. Basically, user is forced to expand editor at a scale superior to the one when all channels are displayed or to use filter, in order to see last channel + markers. In order to reach keyframes of last animation channel, an offset of this limit, equivalent to height of Makers Region would be welcomed.
Author
Member

If there are markers in Timeline, in a narrow editor, last animation channel is hidden, not accessible.

Basically, user is forced to expand editor at a scale superior to the one when all channels are displayed, in order to see last channel + markers.

In order to reach keyframes of last animation channel, an offset of this limit, equivalent to height of Makers Region would be welcomed.

aah yes thanks for the comment. I'll make sure to fix it asap

> If there are markers in Timeline, in a narrow editor, last animation channel is hidden, not accessible. > > Basically, user is forced to expand editor at a scale superior to the one when all channels are displayed, in order to see last channel + markers. > > In order to reach keyframes of last animation channel, an offset of this limit, equivalent to height of Makers Region would be welcomed. aah yes thanks for the comment. I'll make sure to fix it asap
Sybren A. Stüvel removed this from the Animation & Rigging project 2023-03-02 17:00:20 +01:00
Sign in to join this conversation.
No reviewers
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
3 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#104516
No description provided.