[Bf-blender-cvs] [426c7d7101a] sculpt-dev: sculpt-dev: begin fixing merge errors

Joseph Eagar noreply at git.blender.org
Tue Sep 20 19:53:18 CEST 2022


Commit: 426c7d7101a2b7603fb9ac682cf61199baf19748
Author: Joseph Eagar
Date:   Tue Sep 20 10:52:54 2022 -0700
Branches: sculpt-dev
https://developer.blender.org/rB426c7d7101a2b7603fb9ac682cf61199baf19748

sculpt-dev: begin fixing merge errors

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

M	intern/guardedalloc/intern/mallocn_lockfree_impl.c
M	source/blender/blenkernel/BKE_paint.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/dyntopo.c
M	source/blender/blenkernel/intern/paint.cc
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/bmesh/intern/bmesh_log.c
M	source/blender/bmesh/intern/bmesh_mesh.h
M	source/blender/editors/sculpt_paint/paint_mask.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_expand.c
M	source/blender/editors/sculpt_paint/sculpt_face_set.cc
M	source/blender/makesrna/intern/rna_brush.c
M	source/blender/makesrna/intern/rna_brush_engine.c
M	source/blender/makesrna/intern/rna_internal.h
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
index 6a200973d7f..cdeba9d3ab1 100644
--- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c
+++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -111,13 +111,13 @@ void MEM_lockfree_freeN(void *vmemh)
   }
 
   MemHead *memh = MEMHEAD_FROM_PTR(vmemh);
+  MEM_UNPOISON_MEMHEAD(vmemh);
+
   size_t len = MEMHEAD_LEN(memh);
 
   atomic_sub_and_fetch_u(&totblock, 1);
   atomic_sub_and_fetch_z(&mem_in_use, len);
 
-  MEM_UNPOISON_MEMHEAD(vmemh);
-
   if (UNLIKELY(malloc_debug_memset && len)) {
     memset(memh + 1, 255, len);
   }
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 255c2974e65..d8c6566be2b 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -1101,7 +1101,7 @@ void BKE_sculpt_update_object_after_eval(struct Depsgraph *depsgraph, struct Obj
  */
 struct MultiresModifierData *BKE_sculpt_multires_active(const struct Scene *scene,
                                                         struct Object *ob);
-int *BKE_sculpt_face_sets_ensure(struct Mesh *mesh);
+int *BKE_sculpt_face_sets_ensure(struct Object *ob);
 /**
  * Create the attribute used to store face visibility and retrieve its data.
  * Note that changes to the face visibility have to be propagated to other domains
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index c2367076bf7..a31c461e3c0 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -847,8 +847,6 @@ endif()
 #    string(APPEND CMAKE_C_FLAGS " /WX")
 # endif()
 
-set(CMAKE_C_FLAGS "-m64 /DNDEBUG -std=gnu1x -g -fno-omit-frame-pointer -Wno-unused-function -Wno-missing-variable-declarations -Wno-unknown-argument -Wno-assign-enum -Wno-enum-enum-conversion -Wno-sign-compare -Wno-reserved-identifier -Wno-unused-parameter -Werror=incompatible-pointer-types -DNDEBUG -Wno-missing-field-initializers -Wno-suggest-destructor-override -Wno-suggest-override -Wno-shadow-field -Wno-c++11-narrowing -Wno-cast-align -Wno-shorten-64-to-32 -Wno-documentation-unknown- [...]
-
 blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
 
 # Needed so we can use dna_type_offsets.h for defaults initialization.
diff --git a/source/blender/blenkernel/intern/dyntopo.c b/source/blender/blenkernel/intern/dyntopo.c
index 31212ae28e1..91343b26ce5 100644
--- a/source/blender/blenkernel/intern/dyntopo.c
+++ b/source/blender/blenkernel/intern/dyntopo.c
@@ -1362,7 +1362,7 @@ void BKE_pbvh_bmesh_remove_vertex(PBVH *pbvh, BMVert *v, bool log_vert)
   }
 }
 
-void BKE_pbvh_bmesh_add_face(PBVH *pbvh, struct BMFace *f, bool log_face, bool force_tree_walk)
+ATTR_NO_OPT void BKE_pbvh_bmesh_add_face(PBVH *pbvh, struct BMFace *f, bool log_face, bool force_tree_walk)
 {
   bm_logstack_push();
 
diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index 1c8d3927814..04519165f63 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -2221,8 +2221,22 @@ void BKE_sculpt_update_object_for_edit(
   sculpt_update_object(depsgraph, ob_orig, ob_eval, need_pmap, is_paint_tool);
 }
 
-int *BKE_sculpt_face_sets_ensure(Mesh *mesh)
+int *BKE_sculpt_face_sets_ensure(Object *ob)
 {
+  Mesh *mesh = BKE_object_get_original_mesh(ob);
+  SculptSession *ss = ob->sculpt;
+
+  if (ss && ss->bm) {
+    if (CustomData_has_layer(&ss->bm->pdata, CD_SCULPT_FACE_SETS)) {
+      return nullptr;
+    }
+
+    BM_data_layer_add(ss->bm, &ss->bm->pdata, CD_SCULPT_FACE_SETS);
+    BKE_sculptsession_update_attr_refs(ob);
+
+    return nullptr;
+  }
+
   using namespace blender;
   using namespace blender::bke;
   if (CustomData_has_layer(&mesh->pdata, CD_SCULPT_FACE_SETS)) {
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 03c8dead688..b1b9877bfa8 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -49,8 +49,8 @@ Topology rake:
 #include "BKE_ccg.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
-#include "BKE_pbvh.h"
 #include "BKE_paint.h"
+#include "BKE_pbvh.h"
 
 #include "GPU_buffers.h"
 
@@ -3684,7 +3684,7 @@ static void pbvh_bmesh_balance_tree(PBVH *pbvh)
   MEM_SAFE_FREE(depthmap);
 }
 
-static void pbvh_bmesh_join_nodes(PBVH *bvh)
+ATTR_NO_OPT static void pbvh_bmesh_join_nodes(PBVH *bvh)
 {
   if (bvh->totnode < 2) {
     return;
@@ -5997,7 +5997,8 @@ static void pbvh_bmesh_fetch_cdrefs(PBVH *pbvh)
       &bm->vdata, CD_PROP_INT32, SCULPT_ATTRIBUTE_NAME(dyntopo_node_id_vertex));
   pbvh->cd_vert_node_offset = bm->vdata.layers[idx].offset;
 
-  idx = CustomData_get_named_layer_index(&bm->pdata, CD_PROP_INT32, SCULPT_ATTRIBUTE_NAME(dyntopo_node_id_face));
+  idx = CustomData_get_named_layer_index(
+      &bm->pdata, CD_PROP_INT32, SCULPT_ATTRIBUTE_NAME(dyntopo_node_id_face));
   pbvh->cd_face_node_offset = bm->pdata.layers[idx].offset;
 
   idx = CustomData_get_named_layer_index(
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index d4c8740eb2b..31b373b76ea 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -678,6 +678,10 @@ uint BM_log_face_id_get(BMLog *log, BMFace *f)
 /* Get a face from its unique ID */
 static BMFace *bm_log_face_from_id(BMLog *log, uint id)
 {
+  if (log->bm->idmap.map && id >= ((unsigned int)log->bm->idmap.map_size)) {
+    return NULL;
+  }
+
   return (BMFace *)BM_ELEM_FROM_ID(log->bm, id);
 }
 
@@ -1032,7 +1036,7 @@ static void bm_log_edges_unmake_pre(
   }
 }
 
-static void bm_log_faces_unmake_pre(
+ATTR_NO_OPT static void bm_log_faces_unmake_pre(
     BMesh *bm, BMLog *log, GHash *faces, BMLogEntry *entry, BMLogCallbacks *callbacks)
 {
   GHashIterator gh_iter;
@@ -1314,7 +1318,7 @@ static void bm_log_edges_restore(
   }
 }
 
-static void bm_log_faces_restore(
+ATTR_NO_OPT static void bm_log_faces_restore(
     BMesh *bm, BMLog *log, GHash *faces, BMLogEntry *entry, BMLogCallbacks *callbacks)
 {
   GHashIterator gh_iter;
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 35312355b7c..b0b3da3ea36 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -38,7 +38,7 @@ void BM_mesh_elem_toolflags_clear(BMesh *bm);
 
 struct BMeshCreateParams {
   bool create_unique_ids : 1;
-  int id_elem_mask : 4;  // which element types to make unique ids for
+  int id_elem_mask : 8;  // which element types to make unique ids for
   bool id_map : 1;        // maintain an id to element lookup table
   bool use_toolflags : 1;
   bool no_reuse_ids : 1;  // do not reuse IDs; a GHash will be used internally instead of a lookup
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 7df606ef2ed..e0c73419bf9 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -779,7 +779,7 @@ static void sculpt_gesture_init_face_set_properties(SculptGestureContext *sgcont
   struct Mesh *mesh = BKE_mesh_from_object(sgcontext->vc.obact);
   sgcontext->operation = MEM_callocN(sizeof(SculptGestureFaceSetOperation), "Face Set Operation");
 
-  sgcontext->ss->face_sets = BKE_sculpt_face_sets_ensure(mesh);
+  sgcontext->ss->face_sets = BKE_sculpt_face_sets_ensure(sgcontext->vc.obact);
 
   SculptGestureFaceSetOperation *face_set_operation = (SculptGestureFaceSetOperation *)
                                                           sgcontext->operation;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index a03c5eed5e5..376a629d616 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -763,26 +763,25 @@ void SCULPT_face_set_visibility_set(SculptSession *ss, int face_set, bool visibl
       BMIter iter;
       BMFace *f;
 
+      if (!ss->attrs.hide_poly) {
+        return;
+      }
+
+      int cd_hide_poly = ss->attrs.hide_poly->bmesh_cd_offset;
+
       BM_ITER_MESH (f, &iter, ss->bm, BM_FACES_OF_MESH) {
         int fset = BM_ELEM_CD_GET_INT(f, ss->cd_faceset_offset);
         int node = BM_ELEM_CD_GET_INT(f, ss->cd_face_node_offset);
 
-        if (abs(fset) != face_set) {
+        if (fset != face_set) {
           continue;
         }
 
-        if (visible) {
-          fset = abs(fset);
-        }
-        else {
-          fset = -abs(fset);
-        }
+        BM_ELEM_CD_SET_BOOL(f, cd_hide_poly, !visible);
 
         if (node != DYNTOPO_NODE_NONE) {
           BKE_pbvh_vert_tag_update_normal_triangulation(BKE_pbvh_node_from_index(ss->pbvh, node));
         }
-
-        BM_ELEM_CD_SET_INT(f, ss->cd_faceset_offset, fset);
       }
       break;
     }
@@ -8614,7 +8613,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, const wmEvent
   }
   if (SCULPT_tool_is_face_sets(brush->sculpt_tool)) {
     Mesh *mesh = BKE_object_get_original_mesh(ob);
-    ss->face_sets = BKE_sculpt_face_sets_ensure(mesh);
+    ss->face_sets = BKE_sculpt_face_sets_ensure(ob);
   }
 
   stroke = paint_stroke_new(C,
diff --git a/sourc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list