Regression: Sculpt: Many operations not respecting the visibility anymore (probably everything that uses BKE_pbvh_vertex_iter_begin) #101027

Closed
opened 2022-09-13 07:59:56 +02:00 by TheRedWaxPolice · 13 comments

System Information
Operating system: Win 10

Blender Version
Broken: blender-3.4.0-alpha+master.ddfce277e0cb-windows.amd64-release
Caused by b5f7af31d6

Short description of error
Some operators like Fill Mask or Invert Mask are not not respecting the visibility state of the mesh... So if you have some parts of the mesh hidden and then run some of those commands, it will apply the mask to the entire mesh, instead of just the visible part...

Exact steps for others to reproduce the error
File/New/Sculpting
Choose the Box Hide tool for example
Hide part of the mesh
Go to the Mask menu and choose Fill Mask
Unhide everything (Sculpt menu/Show All)
As you can see, the mask was applied to the entire mesh, instead of just the visible part

blender_2022-09-13_06-36-09.mp4

Actually, it seems a lot more functionality is broken, I assume everything that uses BKE_pbvh_vertex_iter_begin
(tested e.g. Color Filters: broken in regards to respecting hidden polys...)

So it seems this is just using the Box Hide tool not flushing this to the right places?
PBVH hide_vert just does not exist after Box Hide, going in and out of editmode then fixes this (could be used as a temporary workaround)

**System Information** Operating system: Win 10 **Blender Version** Broken: blender-3.4.0-alpha+master.ddfce277e0cb-windows.amd64-release Caused by b5f7af31d6 **Short description of error** Some operators like Fill Mask or Invert Mask are not not respecting the visibility state of the mesh... So if you have some parts of the mesh hidden and then run some of those commands, it will apply the mask to the entire mesh, instead of just the visible part... **Exact steps for others to reproduce the error** File/New/Sculpting Choose the Box Hide tool for example Hide part of the mesh Go to the Mask menu and choose Fill Mask Unhide everything (Sculpt menu/Show All) As you can see, the mask was applied to the entire mesh, instead of just the visible part [blender_2022-09-13_06-36-09.mp4](https://archive.blender.org/developer/F13486864/blender_2022-09-13_06-36-09.mp4) Actually, it seems a lot more functionality is broken, I assume everything that uses `BKE_pbvh_vertex_iter_begin` (tested e.g. Color Filters: broken in regards to respecting hidden polys...) So it seems this is just using the Box Hide tool not flushing this to the right places? `PBVH` `hide_vert` just does not exist after Box Hide, going in and out of editmode then fixes this (could be used as a temporary workaround)

Added subscriber: @TheRedWaxPolice

Added subscriber: @TheRedWaxPolice
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm, will check

Can confirm, will check
Member

Added subscribers: @HooglyBoogly, @JosephEagar

Added subscribers: @HooglyBoogly, @JosephEagar
Member
Caused by b5f7af31d6 CC @HooglyBoogly CC @JosephEagar
Philipp Oeser changed title from Sculpt: Mask operators not respecting the visibility to Regression: Sculpt: Mask operators not respecting the visibility 2022-09-13 09:52:49 +02:00
Member

While this does not fix the issue, I guess this is also wrong in the culprit commit?
P3186: T101027_snippet



diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 65e69bd8761..ef75a0b357c 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -837,7 +837,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss,
   iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY;
   iter->neighbors = iter->neighbors_fixed;
   iter->neighbor_indices = iter->neighbor_indices_fixed;
-  const bool *hide_poly = BKE_pbvh_get_vert_hide(ss->pbvh);
+  const bool *hide_poly = BKE_pbvh_get_poly_hide(ss->pbvh);
 
   for (int i = 0; i < ss->pmap[vertex.i].count; i++) {
     if (hide_poly && hide_poly[vert_map->indices[i]]) {
While this does not fix the issue, I guess this is also wrong in the culprit commit? [P3186: T101027_snippet](https://archive.blender.org/developer/P3186.txt) ``` diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 65e69bd8761..ef75a0b357c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -837,7 +837,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, iter->capacity = SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY; iter->neighbors = iter->neighbors_fixed; iter->neighbor_indices = iter->neighbor_indices_fixed; - const bool *hide_poly = BKE_pbvh_get_vert_hide(ss->pbvh); + const bool *hide_poly = BKE_pbvh_get_poly_hide(ss->pbvh); for (int i = 0; i < ss->pmap[vertex.i].count; i++) { if (hide_poly && hide_poly[vert_map->indices[i]]) { ```
Member

Actually, it seems a lot more functionality is broken, I assme everything that uses BKE_pbvh_vertex_iter_begin
(tested e.g. Color Filters: broken in regards to respecting hidden polys...)

Actually, it seems a lot more functionality is broken, I assme everything that uses `BKE_pbvh_vertex_iter_begin` (tested e.g. Color Filters: broken in regards to respecting hidden polys...)
Philipp Oeser changed title from Regression: Sculpt: Mask operators not respecting the visibility to Regression: Sculpt: Many operations not respecting the visibility anymore (probably everything that uses `BKE_pbvh_vertex_iter_begin`) 2022-09-13 11:03:12 +02:00
Member

So it seems this is just using the Box Hide tool not flushing this to the right places?
PBVH hide_vert just does not exist after Box Hide, going in and out of editmode then fixes this (could be used as a temporary workaround)

So it seems this is just using the Box Hide tool not flushing this to the right places? `PBVH` `hide_vert` just does not exist after Box Hide, going in and out of editmode then fixes this (could be used as a temporary workaround)
Member

For reference, something like this would do the trick (making sure hide_vert is available on the PBVH immediately without doing the roundtrip to editmode)
P3187: Fix #101027



diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 403f3a31ba0..74344aa5e49 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -673,6 +673,7 @@ struct MVert *BKE_pbvh_get_verts(const PBVH *pbvh);
 const float (*BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3];
 const bool *BKE_pbvh_get_vert_hide(const PBVH *pbvh);
 bool *BKE_pbvh_get_vert_hide_for_write(PBVH *pbvh);
+void BKE_pbvh_set_vert_hide(PBVH *pbvh, bool *hide_vert);
 
 const bool *BKE_pbvh_get_poly_hide(const PBVH *pbvh);
 
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 2de5c718918..1b7de156d8c 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -3237,6 +3237,10 @@ bool *BKE_pbvh_get_vert_hide_for_write(PBVH *pbvh)
   return pbvh->hide_vert;
 }
 
+void BKE_pbvh_set_vert_hide(PBVH *pbvh, bool *hide_vert) {
+  pbvh->hide_vert = hide_vert;
+}
+
 void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, SubdivCCG *subdiv_ccg)
 {
   pbvh->subdiv_ccg = subdiv_ccg;
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index c1289364fb2..76e003c733b 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -102,6 +102,7 @@ static void partialvis_update_mesh(Object *ob,
   }
 
   if (any_changed) {
+    BKE_pbvh_set_vert_hide(pbvh, hide_vert);
     BKE_pbvh_node_mark_rebuild_draw(node);
     BKE_pbvh_node_fully_hidden_set(node, !any_visible);
   }
For reference, something like this would do the trick (making sure `hide_vert` is available on the `PBVH` immediately without doing the roundtrip to editmode) [P3187: Fix #101027](https://archive.blender.org/developer/P3187.txt) ``` diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 403f3a31ba0..74344aa5e49 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -673,6 +673,7 @@ struct MVert *BKE_pbvh_get_verts(const PBVH *pbvh); const float (*BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3]; const bool *BKE_pbvh_get_vert_hide(const PBVH *pbvh); bool *BKE_pbvh_get_vert_hide_for_write(PBVH *pbvh); +void BKE_pbvh_set_vert_hide(PBVH *pbvh, bool *hide_vert); const bool *BKE_pbvh_get_poly_hide(const PBVH *pbvh); diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 2de5c718918..1b7de156d8c 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -3237,6 +3237,10 @@ bool *BKE_pbvh_get_vert_hide_for_write(PBVH *pbvh) return pbvh->hide_vert; } +void BKE_pbvh_set_vert_hide(PBVH *pbvh, bool *hide_vert) { + pbvh->hide_vert = hide_vert; +} + void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, SubdivCCG *subdiv_ccg) { pbvh->subdiv_ccg = subdiv_ccg; diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index c1289364fb2..76e003c733b 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -102,6 +102,7 @@ static void partialvis_update_mesh(Object *ob, } if (any_changed) { + BKE_pbvh_set_vert_hide(pbvh, hide_vert); BKE_pbvh_node_mark_rebuild_draw(node); BKE_pbvh_node_fully_hidden_set(node, !any_visible); } ```

This issue was referenced by 8442b0ffc1

This issue was referenced by 8442b0ffc1df59cf6e557e7243b9197b2a898aa0
Hans Goudey self-assigned this 2022-09-13 15:36:30 +02:00
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Member

Thanks for the report and the investigation.

Thanks for the report and the investigation.
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
4 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#101027
No description provided.