Anim: Graph Editor Scale From Neighbor #112387

Merged
Christoph Lendenfeld merged 14 commits from ChrisLend/blender:ge_scale_from_neighbor into main 2023-12-21 10:46:52 +01:00

Combination of two operators by Ares Deveaux
#106524: Animation: scale left slider
and
#106523: Animation: scale right slider

Introduces a new operator "Scale from Neighbor" that scales selected keyframe segments from either the left or right keyframe neighbor.

Pressing "D" during modal operation will switch from which end of the segment the scaling happens.
image

This is useful to make a section of animation closer to a pose on either side.

Combination of two operators by Ares Deveaux [#106524: Animation: scale left slider](https://projects.blender.org/blender/blender/pulls/106524) and [#106523: Animation: scale right slider](https://projects.blender.org/blender/blender/pulls/106523) Introduces a new operator "Scale from Neighbor" that scales selected keyframe segments from either the left or right keyframe neighbor. Pressing "D" during modal operation will switch from which end of the segment the scaling happens. ![image](/attachments/2be353d8-2922-4c5c-b477-a40905dfc08a) This is useful to make a section of animation closer to a pose on either side. <video src=/attachments/503888e7-9706-49d1-a17a-7daa224fed86 controls></video>
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2023-09-14 17:32:09 +02:00
Christoph Lendenfeld added 10 commits 2023-09-14 17:32:23 +02:00
Christoph Lendenfeld added this to the Animation & Rigging project 2023-09-14 17:32:49 +02:00
Christoph Lendenfeld added 1 commit 2023-12-15 12:08:26 +01:00
Christoph Lendenfeld changed title from WIP: Animation: Graph Editor Scale From Neighbor to Animation: Graph Editor Scale From Neighbor 2023-12-15 12:16:19 +01:00
Christoph Lendenfeld added 1 commit 2023-12-15 12:27:34 +01:00
Christoph Lendenfeld changed title from Animation: Graph Editor Scale From Neighbor to Anim: Graph Editor Scale From Neighbor 2023-12-15 12:40:32 +01:00
Sybren A. Stüvel requested changes 2023-12-19 12:29:44 +01:00
Sybren A. Stüvel left a comment
Member

Would it be possible to change the status bar text from [D] Toggle Anchor Key to be more context-aware? Then it could be [D] Anchor to Left Key (or Right Key), making it more specific to what's going to happen.

Would it be possible to change the status bar text from `[D] Toggle Anchor Key` to be more context-aware? Then it could be `[D] Anchor to Left Key` (or `Right Key`), making it more specific to what's going to happen.
@ -954,0 +957,4 @@
const FCurveSegmentAnchor anchor)
{
const BezTriple *reference_key;
if (anchor == FCurveSegmentAnchor::LEFT) {

I'd make this a switch because it's going over the items of an enum. Without a default, it makes it clear that these are indeed the only two values in the enum.

I'd make this a `switch` because it's going over the items of an enum. Without a `default`, it makes it clear that these are indeed the only two values in the enum.
Author
Member

made this and other occurrences a switch

made this and other occurrences a `switch`
dr.sybren marked this conversation as resolved
@ -2283,0 +2366,4 @@
switch (event->type) {
case EVT_DKEY: {
FCurveSegmentAnchor anchor = FCurveSegmentAnchor(RNA_enum_get(op->ptr, "anchor"));
if (anchor == FCurveSegmentAnchor::LEFT) {

This might actually be implementable as an FCurveSegmentAnchor FCurveSegmentAnchor::opposite() const function?

This might actually be implementable as an `FCurveSegmentAnchor FCurveSegmentAnchor::opposite() const` function?
Author
Member

I had a quick google search and apparently you cannot add methods to an enum class.
Did I miss something?

I had a quick google search and apparently you cannot add methods to an enum class. Did I miss something?

C++ is stupid. I think I've done too much Python & Go and got used to a more sane type system ;-)

https://stackoverflow.com/a/53284026/875379 could work, but I think it's overkill for the one use case.

C++ is stupid. I think I've done too much Python & Go and got used to a more sane type system ;-) https://stackoverflow.com/a/53284026/875379 could work, but I think it's overkill for the one use case.
dr.sybren marked this conversation as resolved
@ -2283,0 +2379,4 @@
default:
return graph_slider_modal(C, op, event);
break;

No break after return.

No `break` after `return`.
dr.sybren marked this conversation as resolved
@ -2283,0 +2389,4 @@
const int invoke_result = graph_slider_invoke(C, op, event);
if (invoke_result == OPERATOR_CANCELLED) {
return invoke_result;

When you know the value that's being returned, because of the surrounding logic, I usually prefer simply returning that value. That way it's instantly clear from the return statement itself what it returns, without having to actually mentally parse the preceeding code. So in this case just return OPERATOR_CANCELLED;

When you know the value that's being returned, because of the surrounding logic, I usually prefer simply returning that value. That way it's instantly clear from the `return` statement itself what it returns, without having to actually mentally parse the preceeding code. So in this case just `return OPERATOR_CANCELLED;`
dr.sybren marked this conversation as resolved
Christoph Lendenfeld added 2 commits 2023-12-19 13:08:06 +01:00
Christoph Lendenfeld requested review from Sybren A. Stüvel 2023-12-19 13:09:34 +01:00
Sybren A. Stüvel approved these changes 2023-12-19 18:01:51 +01:00
Sybren A. Stüvel left a comment
Member

👍

:+1:
Christoph Lendenfeld merged commit b27718a9e7 into main 2023-12-21 10:46:52 +01:00
Christoph Lendenfeld deleted branch ge_scale_from_neighbor 2023-12-21 10:46:53 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
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 Assignees
2 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#112387
No description provided.