[Bf-blender-cvs] [6bfbdc4bff8] temp-sculpt-normals-masking: temp-sculpt-normals-masking: Make occlusion suboption of view normal

Joseph Eagar noreply at git.blender.org
Sat Jul 30 20:31:34 CEST 2022


Commit: 6bfbdc4bff8a54d8f9426c3e05d3a44aa09e434d
Author: Joseph Eagar
Date:   Sat Jul 30 11:31:06 2022 -0700
Branches: temp-sculpt-normals-masking
https://developer.blender.org/rB6bfbdc4bff8a54d8f9426c3e05d3a44aa09e434d

temp-sculpt-normals-masking: Make occlusion suboption of view normal

===================================================================

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/editors/sculpt_paint/sculpt_automasking.cc

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index 47c38d116f8..4b5da913fe2 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -947,13 +947,13 @@ def brush_settings_advanced(layout, context, brush, popover=False):
 
         col.prop(brush, "use_automasking_start_normal", text="Area Normal")
         col.prop(brush, "use_automasking_view_normal", text="View Normal")
-        col.prop(brush, "use_automasking_view_occlusion", text="Occlusion")
 
         sculpt = context.tool_settings.sculpt
 
         if brush.use_automasking_start_normal:
             col.separator()
 
+            col.prop(brush, "use_automasking_view_occlusion", text="Occlusion")
             col.prop(sculpt, "automasking_start_normal_limit")
             col.prop(sculpt, "automasking_start_normal_falloff")
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index e69d106374a..64add640fd0 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5475,7 +5475,6 @@ class VIEW3D_MT_sculpt_automasking_pie(Menu):
         pie.prop(sculpt, "use_automasking_boundary_edges", text="Mesh Boundary")
         pie.prop(sculpt, "use_automasking_start_normal", text="Area Normal")
         pie.prop(sculpt, "use_automasking_view_normal", text="View Normal")
-        pie.prop(sculpt, "use_automasking_view_occlusion", text="Occlusion")
 
 
 class VIEW3D_MT_sculpt_face_sets_edit_pie(Menu):
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 7b1b02ef905..9358e1f5a05 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -972,8 +972,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
         col.prop(sculpt, "use_automasking_boundary_edges", text="Mesh Boundary")
         col.prop(sculpt, "use_automasking_start_normal", text="Area Normal")
         col.prop(sculpt, "use_automasking_view_normal", text="View Normal")
-        col.prop(sculpt, "use_automasking_view_occlusion", text="Occlusion")
-
+        
         if sculpt.use_automasking_start_normal:
             col.separator()
 
@@ -983,6 +982,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
         if sculpt.use_automasking_view_normal:
             col.separator()
 
+            col.prop(sculpt, "use_automasking_view_occlusion", text="Occlusion")
             col.prop(sculpt, "automasking_view_normal_limit")
             col.prop(sculpt, "automasking_view_normal_falloff")
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
index 004fba98b68..36f0b4bf3c8 100644
--- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc
@@ -93,9 +93,6 @@ bool SCULPT_is_automasking_enabled(const Sculpt *sd, const SculptSession *ss, co
   if (SCULPT_is_automasking_mode_enabled(sd, br, BRUSH_AUTOMASKING_VIEW_NORMAL)) {
     return true;
   }
-  if (SCULPT_is_automasking_mode_enabled(sd, br, BRUSH_AUTOMASKING_VIEW_OCCLUSION)) {
-    return true;
-  }
   return false;
 }
 
@@ -126,7 +123,7 @@ static float sculpt_automasking_normal_calc(AutomaskingCache *automasking,
 {
   float normal_v[3];
 
-  if (automask_data->orig_data.no) {
+  if (automask_data->have_orig_data) {
     copy_v3_v3(normal_v, automask_data->orig_data.no);
   }
   else {
@@ -162,8 +159,7 @@ static bool SCULPT_automasking_needs_factors_cache(const Sculpt *sd, const Brush
   if (automasking_flags & (BRUSH_AUTOMASKING_BOUNDARY_EDGES,
                            BRUSH_AUTOMASKING_BOUNDARY_FACE_SETS,
                            BRUSH_AUTOMASKING_BRUSH_NORMAL,
-                           BRUSH_AUTOMASKING_VIEW_NORMAL,
-                           BRUSH_AUTOMASKING_VIEW_OCCLUSION)) {
+                           BRUSH_AUTOMASKING_VIEW_NORMAL)) {
     return brush && brush->automasking_boundary_edges_propagation_steps != 1;
   }
   return false;
@@ -250,8 +246,10 @@ float SCULPT_automasking_factor_get(AutomaskingCache *automasking,
     return automasking->factor[index];
   }
 
-  if ((automasking->settings.flags & BRUSH_AUTOMASKING_VIEW_OCCLUSION) &&
-      automasking_view_occlusion_factor(automasking, ss, vert, automask_data)) {
+  bool do_occlusion = (automasking->settings.flags &
+                       (BRUSH_AUTOMASKING_VIEW_OCCLUSION | BRUSH_AUTOMASKING_VIEW_NORMAL)) ==
+                      (BRUSH_AUTOMASKING_VIEW_OCCLUSION | BRUSH_AUTOMASKING_VIEW_NORMAL);
+  if (do_occlusion && automasking_view_occlusion_factor(automasking, ss, vert, automask_data)) {
     return 0.0f;
   }
 
@@ -498,11 +496,12 @@ void sculpt_normal_occlusion_automasking_fill(AutomaskingCache *automasking,
       factor[i] *= automasking_brush_normal_factor(automasking, ss, vertex, &nodedata);
     }
     if ((int)mode & BRUSH_AUTOMASKING_VIEW_NORMAL) {
+      if ((int)mode & BRUSH_AUTOMASKING_VIEW_OCCLUSION) {
+        factor[i] *= automasking_view_occlusion_factor(automasking, ss, vertex, &nodedata);
+      }
+
       factor[i] *= automasking_view_normal_factor(automasking, ss, vertex, &nodedata);
     }
-    if ((int)mode & BRUSH_AUTOMASKING_VIEW_OCCLUSION) {
-      factor[i] *= automasking_view_occlusion_factor(automasking, ss, vertex, &nodedata);
-    }
   }
 }
 
@@ -520,7 +519,7 @@ AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object
   SCULPT_automasking_cache_settings_update(automasking, ss, sd, brush);
   SCULPT_boundary_info_ensure(ob);
 
-  if (SCULPT_is_automasking_mode_enabled(sd, brush, BRUSH_AUTOMASKING_VIEW_OCCLUSION)) {
+  if (sculpt_automasking_mode_effective_bits(sd, brush) & BRUSH_AUTOMASKING_VIEW_OCCLUSION) {
     automasking->occluded = (char *)MEM_callocN(totvert, "automasking->occluded");
   }



More information about the Bf-blender-cvs mailing list