[Bf-blender-cvs] [75a1116b512] temp_bmesh_multires: Merge from master

Joseph Eagar noreply at git.blender.org
Sat Mar 20 02:01:22 CET 2021


Commit: 75a1116b5125fb30bb33ad1d57d283451290b3bb
Author: Joseph Eagar
Date:   Fri Mar 19 18:01:12 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB75a1116b5125fb30bb33ad1d57d283451290b3bb

Merge from master

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

M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_detail.c
M	source/blender/editors/sculpt_paint/sculpt_expand.c
M	source/blender/editors/sculpt_paint/sculpt_geodesic.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_mask_init.c
M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

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

diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index b1d2156f1e4..1aff28813a8 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -651,6 +651,8 @@ void BKE_pbvh_set_flat_vcol_shading(PBVH *pbvh, bool value);
 
 #define DYNTOPO_CD_INTERP
 
+void SCULPT_update_flat_vcol_shading(struct Object *ob, struct Scene *scene);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index e233ff29291..f64a6a4f187 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -77,6 +77,10 @@
 
 #include "bmesh.h"
 
+//XXX todo: work our bad module cross ref
+void SCULPT_dynamic_topology_sync_layers(Object *ob,
+                                         Mesh *me);
+
 static void palette_init_data(ID *id)
 {
   Palette *palette = (Palette *)id;
@@ -2176,9 +2180,6 @@ static PBVH *build_pbvh_from_ccg(Object *ob, SubdivCCG *subdiv_ccg, bool respect
   return pbvh;
 }
 
-// XXX hack
-extern SCULPT_dynamic_topology_sync_layers(Object *ob, Mesh *me);
-
 PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
 {
   if (ob == NULL || ob->sculpt == NULL) {
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index f929624e9d8..30a05e0b4f4 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -30,6 +30,8 @@
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 
 #include "BKE_ccg.h"
 #include "BKE_mesh.h" /* for BKE_mesh_calc_normals */
@@ -3660,3 +3662,20 @@ ProxyVertArray *BKE_pbvh_get_proxyarrays(PBVH *pbvh, PBVHNode *node)
 }
 
 #endif
+
+/* checks if pbvh needs to sync its flat vcol shading flag with scene tool settings
+   scene and ob are allowd to be NULL (in which case nothing is done).
+*/
+void SCULPT_update_flat_vcol_shading(Object *ob, Scene *scene)
+{
+  if (!scene || !ob || !ob->sculpt || !ob->sculpt->pbvh) {
+    return;
+  }
+
+  if (ob->sculpt->pbvh) {
+    bool flat_vcol_shading = ((scene->toolsettings->sculpt->flags &
+                               SCULPT_DYNTOPO_FLAT_VCOL_SHADING) != 0);
+
+    BKE_pbvh_set_flat_vcol_shading(ob->sculpt->pbvh, flat_vcol_shading);
+  }
+}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index d9a07ca71b0..c97e29184fd 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1408,7 +1408,7 @@ void SCULPT_floodfill_add_initial_with_symmetry(Sculpt *sd,
                                                 Object *ob,
                                                 SculptSession *ss,
                                                 SculptFloodFill *flood,
-                                                SculptVertRef index,
+                                                SculptVertRef vertex,
                                                 float radius)
 {
   /* Add active vertex and symmetric vertices to the queue. */
@@ -8703,22 +8703,6 @@ static bool sculpt_no_multires_poll(bContext *C)
   return false;
 }
 
-/* checks if pbvh needs to sync its flat vcol shading flag with scene tool settings
-   scene and ob are allowd to be NULL (in which case nothing is done).
-*/
-void SCULPT_update_flat_vcol_shading(Object *ob, Scene *scene)
-{
-  if (!scene || !ob || !ob->sculpt || !ob->sculpt->pbvh) {
-    return;
-  }
-
-  if (ob->sculpt->pbvh) {
-    bool flat_vcol_shading = ((scene->toolsettings->sculpt->flags &
-                               SCULPT_DYNTOPO_FLAT_VCOL_SHADING) != 0);
-
-    BKE_pbvh_set_flat_vcol_shading(ob->sculpt->pbvh, flat_vcol_shading);
-  }
-}
 static int sculpt_symmetrize_exec(bContext *C, wmOperator *op)
 {
   Main *bmain = CTX_data_main(C);
diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c b/source/blender/editors/sculpt_paint/sculpt_detail.c
index 1f115aa26ba..2e313daec0c 100644
--- a/source/blender/editors/sculpt_paint/sculpt_detail.c
+++ b/source/blender/editors/sculpt_paint/sculpt_detail.c
@@ -569,14 +569,14 @@ static void dyntopo_detail_size_sample_from_surface(Object *ob,
                                                     DyntopoDetailSizeEditCustomData *cd)
 {
   SculptSession *ss = ob->sculpt;
-  const int active_vertex = SCULPT_active_vertex_get(ss);
+  const SculptVertRef active_vertex = SCULPT_active_vertex_get(ss);
 
   float len_accum = 0;
   int num_neighbors = 0;
   SculptVertexNeighborIter ni;
   SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, active_vertex, ni) {
     len_accum += len_v3v3(SCULPT_vertex_co_get(ss, active_vertex),
-                          SCULPT_vertex_co_get(ss, ni.index));
+                          SCULPT_vertex_co_get(ss, ni.vertex));
     num_neighbors++;
   }
   SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 9f23af524ed..583f56cc920 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -414,9 +414,8 @@ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss,
  * Utility function to get the closet vertex after flipping an original vertex position based on
  * an symmetry pass iteration index.
  */
-static SculptVertRef sculpt_expand_get_vertex_index_for_symmetry_pass(Object *ob,
-                                                            const char symm_it,
-                                                            const SculptVertRef original_vertex)
+static SculptVertRef sculpt_expand_get_vertex_index_for_symmetry_pass(
+    Object *ob, const char symm_it, const SculptVertRef original_vertex)
 {
   SculptSession *ss = ob->sculpt;
   SculptVertRef symm_vertex = {SCULPT_EXPAND_VERTEX_NONE};
@@ -436,7 +435,7 @@ static SculptVertRef sculpt_expand_get_vertex_index_for_symmetry_pass(Object *ob
  * Geodesic: Initializes the falloff with geodesic distances from the given active vertex, taking
  * symmetry into account.
  */
-static float *sculpt_expand_geodesic_falloff_create(Sculpt *sd, Object *ob, const int v)
+static float *sculpt_expand_geodesic_falloff_create(Sculpt *sd, Object *ob, const SculptVertRef v)
 {
   return SCULPT_geodesic_from_vertex_and_symm(sd, ob, v, FLT_MAX);
 }
@@ -507,7 +506,7 @@ static bool mask_expand_normal_floodfill_cb(
     const float from_edge_factor = data->edge_factor[from_v_i];
     data->edge_factor[to_v_i] = dot_v3v3(current_normal, prev_normal) * from_edge_factor;
     data->dists[to_v_i] = dot_v3v3(data->original_normal, current_normal) *
-                        powf(from_edge_factor, data->edge_sensitivity);
+                          powf(from_edge_factor, data->edge_sensitivity);
     CLAMP(data->dists[to_v_i], 0.0f, 1.0f);
   }
   else {
@@ -583,11 +582,14 @@ static float *sculpt_expand_spherical_falloff_create(Object *ob, const SculptVer
     if (!SCULPT_is_symmetry_iteration_valid(symm_it, symm)) {
       continue;
     }
-    const int symm_vertex = sculpt_expand_get_vertex_index_for_symmetry_pass(ob, symm_it, v);
-    if (symm_vertex != -1) {
+    const SculptVertRef symm_vertex = sculpt_expand_get_vertex_index_for_symmetry_pass(
+        ob, symm_it, v);
+    if (symm_vertex.i != -1) {
       const float *co = SCULPT_vertex_co_get(ss, symm_vertex);
       for (int i = 0; i < totvert; i++) {
-        dists[i] = min_ff(dists[i], len_v3v3(co, SCULPT_vertex_co_get(ss, BKE_pbvh_table_index_to_vertex(ss->pbvh, i))));
+        dists[i] = min_ff(
+            dists[i],
+            len_v3v3(co, SCULPT_vertex_co_get(ss, BKE_pbvh_table_index_to_vertex(ss->pbvh, i))));
       }
     }
   }
@@ -615,7 +617,8 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const S
       continue;
     }
 
-    const SculptVertRef symm_vertex = sculpt_expand_get_vertex_index_for_symmetry_pass(ob, symm_it, v);
+    const SculptVertRef symm_vertex = sculpt_expand_get_vertex_index_for_symmetry_pass(
+        ob, symm_it, v);
 
     SculptBoundary *boundary = SCULPT_boundary_data_init(ob, NULL, symm_vertex, FLT_MAX);
     if (!boundary) {
@@ -624,7 +627,7 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const S
 
     for (int i = 0; i < boundary->num_vertices; i++) {
       BLI_gsqueue_push(queue, &boundary->vertices[i]);
-      BLI_BITMAP_ENABLE(visited_vertices, boundary->vertices[i]);
+      BLI_BITMAP_ENABLE(visited_vertices, BKE_pbvh_vertex_index_to_table(ss->pbvh, boundary->vertices[i]));
     }
     SCULPT_boundary_data_free(boundary);
   }
@@ -686,10 +689,11 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const SculptVer
       continue;
     }
 
-    const SculptVertRef symm_vertex = sculpt_expand_get_vertex_index_for_symmetry_pass(ob, symm_it, v);
+    const SculptVertRef symm_vertex = sculpt_expand_get_vertex_index_for_symmetry_pass(
+        ob, symm_it, v);
 
     BLI_gsqueue_push(queue, &symm_vertex);
-    BLI_BITMAP_ENABLE(visited_vertices, symm_vertex);
+    BLI_BITMAP_ENABLE(visited_vertices, BKE_pbvh_vertex_index_to_table(ss->pbvh, symm_vertex));
   }
 
   if (BLI_gsqueue_is_empty(queue)) {
@@ -712,7 +716,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const SculptVer
         if (BLI_BITMAP_TEST(visited_vertices, neighbor_v)) {
           continue;
         }
-        
+
         dists[neighbor_v] = dists[v_next_i] + 1.0f;
         BLI_BITMAP_ENABLE(visited_vertices, neighbor_v);
         BLI_gsqueue_push(queue, &neighbor_v);
@@ -1019,7 +1023,7 @@ static void sculpt_expand_falloff_factors_from_vertex_and_symm_create(
     ExpandCache *expand_cache,
     Sculpt *sd,
     Object *ob,
-    const int v,
+    const SculptVertRef v,
     eSculptExpandFalloffType falloff_type)
 {
   MEM_SAFE_FREE(expand_cache->vert_falloff);
@@ -1406,14 +1410,16 @@ static void sculpt_expand_original_state_store(Object *ob, ExpandCache *expand_c
   if (expand_cache->target == SCULPT_EXPAND_TARGET_MASK) {
     expand_cache->original_mask = MEM_malloc_arrayN(totvert, sizeof(fl

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list