Curves: Reimplement random selection with mask #109366

Merged
Falk David merged 6 commits from filedescriptor/blender:curves-mask-random into main 2023-07-05 13:48:28 +02:00
Member

Instead of manipulating the selection attribute directly, we get an IndexMask of the random elements, and then apply the changes to the selection attribute in the operator.

Instead of manipulating the selection attribute directly, we get an `IndexMask` of the random elements, and then apply the changes to the selection attribute in the operator.
Falk David added 1 commit 2023-06-26 12:10:35 +02:00
Falk David added this to the Nodes & Physics project 2023-06-26 12:10:41 +02:00
Falk David requested review from Hans Goudey 2023-06-26 12:10:53 +02:00
Iliya Katushenock reviewed 2023-06-26 12:19:31 +02:00
@ -35,0 +53,4 @@
break;
default:
BLI_assert_unreachable();
}

const int64_t domain_size = curves.attributes().domain_size(selection_domain);

`const int64_t domain_size = curves.attributes().domain_size(selection_domain);`

Switch statement below also doesn't make sense.

Switch statement below also doesn't make sense.
filedescriptor marked this conversation as resolved
Falk David added 1 commit 2023-06-26 12:23:19 +02:00
Falk David added 1 commit 2023-06-26 12:26:39 +02:00
Hans Goudey approved these changes 2023-06-26 14:43:04 +02:00
@ -35,0 +43,4 @@
RandomNumberGenerator rng{random_seed};
const auto next_bool_random_value = [&]() { return rng.get_float() <= probability; };
int64_t domain_size = curves.attributes().domain_size(selection_domain);
Member

const int64_t

`const int64_t`
filedescriptor marked this conversation as resolved
@ -891,3 +891,3 @@
for (Curves *curves_id : unique_curves) {
CurvesGeometry &curves = curves_id->geometry.wrap();
select_random(curves, eAttrDomain(curves_id->selection_domain), uint32_t(seed), probability);
eAttrDomain selection_domain = eAttrDomain(curves_id->selection_domain);
Member

const eAttrDomain

`const eAttrDomain`
filedescriptor marked this conversation as resolved
@ -894,0 +893,4 @@
eAttrDomain selection_domain = eAttrDomain(curves_id->selection_domain);
IndexMaskMemory memory;
IndexMask random_elements = random_mask(curves, selection_domain, seed, probability, memory);
Member

const IndexMask

`const IndexMask`
filedescriptor marked this conversation as resolved
@ -894,0 +905,4 @@
if (selection.span.type().is<bool>()) {
index_mask::masked_fill(selection.span.typed<bool>(), false, random_elements);
}
if (selection.span.type().is<float>()) {
Member

else if

Also, it would be nice to move these two if statements to a function like fill_selection_true

`else if` Also, it would be nice to move these two if statements to a function like `fill_selection_true`
filedescriptor marked this conversation as resolved
Falk David added 2 commits 2023-06-26 15:05:44 +02:00
Hans Goudey changed title from Curves: Replace `select_random` with `random_mask` to Curves: Reimplement random selection with mask 2023-06-26 16:07:04 +02:00
Falk David added 1 commit 2023-07-05 12:56:26 +02:00
Falk David merged commit 4d3574a4a5 into main 2023-07-05 13:48:28 +02:00
Falk David deleted branch curves-mask-random 2023-07-05 13:48:30 +02: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 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#109366
No description provided.