[Bf-blender-cvs] [f6cda6bf889] temp_bmesh_multires: Merge branch 'master' into temp_bmesh_multires

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


Commit: f6cda6bf88919d22ffba47b707c00c9b391d3bb9
Author: Joseph Eagar
Date:   Fri Mar 19 10:57:32 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBf6cda6bf88919d22ffba47b707c00c9b391d3bb9

Merge branch 'master' into temp_bmesh_multires

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



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

diff --cc source/blender/editors/sculpt_paint/paint_mask.c
index 91c8f9fb969,7671f69ee05..79b530b0ba2
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@@ -757,10 -756,9 +756,9 @@@ static void face_set_gesture_apply_task
    PBVHVertexIter vd;
    bool any_updated = false;
  
-   BKE_pbvh_vertex_iter_begin(sgcontext->ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (sgcontext->ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
      if (sculpt_gesture_is_vertex_effected(sgcontext, &vd)) {
 -      SCULPT_vertex_face_set_set(sgcontext->ss, vd.index, face_set_operation->new_face_set_id);
 +      SCULPT_vertex_face_set_set(sgcontext->ss, vd.vertex, face_set_operation->new_face_set_id);
        any_updated = true;
      }
    }
diff --cc source/blender/editors/sculpt_paint/sculpt.c
index 4bb9bcfdc0a,964e5bdaa90..d9a07ca71b0
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@@ -1411,8 -1102,8 +1404,12 @@@ void SCULPT_floodfill_add_and_skip_init
    BLI_BITMAP_ENABLE(flood->visited_vertices, index);
  }
  
--void SCULPT_floodfill_add_initial_with_symmetry(
-     Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, SculptVertRef index, float radius)
 -    Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, int index, float radius)
++void SCULPT_floodfill_add_initial_with_symmetry(Sculpt *sd,
++                                                Object *ob,
++                                                SculptSession *ss,
++                                                SculptFloodFill *flood,
++                                                SculptVertRef index,
++                                                float radius)
  {
    /* Add active vertex and symmetric vertices to the queue. */
    const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
@@@ -3239,10 -2888,9 +3234,8 @@@ typedef struct 
    bool original;
  } SculptFindNearestToRayData;
  
- __attribute__((optnone))  static void do_topology_rake_bmesh_task_cb_ex(
-     void *__restrict userdata,
 -static void do_topology_rake_bmesh_task_cb_ex(void *__restrict userdata,
--                                              const int n,
--                                              const TaskParallelTLS *__restrict tls)
++__attribute__((optnone)) static void do_topology_rake_bmesh_task_cb_ex(
++    void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
  {
    SculptThreadedTaskData *data = userdata;
    SculptSession *ss = data->ob->sculpt;
@@@ -3286,12 -2931,7 +3278,12 @@@
  
      float avg[3], val[3];
  
-     //SculptCurvatureData cdata;
-     //SCULPT_calc_principle_curvatures(ss, vd.vertex, &cdata);
-     //copy_v3_v3(direction2, cdata.principle[0]);
 -    SCULPT_bmesh_four_neighbor_average(avg, direction, vd.bm_vert);
++    // SculptCurvatureData cdata;
++    // SCULPT_calc_principle_curvatures(ss, vd.vertex, &cdata);
++    // copy_v3_v3(direction2, cdata.principle[0]);
 +    copy_v3_v3(direction2, direction);
 +
 +    SCULPT_bmesh_four_neighbor_average(avg, direction2, vd.bm_vert);
  
      sub_v3_v3v3(val, avg, vd.co);
  
@@@ -3575,10 -3212,9 +3564,9 @@@ static void do_displacement_smear_store
    SculptSession *ss = data->ob->sculpt;
  
    PBVHVertexIter vd;
-   BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
      sub_v3_v3v3(ss->cache->prev_displacement[vd.index],
 -                SCULPT_vertex_co_get(ss, vd.index),
 +                SCULPT_vertex_co_get(ss, vd.vertex),
                  ss->cache->limit_surface_co[vd.index]);
    }
    BKE_pbvh_vertex_iter_end;
@@@ -3722,10 -3353,8 +3709,9 @@@ static void do_draw_sharp_brush_task_cb
        ss, &test, data->brush->falloff_shape);
    const int thread_id = BLI_task_parallel_thread_id(tls);
  
-   BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
      SCULPT_orig_vert_data_update(&orig_data, &vd);
 +
      if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
        continue;
      }
@@@ -3806,10 -3435,8 +3792,9 @@@ static void do_topology_slide_task_cb_e
        ss, &test, data->brush->falloff_shape);
    const int thread_id = BLI_task_parallel_thread_id(tls);
  
-   BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
      SCULPT_orig_vert_data_update(&orig_data, &vd);
 +
      if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
        continue;
      }
@@@ -3965,10 -3592,8 +3950,9 @@@ static void do_topology_relax_task_cb_e
        ss, &test, data->brush->falloff_shape);
    const int thread_id = BLI_task_parallel_thread_id(tls);
  
-   BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
      SCULPT_orig_vert_data_update(&orig_data, &vd);
 +
      if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
        continue;
      }
@@@ -5070,14 -4681,7 +5044,13 @@@ static void do_layer_brush_task_cb_ex(v
        ss, &test, data->brush->falloff_shape);
    const int thread_id = BLI_task_parallel_thread_id(tls);
  
 +  bool bmeshpbvh = BKE_pbvh_type(ss->pbvh) == PBVH_BMESH;
 +  if (bmeshpbvh) {
 +    BM_mesh_elem_index_ensure(ss->bm, BM_VERT);
 +    // BM_mesh_elem_table_ensure(ss->bm, BM_VERT);
 +  }
 +
-   BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
      SCULPT_orig_vert_data_update(&orig_data, &vd);
  
      if (!sculpt_brush_test_sq_fn(&test, orig_data.co)) {
@@@ -6763,12 -6301,7 +6726,11 @@@ static void SCULPT_flush_stroke_deform_
  
    PBVHVertexIter vd;
  
 +  if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
 +    BM_mesh_elem_index_ensure(ss->bm, BM_VERT);
 +  }
 +
-   BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
      sculpt_flush_pbvhvert_deform(ob, &vd);
  
      if (!vertCos) {
@@@ -9439,15 -8885,10 +9401,14 @@@ static void do_fake_neighbor_search_tas
    NearestVertexFakeNeighborTLSData *nvtd = tls->userdata_chunk;
    PBVHVertexIter vd;
  
 +  bool has_bmesh = false;
 +
 +  SCULPT_vertex_random_access_ensure(ss);
 +
-   BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
-   {
+   BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
 -    int vd_topology_id = SCULPT_vertex_get_connected_component(ss, vd.index);
 +    int vd_topology_id = SCULPT_vertex_get_connected_component(ss, vd.vertex);
      if (vd_topology_id != nvtd->current_topology_id &&
 -        ss->fake_neighbors.fake_neighbor_index[vd.index] == FAKE_NEIGHBOR_NONE) {
 +        ss->fake_neighbors.fake_neighbor_index[vd.index].i == FAKE_NEIGHBOR_NONE) {
        float distance_squared = len_squared_v3v3(vd.co, data->nearest_vertex_search_co);
        if (distance_squared < nvtd->nearest_vertex_distance_squared &&
            distance_squared < data->max_distance_squared) {
@@@ -9974,335 -9392,6 +9933,338 @@@ static void SCULPT_OT_mask_by_color(wmO
                  1.0f);
  }
  
++#if 0
 +/* -------------------------------------------------------------------- */
 +/** \name Dyntopo Detail Size Edit Operator
 + * \{ */
 +
 +/* Defines how much the mouse movement will modify the detail size value. */
- #define DETAIL_SIZE_DELTA_SPEED 0.08f
- #define DETAIL_SIZE_DELTA_ACCURATE_SPEED 0.004f
++#  define DETAIL_SIZE_DELTA_SPEED 0.08f
++#  define DETAIL_SIZE_DELTA_ACCURATE_SPEED 0.004f
 +
 +typedef struct DyntopoDetailSizeEditCustomData {
 +  void *draw_handle;
 +  Object *active_object;
 +
 +  float init_mval[2];
 +  float accurate_mval[2];
 +
 +  float outline_col[4];
 +
 +  bool accurate_mode;
 +  bool sample_mode;
 +
 +  float init_detail_size;
 +  float accurate_detail_size;
 +  float detail_size;
 +  float radius;
 +
 +  float preview_tri[3][3];
 +  float gizmo_mat[4][4];
 +} DyntopoDetailSizeEditCustomData;
 +
 +static void dyntopo_detail_size_parallel_lines_draw(uint pos3d,
 +                                                    DyntopoDetailSizeEditCustomData *cd,
 +                                                    const float start_co[3],
 +                                                    const float end_co[3],
 +                                                    bool flip,
 +                                                    const float angle)
 +{
 +  float object_space_constant_detail = 1.0f /
 +                                       (cd->detail_size * mat4_to_scale(cd->active_object->obmat));
 +
 +  /* The constant detail represents the maximum edge length allowed before subdividing it. If the
 +   * triangle grid preview is created with this value it will represent an ideal mesh density where
 +   * all edges have the exact maximum length, which never happens in practice. As the minimum edge
 +   * length for dyntopo is 0.4 * max_edge_length, this adjust the detail size to the average
 +   * between max and min edge length so the preview is more accurate. */
 +  object_space_constant_detail *= 0.7f;
 +
 +  const float total_len = len_v3v3(cd->preview_tri[0], cd->preview_tri[1]);
 +  const int tot_lines = (int)(total_len / object_space_constant_detail) + 1;
 +  const float tot_lines_fl = total_len / object_space_constant_detail;
 +  float spacing_disp[3];
 +  sub_v3_v3v3(spacing_disp, end_co, start_co);
 +  normalize_v3(spacing_disp);
 +
 +  float line_disp[3];
 +  rotate_v2_v2fl(line_disp, spacing_disp, DEG2RAD(angle));
 +  mul_v3_fl(spacing_disp, total_len / tot_lines_fl);
 +
 +  immBegin(GPU_PRIM_LINES, (uint)tot_lines * 2);
 +  for (int i = 0; i < tot_lines; i++) {
 +    float line_length;
 +    if (flip) {
 +      line_length = total_len * ((float)i / (float)tot_lines_fl);
 +    }
 +    else {
 +      line_length = total_len * (1.0f - ((float)i / (floa

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list