[Bf-blender-cvs] [c1942c9b5e8] temp-sculpt-colors: temp-sculpt-colors: make requested changes

Joseph Eagar noreply at git.blender.org
Wed Jan 12 11:39:21 CET 2022


Commit: c1942c9b5e861d18262dfd9f2d9ae3d00479a1ed
Author: Joseph Eagar
Date:   Wed Jan 12 02:38:00 2022 -0800
Branches: temp-sculpt-colors
https://developer.blender.org/rBc1942c9b5e861d18262dfd9f2d9ae3d00479a1ed

temp-sculpt-colors: make requested changes

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

M	release/datafiles/icons/brush.sculpt.paint.dat
A	release/datafiles/icons/ops.sculpt.color_filter.dat
A	release/datafiles/icons/ops.sculpt.mask_by_color.dat
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/datafiles/CMakeLists.txt
M	source/blender/editors/geometry/geometry_attributes.c

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

diff --git a/release/datafiles/icons/brush.sculpt.paint.dat b/release/datafiles/icons/brush.sculpt.paint.dat
index ef5f5fe851a..0ec7c7c7052 100644
Binary files a/release/datafiles/icons/brush.sculpt.paint.dat and b/release/datafiles/icons/brush.sculpt.paint.dat differ
diff --git a/release/datafiles/icons/ops.sculpt.color_filter.dat b/release/datafiles/icons/ops.sculpt.color_filter.dat
new file mode 100644
index 00000000000..9c8fb3c0e92
Binary files /dev/null and b/release/datafiles/icons/ops.sculpt.color_filter.dat differ
diff --git a/release/datafiles/icons/ops.sculpt.mask_by_color.dat b/release/datafiles/icons/ops.sculpt.mask_by_color.dat
new file mode 100644
index 00000000000..e22b1270a79
Binary files /dev/null and b/release/datafiles/icons/ops.sculpt.mask_by_color.dat differ
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 11e272fddde..b9542f2cec1 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -235,6 +235,10 @@ class _draw_tool_settings_context_mode:
 
         ups = tool_settings.unified_paint_settings
 
+        if capabilities.has_color:
+            UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
+            layout.prop(brush, "blend", text="", expand=False)
+
         size = "size"
         size_owner = ups if ups.use_unified_size else brush
         if size_owner.use_locked_size == 'SCENE':
@@ -269,10 +273,6 @@ class _draw_tool_settings_context_mode:
         if not capabilities.has_direction:
             layout.row().prop(brush, "direction", expand=True, text="")
 
-        if capabilities.has_color:
-            UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
-            layout.prop(brush, "blend", text="", expand=False)
-
         return True
 
     @staticmethod
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index d3b3520af2b..593e988f8ea 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -857,6 +857,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
   ops.sculpt.border_hide
   ops.sculpt.border_mask
   ops.sculpt.box_trim
+  ops.sculpt.color_filter
   ops.sculpt.cloth_filter
   ops.sculpt.face_set_edit
   ops.sculpt.lasso_face_set
@@ -864,6 +865,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES
   ops.sculpt.lasso_trim
   ops.sculpt.line_mask
   ops.sculpt.line_project
+  ops.sculpt.mask_by_color
   ops.sculpt.mesh_filter
   ops.sequencer.blade
   ops.transform.bone_envelope
diff --git a/source/blender/editors/geometry/geometry_attributes.c b/source/blender/editors/geometry/geometry_attributes.c
index 6b6c5a0945d..e282e474c6a 100644
--- a/source/blender/editors/geometry/geometry_attributes.c
+++ b/source/blender/editors/geometry/geometry_attributes.c
@@ -21,6 +21,8 @@
  * \ingroup edgeometry
  */
 
+#include "BLI_math.h"
+
 #include "BKE_attribute.h"
 #include "BKE_context.h"
 
@@ -121,12 +123,7 @@ static void next_color_attr(struct ID *id, CustomDataLayer *layer, bool is_rende
   int length = BKE_id_attributes_length(id, domain_mask, type_mask);
   int idx = BKE_id_attribute_index_from_ref(id, ref, domain_mask, type_mask);
 
-  if (idx == length - 1) {
-    idx = MAX2(idx - 1, 0);
-  }
-  else {
-    idx++;
-  }
+  idx = mod_i(idx + 1, length);
 
   BKE_id_attribute_ref_from_index(id, idx, domain_mask, type_mask, ref);
 }
@@ -182,10 +179,6 @@ static int geometry_attribute_remove_exec(bContext *C, wmOperator *op)
   ID *id = ob->data;
   CustomDataLayer *layer = BKE_id_attributes_active_get(id);
 
-  if (layer == NULL) {
-    return OPERATOR_CANCELLED;
-  }
-
   next_color_attrs(id, layer);
 
   if (!BKE_id_attribute_remove(id, layer, op->reports)) {



More information about the Bf-blender-cvs mailing list