Refactor: Allow to explicitly set the range on the slider UI element #107406
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#107406
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChrisLend/blender:slider_overshoot_refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The current implementation goes like this
is_bidirectional
to get a -1/1 rangeThe issue is that it is not possible to have a 0-1 range but overshoot both ways.
This is useful for example on the "Blend to Default" operator, where 0 means current position and 1 default.
But overshoot also makes sense for this operator since the other way just scales away from default.
So this patch:
is_bidirectional
float range[2]
totSlider
and a setter for itallow_overshoot
flag into one flag for either side@dr.sybren I had a memory leak with this patch that I cannot reproduce again. The only possible culprit could be the range array, but if I understand correctly, as long as I don't calloc anything I don't need to free either. Is that right?
Hmm that's annoying. Have you tried with
blender --debug-memory
? Or the ASAN leak detector?That's correct, a fixed-size array is just allocated in-place.
I'm not sure how I feel about the
range[2]
though. Setting now requires two lines:How would you feel splitting this up into
factor_bound_lower
andfactor_bound_upper
? That way we could justhave
ED_slider_range_set(pbd->slider, -1, 1);
I was thinking of
..._min
/..._max
first, but IMO that would be inappropriate given that there's the possibility to overshoot.As for the overshoot, I have the feeling that the code is now quite tightly coupled to the UI. That's not necessarily a bad thing, given that it's a UI element. What would you think of replacing
allow_overshoot_{left,right}
withallow_overshoot_{lower,upper}
? That way it's in the 'space' of the value that's being manipulated, and the terminology would be the same as the field names for the upper/lower bounds.Just marking 'request changes' to put the PR into the right queue.
👍
@ -99,0 +97,4 @@
/* One bool value for each side of the slider. Allows to allow overshoot only on one side. */
void ED_slider_allow_overshoot_set(struct tSlider *slider, bool left, bool right);
void ED_slider_factor_bounds_set(struct tSlider *slider, float lower_bound, float upper_bound);
I think a comment here would be in order, something like:
Just to make it clear what the relation between 'bounds' and 'overshoot' is.