Feature #120318: Add sculpt mask access in node tool #120378

Open
Prikshit singh wants to merge 3 commits from Prikshit-singh/blender:Feature/Sculpt_mask_node_tool into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Contributor

Before:

blender_hBUcaVFYHJ

After:

blender_ZYq1ee5ZAz

tooltip:

blender_0v87GRHDvI

After implementing now it works something like this:

# Before: ![blender_hBUcaVFYHJ](/attachments/80942f9c-63c5-4ed2-bc43-b1dc2dc1cbb7) # After: ![blender_ZYq1ee5ZAz](/attachments/d528574f-8f09-414d-a220-a9cc3a6cb085) # tooltip: ![blender_0v87GRHDvI](/attachments/21f34954-af37-4959-a51d-3fb9aeb11bc1) After implementing now it works something like this:
Prikshit singh added 1 commit 2024-04-07 18:35:49 +02:00
Prikshit singh requested review from Hans Goudey 2024-04-07 18:36:29 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2024-04-07 18:39:23 +02:00
Iliya Katushenock added the
Module
Sculpt, Paint & Texture
Interest
Geometry Nodes
labels 2024-04-07 18:39:33 +02:00
Prikshit singh requested review from Jacques Lucke 2024-04-08 05:15:30 +02:00
Member

Thanks. Note that this is not a fix, but a new feature. The PR title should be changed.

Thanks. Note that this is not a fix, but a new feature. The PR title should be changed.
Prikshit singh changed title from Fix #120318: Add sculpt mask access in node tool to Feature #120318: Add sculpt mask access in node tool 2024-04-08 13:53:55 +02:00
Author
Contributor

Thanks. Note that this is not a fix, but a new feature. The PR title should be changed.

Done

> Thanks. Note that this is not a fix, but a new feature. The PR title should be changed. Done
Hans Goudey requested changes 2024-04-10 02:43:31 +02:00
Hans Goudey left a comment
Member

Thanks for working on this. It's not really what the design task describes though. There should be a new "Boolean/Float" enum property that changes the input socket type and the type of the stored attribute. The inversion should be done by the node itself for mesh sculpt mode mask storage, without input from the user.

Thanks for working on this. It's not really what the design task describes though. There should be a new "Boolean/Float" enum property that changes the input socket type and the type of the stored attribute. The inversion should be done by the node itself for mesh sculpt mode mask storage, without input from the user.
Author
Contributor

Thanks for working on this. It's not really what the design task describes though. There should be a new "Boolean/Float" enum property that changes the input socket type and the type of the stored attribute. The inversion should be done by the node itself for mesh sculpt mode mask storage, without input from the user.

Thanks, Now I understood, will work on that.

> Thanks for working on this. It's not really what the design task describes though. There should be a new "Boolean/Float" enum property that changes the input socket type and the type of the stored attribute. The inversion should be done by the node itself for mesh sculpt mode mask storage, without input from the user. Thanks, Now I understood, will work on that.
Author
Contributor

@HooglyBoogly I made some changes and the node looks and works something like this , your thoughts :

@HooglyBoogly I made some changes and the node looks and works something like this , your thoughts :
Member

Looks better, nice! The behavior in sculpt mode when the node is set to "Boolean" seems wrong though, I'm not sure what happened there.

Looks better, nice! The behavior in sculpt mode when the node is set to "Boolean" seems wrong though, I'm not sure what happened there.
Author
Contributor

Thanks could you give me a clue how it should look like , also while defining the enums in DNA what should be the names of the boolean and float enum

Thanks could you give me a clue how it should look like , also while defining the enums in DNA what should be the names of the boolean and float enum
Member

That would be easier if you update the code and description of this PR.

I think the enum value can be defined in the node file actually, like enum class PatternMode {. That should make the naming clearer too.

That would be easier if you update the code and description of this PR. I think the enum value can be defined in the node file actually, like `enum class PatternMode {`. That should make the naming clearer too.
Author
Contributor

ok

ok
Prikshit singh added 1 commit 2024-04-11 22:52:43 +02:00
Prikshit singh requested review from Hans Goudey 2024-04-11 22:56:11 +02:00
Hans Goudey requested changes 2024-04-11 23:03:24 +02:00
Hans Goudey left a comment
Member

Getting there!

Getting there!
@ -51,0 +66,4 @@
case GeometryComponent::Type::PointCloud:
return *attributes.lookup_or_default<float>(".selection", domain, true);
case GeometryComponent::Type::Mesh:
return *attributes.lookup_or_default<float>(".sculpt_mask", domain, true);
Member

This needs to be inverted (1.0 - value) since we store the inverse of selection. That can be done by inserting a field operation after the field input in node_geo_exec. Also the default values should be floats. And the default value should be 0 for .sculpt_mask.

This needs to be inverted (`1.0 - value`) since we store the inverse of selection. That can be done by inserting a field operation after the field input in `node_geo_exec`. Also the default values should be floats. And the default value should be 0 for `.sculpt_mask`.
Author
Contributor

I made all the necessary changes but still not able to understand this part ?

I made all the necessary changes but still not able to understand this part ?
Member

Could you clarify what you don't understand?

Could you clarify what you don't understand?
Author
Contributor

I don't understand where do i get the value from and what is the use of field operation here , to be specific why do we use field operation i didnt understand the use of it.

I don't understand where do i get the `value` from and what is the use of field operation here , to be specific why do we use field operation i didnt understand the use of it.
Member

Adding a FieldOperation here is like inserting an invisible node into the node graph before the set selection node. The value would be the input socket to that node. For an example, you could look at max_zero_fn and count_field in node_geo_duplicate_elements.cc

Adding a `FieldOperation` here is like inserting an invisible node into the node graph before the set selection node. The value would be the input socket to that node. For an example, you could look at `max_zero_fn` and `count_field` in `node_geo_duplicate_elements.cc`
Author
Contributor

ok

ok
Prikshit-singh marked this conversation as resolved
@ -55,9 +80,16 @@ static void node_geo_exec(GeoNodeExecParams params)
}
if (params.user_data()->call_data->operator_data->mode == OB_MODE_OBJECT) {
params.set_output("Selection", true);
params.set_output("Float", false);
Member

false -> 1.0f

`false` -> `1.0f`
Author
Contributor

Done

Done
Prikshit-singh marked this conversation as resolved
@ -83,0 +66,4 @@
if (Mesh *mesh = geometry.get_mesh_for_write()) {
if (params.user_data()->call_data->operator_data->mode == OB_MODE_SCULPT) {
Field<bool> inverted = invert_boolean_field(selection);
bke::try_capture_field_on_geometry(
Member

Writing to a float attribute with the boolean field isn't correct. ".sculpt_mask" should be written as a float attribute

Writing to a float attribute with the boolean field isn't correct. `".sculpt_mask"` should be written as a float attribute
Author
Contributor

how can i convert boolean field into float attribute

how can i convert boolean field into float attribute
Member

Check out uses of BKE_type_conversions.hh in geometry nodes.

Check out uses of `BKE_type_conversions.hh` in geometry nodes.
Prikshit-singh marked this conversation as resolved
Prikshit singh added 1 commit 2024-04-12 22:21:24 +02:00
Prikshit singh requested review from Hans Goudey 2024-04-12 22:21:48 +02:00
Author
Contributor

@HooglyBoogly any changes required to the latest PR

@HooglyBoogly any changes required to the latest PR
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u Feature/Sculpt_mask_node_tool:Prikshit-singh-Feature/Sculpt_mask_node_tool
git checkout Prikshit-singh-Feature/Sculpt_mask_node_tool
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#120378
No description provided.