Animation: blend offset slider #106518
Closed
AresDeveaux
wants to merge 12 commits from
When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
AresDeveaux/blender:blend_offset_slider
into main
pull from: AresDeveaux/blender:blend_offset_slider
merge into: blender:main
blender:main
blender:universal-scene-description
blender:temp-sculpt-dyntopo
blender:blender-v3.3-release
blender:blender-v3.6-release
blender:asset-browser-frontend-split
blender:brush-assets-project
blender:asset-shelf
blender:anim/armature-drawing-refactor-3
blender:temp-sculpt-dyntopo-hive-alloc
blender:tmp-usd-python-mtl
blender:tmp-usd-3.6
blender:blender-v3.5-release
blender:blender-projects-basics
blender:blender-v2.93-release
blender:temp-sculpt-attr-api
blender:realtime-clock
blender:sculpt-dev
blender:gpencil-next
blender:bevelv2
blender:microfacet_hair
blender:xr-dev
blender:principled-v2
When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Reviewers
Request review
No reviewers
Labels
Clear labels
This issue affects/is about backward or forward compatibility
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
Apply labels
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
This issue affects/is about backward or forward compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
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 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 & 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
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
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
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Set Project
Clear projects
No project
Assignees
Assign users
Clear assignees
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#106518
Reference in New Issue
There is no content yet.
Delete Branch "AresDeveaux/blender:blend_offset_slider"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
New operator for the slider tool in the Graph Editor.
It shifts selected keys to the value of the neighboring keys as a block. It is used to keep the animation of the selected segment but match the values to the chosen neighboring pose.
It uses the structure already created by @ChrisLend. The main functionality chancge is in 'keyframes_general.c', the rest for the most part just follows what hi did.
WIP: Animation&Rigging: blend_offset_sliderto Animation: blend offset sliderminor comments :)
@ -494,0 +496,4 @@
const BezTriple *left_key = fcurve_segment_start_get(fcu, segment->start_index);
const BezTriple *right_key = fcurve_segment_end_get(fcu, segment->start_index + segment->length);
const BezTriple *segment_first_key = fcurve_segment_start_get(fcu, segment->start_index + 1);
this can be simplified to
fcu->bezt[segment->start_index]
same for getting the segment end
@ -494,0 +504,4 @@
const bool slider_right_side = factor > 0.5;
/* For this tool the calculations are made easier if each side of the slider goes from 0 to
* porisive 1. */
watch out for typos poritive -> positive
@ -494,0 +509,4 @@
float y_delta;
if (slider_right_side) {
if you use
ED_slider_is_bidirectional_set
you can just sayfactor > 0
and remove the booleanThat way this function doesn't even need to have an implicit notion of where the value came from
I just tried this. One problem with a bidirectional slider is that the factor is always going to be more than zero, so the
else
part of the if statement is never executed. I still need to know what side of the slider the value is coming from. If the factor is from 0 to 1 I can, and by usingping_pong_factor = fabs(factor * 2 - 1)
I have been simulating what now I should call "bidirectional_factor" instead of "ping_pong_factor"If there is a way to know what side of the slider the value is coming from I could use
ED_slider_is_bidirectional_set
hm sorry I think that was my bad. I thought this would set the slider to a -1/1 range but it does not. It just allows negative values.
In that case your implementation is correct until we add that feature to the slider :)
I simplified the code as per your suggestions.
So, I was wrong (no surprise there). Bidirectional slider work as expected. I did something wrong before for it not to work. I'm guessing I left
fabs(factor)
before theif
statement. Anyway, it doesn't matter because I just added it and it works like a charm.thanks for the work!
this also gets my green tick and I'll let sybren have a final look
@ -482,0 +485,4 @@
const BezTriple *right_key = fcurve_segment_end_get(fcu, segment->start_index + segment->length);
const BezTriple segment_first_key = fcu->bezt[segment->start_index];
const BezTriple segment_last_key = fcu->bezt[segment->start_index + segment->length - 1];
left_key
andsegment_first_key
are only used whenfactor <= 0
, andright_key
andsegment_last_key
otherwise. Move these into the correspondingif
/else
bodies, so that their scope is clear.@ -482,0 +496,4 @@
}
for (int i = segment->start_index; i < segment->start_index + segment->length; i++) {
const float key_y_value = fcu->bezt[i].vec[1][1] + y_delta * fabs(factor);
Since ``y_delta * fabs(factor)` doesnt' change over the course of this loop, take it out of the loop:
@ -439,6 +439,7 @@ void smooth_fcurve_segment(struct FCurve *fcu,
int kernel_size,
double *kernel);
void ease_fcurve_segment(struct FCurve *fcu, struct FCurveSegment *segment, float factor);
void blend_offset_fcurve_segment(struct FCurve *fcu, struct FCurveSegment *segment, float factor);
The more functions we add here, the more important it becomes that they are documented. Could you write a doxygen-style comment for it, that explains what it does? Something like this:
@ -970,0 +971,4 @@
/** \name Blend Offset Operator
* \{ */
static void blend_offset_graph_keys(bAnimContext *ac, const float factor)
I suspect that more operators will have a structure that could be described as "call a function with a factor for each selected segment".
Instead of duplicating this code and changing which function it calls, I think it would be better to abstract that away a bit. Something like this:
this exists from a recent refactor:
apply_fcu_segment_function
@ -970,0 +992,4 @@
ANIM_animdata_freelist(&anim_data);
}
static void blend_offset_draw_status_header(bContext *C, tGraphSliderOp *gso)
I think this can be rewritten to call
common_draw_status_header()
.this feature has been added in this PR #110544: Animation: Blend Offset Slider
Reviewers
Pull request closed