[Bf-blender-cvs] [185ca2912f2] sculpt-dev: Sculpt-dev: fix cloth crash

Joseph Eagar noreply at git.blender.org
Sun Apr 17 20:03:14 CEST 2022


Commit: 185ca2912f2ae3893eed924e9fe52cfdcc9d8d34
Author: Joseph Eagar
Date:   Sun Apr 17 11:01:47 2022 -0700
Branches: sculpt-dev
https://developer.blender.org/rB185ca2912f2ae3893eed924e9fe52cfdcc9d8d34

Sculpt-dev: fix cloth crash

* Fixed ss->totedges not being set correctly
  in all cases.  Fixes crash in cloth brush.
* Fix compile errors in alembic and fluid
  code.
* Remove a couple of debug ATTR_NO_OPTs.

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

M	source/blender/blenkernel/intern/fluid.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenkernel/intern/pbvh.cc
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_cloth.c
M	source/blender/editors/sculpt_paint/sculpt_ops.c
M	source/blender/editors/sculpt_paint/sculpt_paint_color.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/editors/transform/transform_snap_object.cc
M	source/blender/io/alembic/intern/abc_reader_mesh.cc
M	source/blender/windowmanager/intern/wm_event_system.c

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

diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index dab33dd74e0..81e73b6cf2c 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -3319,7 +3319,7 @@ static Mesh *create_liquid_geometry(FluidDomainSettings *fds,
 
   if (use_speedvectors) {
     CustomDataLayer *velocity_layer = BKE_id_attribute_new(
-        &me->id, "velocity", CD_PROP_FLOAT3, CD_MASK_PROP_ALL, ATTR_DOMAIN_POINT, NULL);
+        &me->id, "velocity", CD_PROP_FLOAT3, ATTR_DOMAIN_POINT, NULL);
     velarray = velocity_layer->data;
   }
 
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 272b144818c..4ff999c91ed 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1754,6 +1754,8 @@ static void sculpt_update_object(Depsgraph *depsgraph,
     ss->totvert = me->totvert;
     ss->totpoly = me->totpoly;
     ss->totfaces = me->totpoly;
+    ss->totloops = me->totloop;
+    ss->totedges = me->totedge;
     ss->mvert = me->mvert;
     ss->medge = me->medge;
     ss->mpoly = me->mpoly;
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 5d6a47727a9..df15a23ae0f 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1432,9 +1432,9 @@ bool BKE_pbvh_get_color_layer(const Mesh *me, CustomDataLayer **r_layer, Attribu
   return true;
 }
 
-ATTR_NO_OPT static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
-                                                   const int n,
-                                                   const TaskParallelTLS *__restrict UNUSED(tls))
+static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
+                                       const int n,
+                                       const TaskParallelTLS *__restrict UNUSED(tls))
 {
   /* Create and update draw buffers. The functions called here must not
    * do any OpenGL calls. Flags are not cleared immediately, that happens
diff --git a/source/blender/blenkernel/intern/pbvh.cc b/source/blender/blenkernel/intern/pbvh.cc
index 787564b46e6..0475296daa2 100644
--- a/source/blender/blenkernel/intern/pbvh.cc
+++ b/source/blender/blenkernel/intern/pbvh.cc
@@ -151,7 +151,7 @@ static void pbvh_vertex_color_get_bmesh(const PBVH &pbvh, SculptVertRef vertex,
     BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
       float temp[4];
 
-      T *ptr = static_cast<T*>(BM_ELEM_CD_GET_VOID_P(l, pbvh.cd_vcol_offset));
+      T *ptr = static_cast<T *>(BM_ELEM_CD_GET_VOID_P(l, pbvh.cd_vcol_offset));
       to_float(*ptr, temp);
 
       add_v4_v4(r_color, temp);
@@ -276,7 +276,7 @@ void BKE_pbvh_swap_colors(PBVH *pbvh,
   });
 }
 
-ATTR_NO_OPT void BKE_pbvh_store_colors(PBVH *pbvh,
+void BKE_pbvh_store_colors(PBVH *pbvh,
                            const int *indices,
                            const int indices_num,
                            float (*r_colors)[4])
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index f5bfc12c3e9..1878914066a 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -7789,10 +7789,10 @@ static void sculpt_cache_dyntopo_settings(BrushChannelSet *chset,
   r_settings->constant_detail = BRUSHSET_GET_FLOAT(chset, dyntopo_constant_detail, input_data);
 };
 
-ATTR_NO_OPT static void sculpt_stroke_update_step(bContext *C,
-                                                  wmOperator *UNUSED(op),
-                                                  struct PaintStroke *stroke,
-                                                  PointerRNA *itemptr)
+static void sculpt_stroke_update_step(bContext *C,
+                                      wmOperator *UNUSED(op),
+                                      struct PaintStroke *stroke,
+                                      PointerRNA *itemptr)
 
 {
 
@@ -8864,6 +8864,7 @@ void SCULPT_fake_neighbors_free(Object *ob)
 void SCULPT_ensure_epmap(SculptSession *ss)
 {
   if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH && !ss->epmap) {
+
     BKE_mesh_edge_poly_map_create(&ss->epmap,
                                   &ss->epmap_mem,
                                   ss->medge,
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index 7d6df2ef194..847d2bb8454 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -100,7 +100,8 @@
 #endif
 
 typedef enum { CON_LENGTH, CON_BEND } ClothConstraintTypes;
-struct {
+
+static struct {
   int type;
   int totelem;
   size_t size;
@@ -811,10 +812,6 @@ static void do_cloth_brush_build_constraints_task_cb_ex(
   const Brush *brush = data->brush;
   PBVHNode *node = data->nodes[n];
 
-  if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
-    SCULPT_ensure_epmap(ss);
-  }
-
   const int node_index = POINTER_AS_INT(BLI_ghash_lookup(data->cloth_sim->node_state_index, node));
   if (data->cloth_sim->node_state[node_index] != SCULPT_CLOTH_NODE_UNINITIALIZED) {
     /* The simulation already contains constraints for this node. */
@@ -2004,7 +2001,7 @@ static void cloth_brush_satisfy_constraints_task_cb(void *__restrict userdata,
   }
 }
 
-void cloth_brush_satisfy_constraints(SculptSession *ss,
+static void cloth_brush_satisfy_constraints(SculptSession *ss,
                                      Brush *brush,
                                      SculptClothSimulation *cloth_sim)
 {
@@ -2261,6 +2258,7 @@ void SCULPT_cloth_brush_ensure_nodes_constraints(
     const float radius)
 {
   Brush *brush = BKE_paint_brush(&sd->paint);
+  SculptSession *ss = ob->sculpt;
 
   /* TODO: Multi-threaded needs to be disabled for this task until implementing the optimization of
    * storing the constraints per node. */
@@ -2272,6 +2270,10 @@ void SCULPT_cloth_brush_ensure_nodes_constraints(
   cloth_sim->created_length_constraints = BLI_edgeset_new("created length constraints");
   cloth_sim->created_bend_constraints = BLI_edgeset_new("created bend constraints");
 
+  if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
+    SCULPT_ensure_epmap(ss);
+  }
+
   SculptThreadedTaskData build_constraints_data = {
       .sd = sd,
       .ob = ob,
diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c
index 4b38970c9cf..bcecda5aac4 100644
--- a/source/blender/editors/sculpt_paint/sculpt_ops.c
+++ b/source/blender/editors/sculpt_paint/sculpt_ops.c
@@ -654,7 +654,7 @@ static bool sculpt_sample_color_update_from_base(bContext *C,
   return true;
 }
 
-ATTR_NO_OPT static int sculpt_sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
+static int sculpt_sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
   ARegion *region = CTX_wm_region(C);
   Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
index 00ec2c80257..fef20fa286b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
@@ -100,7 +100,7 @@ static void do_color_smooth_task_cb_exec(void *__restrict userdata,
   BKE_pbvh_vertex_iter_end;
 }
 
-ATTR_NO_OPT static void do_paint_brush_task_cb_ex(void *__restrict userdata,
+static void do_paint_brush_task_cb_ex(void *__restrict userdata,
                                       const int n,
                                       const TaskParallelTLS *__restrict tls)
 {
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index afb959f28e9..a0535ef8509 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1765,7 +1765,7 @@ static void sculpt_undo_store_mask(Object *ob, SculptUndoNode *unode)
   BKE_pbvh_vertex_iter_end;
 }
 
-ATTR_NO_OPT static void sculpt_undo_store_color(Object *ob, SculptUndoNode *unode)
+static void sculpt_undo_store_color(Object *ob, SculptUndoNode *unode)
 {
   SculptSession *ss = ob->sculpt;
 
diff --git a/source/blender/editors/transform/transform_snap_object.cc b/source/blender/editors/transform/transform_snap_object.cc
index 8acdc80147d..388d5bd2ff2 100644
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@ -1009,7 +1009,7 @@ struct RaycastObjUserData {
 /**
  * \note Duplicate args here are documented at #snapObjectsRay
  */
-ATTR_NO_OPT static void raycast_obj_fn(SnapObjectContext *sctx,
+static void raycast_obj_fn(SnapObjectContext *sctx,
                            const struct SnapObjectParams *params,
                            Object *ob_eval,
                            const float obmat[4][4],
@@ -2495,7 +2495,7 @@ static short snapMesh(SnapObjectContext *sctx,
   return 0;
 }
 
-ATTR_NO_OPT static short snapEditMesh(SnapObjectContext *sctx,
+static short snapEditMesh(SnapObjectContext *sctx,
                           const struct SnapObjectParams *params,
                           Object *ob_eval,
                           BMEditMesh *em,
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc
index e345a5bdb25..fe2b0470432 100644
--- a/source/blender/io/alembic/intern/abc_reader_mesh.cc
+++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc
@@ -458,7 +458,7 @@ static void read_velocity(const V3fArraySamplePtr &velocities,
   }
 
   CustomDataLayer *velocity_layer = BKE_id_attribute_new(
-      &config.mesh->id, "velocity", CD_PROP_FLOAT3, CD_MASK_PROP_ALL, ATTR_DOMAIN_POINT, nullptr);
+      &config.mesh->id, "velocity", CD_PROP_FLOAT3, ATTR_DOMAIN_POINT, nullptr);
   float(*velocity)[3] = (float(*)[3])velocity_layer->data;
 
   for (int i = 0; i < num_velocity_vectors; i++) {
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 2aff3e3c39b..cc9

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list