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

Joseph Eagar noreply at git.blender.org
Thu Mar 31 12:54:59 CEST 2022


Commit: 2c29a94531225fe4f8d77171647016e37261de31
Author: Joseph Eagar
Date:   Thu Mar 31 03:54:44 2022 -0700
Branches: temp-sculpt-colors
https://developer.blender.org/rB2c29a94531225fe4f8d77171647016e37261de31

temp-sculpt-colors: make requested changes

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

M	release/scripts/startup/bl_ui/properties_data_mesh.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/BKE_attribute.h
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/attribute.c
M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/data_transfer.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenkernel/intern/pbvh.cc
M	source/blender/blenkernel/intern/pbvh_intern.h
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/draw/intern/draw_cache_extract_mesh_render_data.c
M	source/blender/draw/intern/draw_cache_impl_mesh.c
M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
M	source/blender/editors/sculpt_paint/paint_mask.c
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
M	source/blender/editors/sculpt_paint/sculpt_ops.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index c527d9ad514..4b0947d573e 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -499,14 +499,11 @@ class MESH_UL_attributes(UIList):
         attrs = getattr(data, property)
         ret = []
         idxs = []
-        idx = 0
 
-        for item in attrs:
+        for idx, item in enumerate(attrs):
             ret.append(self.bitflag_filter_item if not item.temporary else 0)
             idxs.append(idx)
 
-            idx += 1
-
         return ret, idxs
 
     def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
@@ -542,7 +539,8 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
             "attributes",
             mesh.attributes,
             "active_index",
-            rows=3,)
+            rows=3,
+        )
 
         col = row.column(align=True)
         col.operator("geometry.attribute_add", icon='ADD', text="")
@@ -598,20 +596,17 @@ class MESH_UL_color_attributes(UIList):
         attrs = getattr(data, property)
         ret = []
         idxs = []
-        idx = 0
 
-        for item in attrs:
-            bad = item.domain not in ["POINT", "CORNER"]
-            bad = bad or item.data_type not in ["FLOAT_COLOR", "BYTE_COLOR"]
+        for idx, item in enumerate(attrs):
+            skip = item.domain not in ["POINT", "CORNER"]
+            skip = skip or item.data_type not in ["FLOAT_COLOR", "BYTE_COLOR"]
 
-            ret.append(self.bitflag_filter_item if not bad else 0)
+            ret.append(self.bitflag_filter_item if not skip else 0)
             idxs.append(idx)
 
-            idx += 1
-
         return ret, idxs
 
-    def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
+    def draw_item(self, _context, layout, data, attribute, _icon, _active_data, _active_propname, _index):
         data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
 
         domain_name = self.display_domain_names.get(attribute.domain, "")
@@ -620,9 +615,12 @@ class MESH_UL_color_attributes(UIList):
         split.emboss = 'NONE'
         split.prop(attribute, "name", text="")
 
-        active_render = _index == _data.color_attributes.render_color_index
+        active_render = _index == data.color_attributes.render_color_index
+
+        props = split.operator("geometry.color_attribute_render_set", text="", icon = 'RESTRICT_RENDER_OFF'if \
+                                active_render else 'RESTRICT_RENDER_ON'
+                               )
 
-        props = split.operator("geometry.color_attribute_render_set", text="", icon = 'RESTRICT_RENDER_OFF' if active_render else 'RESTRICT_RENDER_ON')
         props.name = attribute.name
 
         sub = split.row()
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 8aec3c0d880..750e9b527f0 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -904,6 +904,7 @@ class VIEW3D_PT_sculpt_options(Panel, View3DPaintPanel):
         col.prop(sculpt, "use_automasking_boundary_edges", text="Mesh Boundary")
         col.prop(sculpt, "use_automasking_boundary_face_sets", text="Face Sets Boundary")
 
+
 class VIEW3D_PT_sculpt_options_gravity(Panel, View3DPaintPanel):
     bl_context = ".sculpt_mode"  # dot on purpose (access from topbar)
     bl_parent_id = "VIEW3D_PT_sculpt_options"
diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h
index 1bf2d7ca18e..b47e7e572cf 100644
--- a/source/blender/blenkernel/BKE_attribute.h
+++ b/source/blender/blenkernel/BKE_attribute.h
@@ -92,7 +92,7 @@ int BKE_id_attribute_to_index(const struct ID *id,
                               AttributeDomainMask domain_mask,
                               CustomDataMask layer_mask);
 
-struct CustomDataLayer *BKE_id_attribute_subset_active_get(struct ID *id,
+struct CustomDataLayer *BKE_id_attribute_subset_active_get(const struct ID *id,
                                                            int active_flag,
                                                            AttributeDomainMask domain_mask,
                                                            CustomDataMask mask);
@@ -102,11 +102,11 @@ void BKE_id_attribute_subset_active_set(struct ID *id,
                                         AttributeDomainMask domain_mask,
                                         CustomDataMask mask);
 
-/** Copies CustomData instances into a (usually stack-allocated) ID.  This is a shallow copy, the
- *  purpose is to create a bride for using the C attribute API on arbitrary sets of CustomData
- *  domains.
+/**
+ * Copies CustomData instances into a (usually stack-allocated) ID.  This is a shallow copy, the
+ * purpose is to create a bride for using the C attribute API on arbitrary sets of CustomData
+ * domains.
  */
-
 void BKE_id_attribute_copy_domains_temp(struct ID *temp_id,
                                         const struct CustomData *vdata,
                                         const struct CustomData *edata,
@@ -114,12 +114,12 @@ void BKE_id_attribute_copy_domains_temp(struct ID *temp_id,
                                         const struct CustomData *pdata,
                                         const struct CustomData *cdata);
 
-struct CustomDataLayer *BKE_id_attributes_active_color_get(struct ID *id);
+struct CustomDataLayer *BKE_id_attributes_active_color_get(const struct ID *id);
 void BKE_id_attributes_active_color_set(struct ID *id, struct CustomDataLayer *active_layer);
-struct CustomDataLayer *BKE_id_attributes_render_color_get(struct ID *id);
+struct CustomDataLayer *BKE_id_attributes_render_color_get(const struct ID *id);
 void BKE_id_attributes_render_color_set(struct ID *id, struct CustomDataLayer *active_layer);
 
-bool BKE_id_attribute_find_unique_name(struct ID *id, const char *name, char *outname);
+bool BKE_id_attribute_calc_unique_name(struct ID *id, const char *name, char *outname);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 5c83cbe6e63..5633c476dc1 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -12,6 +12,8 @@
 #include "DNA_brush_enums.h"
 #include "DNA_object_enums.h"
 
+#include "BKE_attribute.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -495,8 +497,8 @@ typedef struct SculptSession {
   struct MPropCol *vcol;
   struct MLoopCol *mcol;
 
-  int vcol_domain;
-  int vcol_type;
+  AttributeDomain vcol_domain;
+  CustomDataType vcol_type;
 
   float *vmask;
 
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index acbc4778555..c6c8e1dffa7 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -528,19 +528,19 @@ const float (*BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3];
 PBVHColorBufferNode *BKE_pbvh_node_color_buffer_get(PBVHNode *node);
 void BKE_pbvh_node_color_buffer_free(PBVH *pbvh);
 bool BKE_pbvh_get_color_layer(const struct Mesh *me,
-                              CustomDataLayer **cl_out,
-                              AttributeDomain *attr_out);
+                              CustomDataLayer **r_layer,
+                              AttributeDomain *r_attr);
 
 /* Swaps colors at each element in indices (of domain pbvh->vcol_domain)
  * with values in colors. */
-void BKE_pbvh_swap_colors(PBVH *pbvh, float (*colors)[4], int *indices, int totelem);
+void BKE_pbvh_swap_colors(PBVH *pbvh, float (*colors)[4], int *indices, int elem_num);
 
 /* Stores colors from the elements in indices (of domain pbvh->vcol_domain)
  * into colors. */
-void BKE_pbvh_store_colors(PBVH *pbvh, float (*colors)[4], int *indices, int totelem);
+void BKE_pbvh_store_colors(PBVH *pbvh, float (*colors)[4], int *indices, int elem_num);
 
 /* Like BKE_pbvh_store_colors but handles loop->vert conversion */
-void BKE_pbvh_store_colors_vertex(PBVH *pbvh, float (*colors)[4], int *indices, int totelem);
+void BKE_pbvh_store_colors_vertex(PBVH *pbvh, float (*colors)[4], int *indices, int elem_num);
 
 bool BKE_pbvh_is_drawing(const PBVH *pbvh);
 void BKE_pbvh_is_drawing_set(PBVH *pbvh, bool val);
@@ -554,7 +554,7 @@ void BKE_pbvh_pmap_set(PBVH *pbvh, const struct MeshElemMap *pmap);
 void BKE_pbvh_vertex_color_set(PBVH *pbvh, int vertex, const float color[4]);
 void BKE_pbvh_vertex_color_get(PBVH *pbvh, int vertex, float r_color[4]);
 
-void BKE_pbvh_ensure_node_loops(PBVH *pbvh, const struct Mesh *me);
+void BKE_pbvh_ensure_node_loops(PBVH *pbvh);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/intern/attribute.c b/source/blender/blenkernel/intern/attribute.c
index 60457ec5367..ad7fea4b78e 100644
--- a/source/blender/blenkernel/intern/attribute.c
+++ b/source/blender/blenkernel/intern/attribute.c
@@ -162,7 +162,7 @@ static bool unique_name_cb(void *arg, const char *name)
   return false;
 }
 
-bool BKE_id_attribute_find_unique_name(ID *id, const char *name, char *outname)
+bool BKE_id_attribute_calc_unique_name(ID *id, const char *name, char *outname)
 {
   AttrUniqueData data = {.id = id};
 
@@ -184,7 +184,7 @@ CustomDataLayer *BKE_id_attribute_new(
   }
 
   char uniquename[MAX_CUSTOMDATA_LAYER_NAME];
-  BKE_id_attribute_find_unique_name(id, name, uniquename);
+  BKE_id_attribute_calc_unique_name(id, name, uniquename);
 
   switch (GS(id->name)) {
     case ID_ME: {
@@ -500,14 +500,14 @@ int BKE_id_attribute_to_index(const struct ID *id,
 
     CustomData *cdata = info[domains[i]].customdata;
     for (int j = 0; j < cdata->totlayer; j++) {
-      CustomDataLayer *layer2 = cdata->layers + j;
+      CustomDataLayer *layer_iter = cdata->layers + j;
 
-      if (!(CD_TYPE_AS_MASK(layer2->type) & layer_mask) ||
-          (CD_TYPE_AS_MASK(layer2->type) & CD_FLAG_TEMPORARY)) {
+      if (!(CD_TYPE_AS_MASK(layer_iter->type) & layer_mask) ||
+          (CD_TYPE_AS_MASK(

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list