Curves: Add select pick operator #104406

Merged
Hans Goudey merged 1 commits from filedescriptor/blender:curves-mouse-selection into main 2023-02-07 17:50:41 +01:00
Member

This adds the select_pick function for to Curves objects. It is used in the common view3d_select operator.

This adds the `select_pick` function for to `Curves` objects. It is used in the common `view3d_select` operator.
Hans Goudey reviewed 2023-02-07 17:01:56 +01:00
@ -286,0 +322,4 @@
float2 pos_proj;
ED_view3d_project_float_v2_m4(region, pos, pos_proj, projection.values);
const float distance_sq_proj = math::distance_squared(pos_proj, mouse_pos);
Member

distance_proj_sq feels a bit more consistent/natural IMO

`distance_proj_sq` feels a bit more consistent/natural IMO
filedescriptor marked this conversation as resolved
Hans Goudey requested review from Hans Goudey 2023-02-07 17:11:03 +01:00
Hans Goudey reviewed 2023-02-07 17:23:58 +01:00
Hans Goudey left a comment
Member

Some fun build errors here:

/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc: In function ‘bool blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)’:
/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:306:58: error: ‘using float4x4 = struct blender::MatBase<float, 4, 4>’ {aka ‘struct blender::MatBase<float, 4, 4>’} has no member named ‘values’
  306 |   ED_view3d_ob_project_mat_get(rv3d, &object, projection.values);
      |                                                          ^~~~~~
/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc: In lambda function:
/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:323:75: error: ‘using float4x4 = struct blender::MatBase<float, 4, 4>’ {aka ‘struct blender::MatBase<float, 4, 4>’} has no member named ‘values’
  323 |           ED_view3d_project_float_v2_m4(region, pos, pos_proj, projection.values);
      |                                                                           ^~~~~~
In file included from /home/hans/blender-git/blender/source/blender/blenlib/BLI_task.hh:21,
                 from /home/hans/blender-git/blender/source/blender/blenlib/BLI_array_utils.hh:8,
                 from /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:7:
/home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h: In instantiation of ‘void tbb::internal::lambda_reduce_body<Range, Value, RealBody, Reduction>::join(tbb::internal::lambda_reduce_body<Range, Value, RealBody, Reduction>&) [with Range = tbb::blocked_range<long int>; Value = blender::ed::curves::FindClosestPointData; RealBody = blender::threading::parallel_reduce<blender::ed::curves::FindClosestPointData, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)> >(blender::IndexRange, int64_t, const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)>&)::<lambda(const tbb::blocked_range<long int>&, const blender::ed::curves::FindClosestPointData&)>; Reduction = blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)>]’:
/home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h:68:30:   required from ‘tbb::task* tbb::interface9::internal::finish_reduce<Body>::execute() [with Body = tbb::internal::lambda_reduce_body<tbb::blocked_range<long int>, blender::ed::curves::FindClosestPointData, blender::threading::parallel_reduce<blender::ed::curves::FindClosestPointData, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)> >(blender::IndexRange, int64_t, const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)>&)::<lambda(const tbb::blocked_range<long int>&, const blender::ed::curves::FindClosestPointData&)>, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)> >]’
/home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h:64:15:   required from here
/home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h:328:22: error: no match for ‘operator=’ (operand types are ‘blender::ed::curves::FindClosestPointData’ and ‘float’)
  328 |             my_value = my_reduction(const_cast<const Value&>(my_value), const_cast<const Value&>(rhs.my_value));
      |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note: candidate: ‘constexpr blender::ed::curves::FindClosestPointData& blender::ed::curves::FindClosestPointData::operator=(const blender::ed::curves::FindClosestPointData&)’
  291 | struct FindClosestPointData {
      |        ^~~~~~~~~~~~~~~~~~~~
/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note:   no known conversion for argument 1 from ‘float’ to ‘const blender::ed::curves::FindClosestPointData&’
/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note: candidate: ‘constexpr blender::ed::curves::FindClosestPointData& blender::ed::curves::FindClosestPointData::operator=(blender::ed::curves::FindClosestPointData&&)’
/home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note:   no known conversion for argument 1 from ‘float’ to ‘blender::ed::curves::FindClosestPointData&&’
Some fun build errors here: ```lines=10 /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc: In function ‘bool blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)’: /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:306:58: error: ‘using float4x4 = struct blender::MatBase<float, 4, 4>’ {aka ‘struct blender::MatBase<float, 4, 4>’} has no member named ‘values’ 306 | ED_view3d_ob_project_mat_get(rv3d, &object, projection.values); | ^~~~~~ /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc: In lambda function: /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:323:75: error: ‘using float4x4 = struct blender::MatBase<float, 4, 4>’ {aka ‘struct blender::MatBase<float, 4, 4>’} has no member named ‘values’ 323 | ED_view3d_project_float_v2_m4(region, pos, pos_proj, projection.values); | ^~~~~~ In file included from /home/hans/blender-git/blender/source/blender/blenlib/BLI_task.hh:21, from /home/hans/blender-git/blender/source/blender/blenlib/BLI_array_utils.hh:8, from /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:7: /home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h: In instantiation of ‘void tbb::internal::lambda_reduce_body<Range, Value, RealBody, Reduction>::join(tbb::internal::lambda_reduce_body<Range, Value, RealBody, Reduction>&) [with Range = tbb::blocked_range<long int>; Value = blender::ed::curves::FindClosestPointData; RealBody = blender::threading::parallel_reduce<blender::ed::curves::FindClosestPointData, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)> >(blender::IndexRange, int64_t, const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)>&)::<lambda(const tbb::blocked_range<long int>&, const blender::ed::curves::FindClosestPointData&)>; Reduction = blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)>]’: /home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h:68:30: required from ‘tbb::task* tbb::interface9::internal::finish_reduce<Body>::execute() [with Body = tbb::internal::lambda_reduce_body<tbb::blocked_range<long int>, blender::ed::curves::FindClosestPointData, blender::threading::parallel_reduce<blender::ed::curves::FindClosestPointData, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)> >(blender::IndexRange, int64_t, const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(blender::IndexRange, const blender::ed::curves::FindClosestPointData&)>&, const blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)>&)::<lambda(const tbb::blocked_range<long int>&, const blender::ed::curves::FindClosestPointData&)>, blender::ed::curves::find_closest_point_to_screen_co(const Depsgraph&, const ARegion*, const RegionView3D*, const Object&, const blender::bke::CurvesGeometry&, blender::float2, float, FindClosestPointData&)::<lambda(const blender::ed::curves::FindClosestPointData&, const blender::ed::curves::FindClosestPointData&)> >]’ /home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h:64:15: required from here /home/hans/blender-git/lib/linux_x86_64_glibc_228/tbb/include/tbb/parallel_reduce.h:328:22: error: no match for ‘operator=’ (operand types are ‘blender::ed::curves::FindClosestPointData’ and ‘float’) 328 | my_value = my_reduction(const_cast<const Value&>(my_value), const_cast<const Value&>(rhs.my_value)); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note: candidate: ‘constexpr blender::ed::curves::FindClosestPointData& blender::ed::curves::FindClosestPointData::operator=(const blender::ed::curves::FindClosestPointData&)’ 291 | struct FindClosestPointData { | ^~~~~~~~~~~~~~~~~~~~ /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note: no known conversion for argument 1 from ‘float’ to ‘const blender::ed::curves::FindClosestPointData&’ /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note: candidate: ‘constexpr blender::ed::curves::FindClosestPointData& blender::ed::curves::FindClosestPointData::operator=(blender::ed::curves::FindClosestPointData&&)’ /home/hans/blender-git/blender/source/blender/editors/curves/intern/curves_selection.cc:291:8: note: no known conversion for argument 1 from ‘float’ to ‘blender::ed::curves::FindClosestPointData&&’ ```
Hans Goudey requested changes 2023-02-07 17:24:57 +01:00
Hans Goudey left a comment
Member

Test

Test
Author
Member

@HooglyBoogly That should be fixed with 4f81bbb80b :)

@HooglyBoogly That should be fixed with https://projects.blender.org/blender/blender/commit/4f81bbb80bd13eedff9434e62d1e0418806a84c6 :)
Hans Goudey changed title from Curves: Add select pick operator to WIP: Curves: Add select pick operator 2023-02-07 17:25:12 +01:00
Hans Goudey changed title from WIP: Curves: Add select pick operator to Curves: Add select pick operator 2023-02-07 17:25:19 +01:00
Falk David requested review from Hans Goudey 2023-02-07 17:25:57 +01:00
Hans Goudey approved these changes 2023-02-07 17:30:05 +01:00
Member

I guess the PR description should have the 72 char line length if the auto-squash committing is used

I guess the PR description should have the 72 char line length if the auto-squash committing is used
Author
Member

I'll try to rewrite the history to make the commits clean. And I guess then we could try the "Rebase then fast-forward" function.

I'll try to rewrite the history to make the commits clean. And I guess then we could try the "Rebase then fast-forward" function.
Falk David force-pushed curves-mouse-selection from 17e7e227bc to 767e2915be 2023-02-07 17:45:18 +01:00 Compare
Hans Goudey merged commit f01bf82480 into main 2023-02-07 17:50:41 +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
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#104406
No description provided.