Sculpt: Add global automasking propagation steps #117316

Merged
Hans Goudey merged 8 commits from Sean-Kim/blender:102377-auto-masking into main 2024-01-29 15:39:50 +01:00
Contributor

This pull request adds the ability for the propagation_steps value for certain automasking settings to be applied globally instead of using the per-brush attribute.

Previously, while the flag settings were stored at the brush and global level, the propagation_steps value would always change the brush attribute even when using the global menu.

Testing

  • make test results in 2 failures (49 - io_wavefront, 323 - imbuf_save), but these tests appear to fail even prior to any changes being applied when running locally
  • Manual testing with older version blend files to ensure that the value is defaulted correctly
  • Visual testing to ensure that values apply correctly depending on if the brush or the global settings are set

Limitations

No unit tests exist that touch this particular code path, the work for setting up stub data seems fairly involved so I'm currently opting to do that work in a follow-up task since the actual logical changes for this particular PR are relatively minor.

Addresses #102377

This pull request adds the ability for the `propagation_steps` value for certain automasking settings to be applied globally instead of using the per-brush attribute. Previously, while the flag settings were stored at the brush and global level, the `propagation_steps` value would always change the brush attribute even when using the global menu. ## Testing * `make test` results in 2 failures (49 - io_wavefront, 323 - imbuf_save), but these tests appear to fail even prior to any changes being applied when running locally * Manual testing with older version blend files to ensure that the value is defaulted correctly * Visual testing to ensure that values apply correctly depending on if the brush or the global settings are set ## Limitations No unit tests exist that touch this particular code path, the work for setting up stub data seems fairly involved so I'm currently opting to do that work in a follow-up task since the actual logical changes for this particular PR are relatively minor. Addresses \#102377
Sean Kim added 1 commit 2024-01-19 06:39:34 +01:00
619e6d440a Sculpt: Add global automasking propagation steps
Updates necessary functions to ensure that brush-level settings are
preferred over tool-level settings. Minor refactoring and comments
applied to automasking code.

Ref \#102377
Julien Kaspar added the
Module
Sculpt, Paint & Texture
label 2024-01-19 09:36:54 +01:00
Julien Kaspar requested review from Sergey Sharybin 2024-01-19 09:41:49 +01:00
Julien Kaspar requested review from Julien Kaspar 2024-01-19 09:41:49 +01:00
Julien Kaspar requested review from Hans Goudey 2024-01-19 09:41:50 +01:00
Julien Kaspar approved these changes 2024-01-19 09:53:13 +01:00
Julien Kaspar left a comment
Member

On the user side this works like expected.
Waiting for other reviewers to approve the technical side then.

On the user side this works like expected. Waiting for other reviewers to approve the technical side then.
Hans Goudey requested changes 2024-01-19 19:29:55 +01:00
Hans Goudey left a comment
Member

Thanks for the PR! My main comment is about removing unrelated changes from this patch. They should be proposed separately.

Thanks for the PR! My main comment is about removing unrelated changes from this patch. They should be proposed separately.
@ -2654,2 +2654,4 @@
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 13)) {
if (!DNA_struct_member_exists(
Member

The DNA_struct_member_exists check should be unnecessary given the file subversion bump.

The `DNA_struct_member_exists` check should be unnecessary given the file subversion bump.
Author
Contributor

Oh, makes sense - I got a bit confused with seeing some of the previous changes in this file that do both. I assumed that it was a prerequisite to have both layers of checks.

Oh, makes sense - I got a bit confused with seeing some of the previous changes in this file that do both. I assumed that it was a prerequisite to have both layers of checks.
Sean-Kim marked this conversation as resolved
@ -384,2 +384,4 @@
IDP_ClearProperty(idprop);
}
/* Ensure sculpt-mode global automasking_boundary_edges_propagation_steps is defaulted
Member

This is basically the point of this function, so this comment isn't adding much. I'd suggest removing it.

This is basically the point of this function, so this comment isn't adding much. I'd suggest removing it.
Sean-Kim marked this conversation as resolved
@ -199,3 +209,1 @@
if (automasking_flags & (BRUSH_AUTOMASKING_BOUNDARY_EDGES |
BRUSH_AUTOMASKING_BOUNDARY_FACE_SETS | BRUSH_AUTOMASKING_VIEW_NORMAL))
{
/* TODO: I'm unsure why the BRUSH_AUTOMASKING_VIEW_NORMAL cares at all about the propagation
Member

Agreed, but how about handling that in a separate PR?

Agreed, but how about handling that in a separate PR?
Sean-Kim marked this conversation as resolved
@ -802,10 +818,10 @@ bool tool_can_reuse_automask(int sculpt_tool)
SCULPT_TOOL_DRAW_FACE_SETS);
}
/* TODO: Update Sculpt * and Brush * to be const */
Member

Agreed, but let's not add these todo comments in this PR

Agreed, but let's not add these todo comments in this PR
Sean-Kim marked this conversation as resolved
@ -818,3 +834,3 @@
automasking->current_stroke_id = ss->stroke_id;
bool use_stroke_id = false;
/* Initialize and ensure variables on both SculptSession and the Cache. */
Member

These changes are unrelated to the goal of the PR. I generally agree, but better to propose them separately, like above.

These changes are unrelated to the goal of the PR. I generally agree, but better to propose them separately, like above.
Author
Contributor

Just to be clear - do you mean the general restructuring that happened in the cache_init function, or just the added comments?

Just to be clear - do you mean the general restructuring that happened in the `cache_init` function, or just the added comments?
Member

The general restructuring-- the changes should basically just be related to the functionality change in this PR

The general restructuring-- the changes should basically just be related to the functionality change in this PR
Sean-Kim marked this conversation as resolved
Sean Kim added 2 commits 2024-01-20 00:21:16 +01:00
Sean Kim added 1 commit 2024-01-20 00:30:11 +01:00
Sean Kim requested review from Hans Goudey 2024-01-20 00:31:09 +01:00
Hans Goudey requested changes 2024-01-20 00:39:03 +01:00
Hans Goudey left a comment
Member

Sorry that I'm being a bit picky about removing unrelated changes from this PR, but I think it's a good habit to get into, and it makes the life of anyone reading the diff later easier.

Sorry that I'm being a bit picky about removing unrelated changes from this PR, but I think it's a good habit to get into, and it makes the life of anyone reading the diff later easier.
@ -2667,2 +2667,4 @@
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 401, 14)) {
if (!DNA_struct_member_exists(
Member

The DNA_struct_member_exists check can be removed here, it should be redundant with the file subversion bump

The `DNA_struct_member_exists` check can be removed here, it should be redundant with the file subversion bump
Author
Contributor

Whoops, thought I removed this in the previous commit

Whoops, thought I removed this in the previous commit
Sean-Kim marked this conversation as resolved
@ -2669,0 +2673,4 @@
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
Sculpt *sculpt = scene->toolsettings->sculpt;
if (sculpt != nullptr) {
Sculpt default_sculpt = *(DNA_struct_default_get(Sculpt));
Member

Unnecessary parentheses here

Unnecessary parentheses here
Sean-Kim marked this conversation as resolved
@ -1286,2 +1286,3 @@
/* Brush can be null. */
/**
* Creates and initializes an automasking cache.
Member

This comment change is still unrelated to the goal of the path, it should be remove from this PR

This comment change is still unrelated to the goal of the path, it should be remove from this PR
Sean-Kim marked this conversation as resolved
@ -315,2 +317,3 @@
/* automasking */
/* Automasking mode flags
* See rna_brush.cc#rna_enum_brush_automasking_flag_items
Member

Unrelated change

Unrelated change
Sean-Kim marked this conversation as resolved
@ -1088,2 +1088,4 @@
int transform_mode;
/* Automasking mode flags
* See rna_brush.cc#rna_enum_brush_automasking_flag_items
Member

Unrelated change

Unrelated change
Sean-Kim marked this conversation as resolved
Sean Kim added 1 commit 2024-01-20 00:57:15 +01:00
Author
Contributor

Sorry that I'm being a bit picky about removing unrelated changes from this PR, but I think it's a good habit to get into, and it makes the life of anyone reading the diff later easier.

No worries about being picky - it's a difference of development habits that I need to get used to for blender.

> Sorry that I'm being a bit picky about removing unrelated changes from this PR, but I think it's a good habit to get into, and it makes the life of anyone reading the diff later easier. No worries about being picky - it's a difference of development habits that I need to get used to for blender.
Sean Kim requested review from Hans Goudey 2024-01-20 00:59:43 +01:00
Sean Kim added 1 commit 2024-01-25 03:55:38 +01:00
Hans Goudey approved these changes 2024-01-25 14:39:35 +01:00
@ -186,2 +186,4 @@
}
/* Fetch the propogation_steps value, preferring the brush level value over the global sculpt tool
* * value. */
Member

* * value -> * value

` * * value` -> ` * value`
Sean-Kim marked this conversation as resolved
Sean Kim added 2 commits 2024-01-25 21:39:02 +01:00
Member

@HooglyBoogly If this is all good to go could you merge the PR?

@HooglyBoogly If this is all good to go could you merge the PR?
Hans Goudey merged commit c61d1bcb54 into main 2024-01-29 15:39:44 +01:00
Sean Kim deleted branch 102377-auto-masking 2024-01-29 21:11:21 +01:00
Sign in to join this conversation.
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
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#117316
No description provided.