Fix #114588: Graph Editor increment snap not working #114607

Merged
Christoph Lendenfeld merged 2 commits from ChrisLend/blender:fix_graph_editor_snapping into blender-v4.0-release 2023-11-09 14:38:37 +01:00

Here is how this issue came to be.

The regular snapping code has the feature that when you press Ctrl you can toggle the snapping on and off.
Prior to 4.0 the snapping for the Graph Editor used a completely different system, including a different flag to toggle snapping.

Because of that, the flag that the regular snapping code uses was never set by default. So the system thought it was disabled.
Now when you press Ctrl you would enable that flag and the snapping code would run.
It would snap to increments because that is the mode that is returned for the Graph Editor space type. (Note that this is the mode of the generic snapping system, not of the Graph Editor specific one)
However at the same time, doing that would disable the Graph Editor specific snapping code.
So the snapped values from the original system would bubble through.

This did not occur in the Dope Sheet and NLA Editor, because those never returned a snapping mode.
Those still have a different behavior to 3.6 where they now snap to seconds, instead of not snapping at all.

Here is how this issue came to be. The regular snapping code has the feature that when you press `Ctrl` you can toggle the snapping on and off. Prior to 4.0 the snapping for the Graph Editor used a completely different system, including a different flag to toggle snapping. Because of that, the flag that the regular snapping code uses was never set by default. So the system thought it was disabled. Now when you press `Ctrl` you would enable that flag and the snapping code would run. It would snap to increments because that is the mode that is returned for the Graph Editor space type. (Note that this is the mode of the generic snapping system, not of the Graph Editor specific one) However at the same time, doing that would disable the Graph Editor specific snapping code. So the snapped values from the original system would bubble through. This did not occur in the Dope Sheet and NLA Editor, because those never returned a snapping mode. Those still have a different behavior to 3.6 where they now snap to seconds, instead of not snapping at all.
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2023-11-07 23:08:11 +01:00
Nathan Vegdahl requested changes 2023-11-08 11:53:20 +01:00
Nathan Vegdahl left a comment
Member

The code looks good to me! However, when I tested, it still doesn't completely match the old behavior: in 3.6 holding down ctrl has the described behavior even when snapping is otherwise disabled, whereas with this patch it does nothing. Everything else appears to be working perfectly, though.

The code looks good to me! However, when I tested, it still doesn't completely match the old behavior: in 3.6 holding down ctrl has the described behavior even when snapping is otherwise disabled, whereas with this patch it does nothing. Everything else appears to be working perfectly, though.
@ -133,3 +133,4 @@
/* Those space-types define their own invert behavior instead of toggling it on/off. */
return;
}
if (t->spacetype == SPACE_GRAPH) {
Member

Style: I would make this an else if. Or perhaps even better, make the whole thing a switch.

Never mind. Apparently else after a return is considered bad style in Blender, even in cases like this.

~~Style: I would make this an `else if`. Or perhaps even better, make the whole thing a switch.~~ Never mind. Apparently `else` after a return is considered bad style in Blender, even in cases like this.
nathanvegdahl marked this conversation as resolved

Although it deviates a little from the bug fix, we could add the Increment option to the popover.
image

This way Snap Invert would work as it already works in 3D View, UV Editor and Nodes:
I attach the path in case the idea seems ok.

Although it deviates a little from the bug fix, we could add the Increment option to the popover. ![image](/attachments/6892ae37-5deb-4e21-bafc-2adab9218ca3) This way `Snap Invert` would work as it already works in 3D View, UV Editor and Nodes: I attach the path in case the idea seems ok.
Member

@mano-wii This patch is about fixing a regression in behavior, rather than improving the feature. We can look into improving behavior in 4.1.

@mano-wii This patch is about fixing a regression in behavior, rather than improving the feature. We can look into improving behavior in 4.1.
Christoph Lendenfeld force-pushed fix_graph_editor_snapping from 0c98ffc5c7 to 39ee234423 2023-11-09 13:30:36 +01:00 Compare
Christoph Lendenfeld changed title from Fix #114588: Graph Editor increment snap not working to Fix #114588: Graph Editor increment snap not working 2023-11-09 13:30:40 +01:00
ChrisLend changed target branch from main to blender-v4.0-release 2023-11-09 13:30:43 +01:00
Christoph Lendenfeld added 1 commit 2023-11-09 14:13:27 +01:00
Christoph Lendenfeld requested review from Nathan Vegdahl 2023-11-09 14:15:11 +01:00
Nathan Vegdahl approved these changes 2023-11-09 14:34:12 +01:00
Nathan Vegdahl left a comment
Member

I've tested this out, and everything works as expected. The code also looks about as good to me as I think can be done given the broader snapping code it's working within.

I've tested this out, and everything works as expected. The code also looks about as good to me as I think can be done given the broader snapping code it's working within.
Christoph Lendenfeld merged commit b670e7a82c into blender-v4.0-release 2023-11-09 14:38:37 +01:00
Christoph Lendenfeld deleted branch fix_graph_editor_snapping 2023-11-09 14:38:42 +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#114607
No description provided.