Fix #119596: Multiple points operations of Curvemap and Curveprofile #120242
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#120242
Loading…
Reference in New Issue
No description provided.
Delete Branch "Zyq-XDz/blender:curve-mapping-multiselect"
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?
As the issue mentioned in #119596, there are a few undefined behaviors when operating more than one point. This PR will try to fix this issue by defining the operations such as
shift
andremove
for more than one selected point.the general goal has been accomplished.
However, the center of the selected points is now stored in
CurveMap
and will be updated ininterface_template.cc
, I am not sure it is a good idea.WIP: Fix #119596: Multiple points operations of curvemappingto Fix #119596: Multiple points operations of curvemapping@ -4560,3 +4560,2 @@
/* Sliders for selected curve point. */
int i;
CurveMapPoint *cmp = nullptr;
Vector<CurveMapPoint *> cmps{};
Vector<CurveMapPoint *> cmps;
@ -4609,2 +4608,2 @@
{
bt->flag |= UI_SELECT_DRAW;
for (CurveMapPoint *cmp : cmps) {
for (const CurveMapPoint *cmp : cmps) {
@ -4676,1 +4687,4 @@
active_cm->center_y = 0.0f;
for (CurveMapPoint *cmp : cmps)
active_cm->center_y += cmp->y;
See: https://developer.blender.org/docs/handbook/guidelines/c_cpp/#braces
And the same above.
It should be possible to implement this as a more straightforward operation that applies an offset on the selection. Notes inline.
@ -930,6 +930,34 @@ void BKE_curvemapping_premultiply(CurveMapping *cumap, bool restore)
}
/* ************************ more CurveMapping calls *************** */
void BKE_curvemap_shift(CurveMapping *cumap)
Prefer
BKE_curvemap_translate
a float2 offset argument.@ -48,6 +48,8 @@ typedef struct CurveMap {
float ext_in[2], ext_out[2];
/** Actual curve. */
CurveMapPoint *curve;
/** Center of selected points */
I'd rather avoid adding run-time UI data into
CurveMap
, this seems like a value that could be stored in run-time data such asuiHandleButtonData
.I noticed there are a few members named
vec[3]
andorigvec[3]
, may I modify them for this purpose?These are for vector buttons but I suppose they could be used, check on using
value, origvalue, startvalue
in-place, that may be all you need.294ccde79f/source/blender/makesdna/DNA_color_types.h (L30-L34)
Since each CurveMap requires runtime storage, I imitated how
NodeCryptomatte_Runtime
andCamera_Runtime
are set up. I've also tried to implement it with pointers, not that much difference. If this solution is fine, I'll finish the rest of the code. :)Fix #119596: Multiple points operations of curvemappingto WIP: Fix #119596: Multiple points operations of curvemappingWIP: Fix #119596: Multiple points operations of curvemappingto WIP: Fix #119596: Multiple points operations of Curvemap and CurveprofileWIP: Fix #119596: Multiple points operations of Curvemap and Curveprofileto Fix #119596: Multiple points operations of Curvemap and CurveprofileAdding a curve-runtime to every curve map and curve profile seems unnecessary for UI logic where only one value is edited at a time.
It seems this can be replaced with a single
static float[2]
which also isn't so nice but at least avoids adding run-time UI data into DNA.Attached a path that does this.
I would need to dig into this in more detail to check on having a more elegant solution, as I mentioned in chat, it might be cleanest to use the same method the 3D viewport uses to transform multiple vertices at once.
CC'ing @JulianEisel for a second opinion.
Checkout
From your project repository, check out a new branch and test the changes.