[Bf-blender-cvs] [6b31070a949] refactor-mesh-uv-map-generic: Merge branch 'master' into refactor-mesh-uv-map-generic

Martijn Versteegh noreply at git.blender.org
Wed Oct 12 11:37:16 CEST 2022


Commit: 6b31070a949f0f036dadd46d476bc273e35f1d76
Author: Martijn Versteegh
Date:   Wed Oct 12 11:31:45 2022 +0200
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB6b31070a949f0f036dadd46d476bc273e35f1d76

Merge branch 'master' into refactor-mesh-uv-map-generic

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



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

diff --cc source/blender/blenkernel/intern/mesh_mapping.cc
index 6544d5eaa2a,667802d5f48..5269fd64f33
--- a/source/blender/blenkernel/intern/mesh_mapping.cc
+++ b/source/blender/blenkernel/intern/mesh_mapping.cc
@@@ -120,8 -120,8 +120,8 @@@ UvVertMap *BKE_mesh_uv_vert_map_create(
        v->next = newvlist;
        newvlist = v;
  
 -      uv = mloopuv[mpoly[v->poly_index].loopstart + v->loop_of_poly_index].uv;
 +      uv = mloopuv[mpoly[v->poly_index].loopstart + v->loop_of_poly_index];
-       lastv = NULL;
+       lastv = nullptr;
        iterv = vlist;
  
        while (iterv) {
@@@ -1029,10 -1029,10 +1029,10 @@@ static bool mesh_calc_islands_loop_poly
                                             const int totpoly,
                                             const MLoop *loops,
                                             const int totloop,
 -                                           const MLoopUV *luvs,
 +                                           const float (*luvs)[2],
                                             MeshIslandStore *r_island_store)
  {
-   int *poly_groups = NULL;
+   int *poly_groups = nullptr;
    int num_poly_groups;
  
    /* map vars */
@@@ -1193,10 -1193,10 +1193,10 @@@ bool BKE_mesh_calc_islands_loop_poly_uv
                                             const int totpoly,
                                             MLoop *loops,
                                             const int totloop,
 -                                           const MLoopUV *luvs,
 +                                           const float (*luvs)[2],
                                             MeshIslandStore *r_island_store)
  {
-   BLI_assert(luvs != NULL);
+   BLI_assert(luvs != nullptr);
    return mesh_calc_islands_loop_poly_uv(
        verts, totvert, edges, totedge, polys, totpoly, loops, totloop, luvs, r_island_store);
  }
diff --cc source/blender/blenkernel/intern/mesh_tangent.cc
index ece353c62b0,1162986aaf5..9964f217830
--- a/source/blender/blenkernel/intern/mesh_tangent.cc
+++ b/source/blender/blenkernel/intern/mesh_tangent.cc
@@@ -224,15 -221,13 +224,13 @@@ struct SGLSLMeshToTangent 
      const MLoopTri *lt;
      uint loop_index = GetLoop(face_num, vert_num, lt);
      if (mloopuv != nullptr) {
 -      const float *uv = mloopuv[loop_index].uv;
 +      const float2 &uv = mloopuv[loop_index];
        return mikk::float3(uv[0], uv[1], 1.0f);
      }
-     else {
-       const float *l_orco = orco[mloop[loop_index].v];
-       float u, v;
-       map_to_sphere(&u, &v, l_orco[0], l_orco[1], l_orco[2]);
-       return mikk::float3(u, v, 1.0f);
-     }
+     const float *l_orco = orco[mloop[loop_index].v];
+     float u, v;
+     map_to_sphere(&u, &v, l_orco[0], l_orco[1], l_orco[2]);
+     return mikk::float3(u, v, 1.0f);
    }
  
    mikk::float3 GetNormal(const uint face_num, const uint vert_num)
diff --cc source/blender/blenkernel/intern/object_dupli.cc
index c65627dce81,306e508dc83..570b14bdd45
--- a/source/blender/blenkernel/intern/object_dupli.cc
+++ b/source/blender/blenkernel/intern/object_dupli.cc
@@@ -56,11 -57,15 +57,16 @@@
  #include "DEG_depsgraph_query.h"
  
  #include "BLI_hash.h"
+ #include "DNA_world_types.h"
  
  #include "NOD_geometry_nodes_log.hh"
+ #include "RNA_access.h"
+ #include "RNA_path.h"
+ #include "RNA_prototypes.h"
+ #include "RNA_types.h"
  
  using blender::Array;
 +using blender::float2;
  using blender::float3;
  using blender::float4x4;
  using blender::Span;
diff --cc source/blender/editors/mesh/editmesh_select.cc
index db30f9de336,0d1e3c08d84..aab3b7b1da3
--- a/source/blender/editors/mesh/editmesh_select.cc
+++ b/source/blender/editors/mesh/editmesh_select.cc
@@@ -3208,10 -3215,10 +3215,10 @@@ static void select_linked_delimit_valid
  
  static void select_linked_delimit_begin(BMesh *bm, int delimit)
  {
-   struct DelimitData delimit_data = {0};
+   DelimitData delimit_data = {0};
  
    if (delimit & BMO_DELIM_UV) {
 -    delimit_data.cd_loop_type = CD_MLOOPUV;
 +    delimit_data.cd_loop_type = CD_PROP_FLOAT2;
      delimit_data.cd_loop_offset = CustomData_get_offset(&bm->ldata, delimit_data.cd_loop_type);
      if (delimit_data.cd_loop_offset == -1) {
        delimit &= ~BMO_DELIM_UV;
diff --cc source/blender/editors/uvedit/uvedit_islands.cc
index 5b2bc19d6d0,2648ec5e2f6..aeb3ffec325
--- a/source/blender/editors/uvedit/uvedit_islands.cc
+++ b/source/blender/editors/uvedit/uvedit_islands.cc
@@@ -157,17 -148,13 +146,13 @@@ static float (*bm_face_array_calc_uniqu
    return coords;
  }
  
- /**
-  * \param align_to_axis:
-  * - -1: don't align to an axis.
-  * -  0: align horizontally.
-  * -  1: align vertically.
-  */
- static void bm_face_array_uv_rotate_fit_aabb(BMFace **faces,
-                                              int faces_len,
-                                              int align_to_axis,
-                                              const int cd_loop_uv_offset)
+ static void face_island_uv_rotate_fit_aabb(FaceIsland *island)
  {
+   BMFace **faces = island->faces;
+   const int faces_len = island->faces_len;
+   const float aspect_y = island->aspect_y;
 -  const int cd_loop_uv_offset = island->cd_loop_uv_offset;
++  const int cd_loop_uv_offset = island->offsets.uv;
+ 
    /* Calculate unique coordinates since calculating a convex hull can be an expensive operation. */
    int coords_len;
    float(*coords)[2] = bm_face_array_calc_unique_uv_coords(
diff --cc source/blender/editors/uvedit/uvedit_path.c
index 0ea69c453ff,78436d17203..248f97392ae
--- a/source/blender/editors/uvedit/uvedit_path.c
+++ b/source/blender/editors/uvedit/uvedit_path.c
@@@ -610,8 -628,8 +610,8 @@@ static int uv_shortest_path_pick_invoke
      else {
        l_src = ED_uvedit_active_edge_loop_get(bm);
        if (l_src != NULL) {
-         if ((!uvedit_uv_select_test(scene, l_src, offsets)) &&
-             (!uvedit_uv_select_test(scene, l_src->next, offsets))) {
 -        if (!uvedit_uv_select_test(scene, l_src, cd_loop_uv_offset) &&
 -            !uvedit_uv_select_test(scene, l_src->next, cd_loop_uv_offset)) {
++        if (!uvedit_uv_select_test(scene, l_src, offsets) &&
++            !uvedit_uv_select_test(scene, l_src->next, offsets)) {
            l_src = NULL;
          }
          ele_src = (BMElem *)l_src;
diff --cc source/blender/editors/uvedit/uvedit_select.c
index f2e18d69e6e,7dd223a9252..aa87aa9e5e5
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@@ -225,10 -225,10 +225,10 @@@ bool uvedit_face_visible_test(const Sce
    return uvedit_face_visible_test_ex(scene->toolsettings, efa);
  }
  
 -bool uvedit_face_select_test_ex(const ToolSettings *ts, BMFace *efa, const int cd_loop_uv_offset)
 +bool uvedit_face_select_test_ex(const ToolSettings *ts, BMFace *efa, const BMUVOffsets offsets)
  {
    if (ts->uv_flag & UV_SYNC_SELECTION) {
-     return (BM_elem_flag_test(efa, BM_ELEM_SELECT));
+     return BM_elem_flag_test(efa, BM_ELEM_SELECT);
    }
  
    BMLoop *l;
@@@ -1490,13 -1546,10 +1490,13 @@@ static int uv_select_edgeloop(Scene *sc
    BMEditMesh *em = BKE_editmesh_from_object(obedit);
    bool select;
  
 -  const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
 +  const char *active_uv_name = CustomData_get_active_layer_name(&em->bm->ldata, CD_PROP_FLOAT2);
 +  BM_uv_map_ensure_vert_selection_attribute(em->bm, active_uv_name);
 +  BM_uv_map_ensure_edge_selection_attribute(em->bm, active_uv_name);
 +  const BMUVOffsets offsets = BM_uv_map_get_offsets(em->bm);
  
    if (extend) {
-     select = !(uvedit_edge_select_test(scene, hit->l, offsets));
 -    select = !uvedit_edge_select_test(scene, hit->l, cd_loop_uv_offset);
++    select = !uvedit_edge_select_test(scene, hit->l, offsets);
    }
    else {
      select = true;
@@@ -1588,7 -1641,7 +1588,7 @@@ static int uv_select_faceloop(Scene *sc
    BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, false);
  
    if (extend) {
-     select = !(uvedit_face_select_test(scene, hit->l->f, offsets));
 -    select = !uvedit_face_select_test(scene, hit->l->f, cd_loop_uv_offset);
++    select = !uvedit_face_select_test(scene, hit->l->f, offsets);
    }
    else {
      select = true;
@@@ -1660,7 -1710,7 +1660,7 @@@ static int uv_select_edgering(Scene *sc
    BM_mesh_elem_hflag_disable_all(em->bm, BM_EDGE, BM_ELEM_TAG, false);
  
    if (extend) {
-     select = !(uvedit_edge_select_test(scene, hit->l, offsets));
 -    select = !uvedit_edge_select_test(scene, hit->l, cd_loop_uv_offset);
++    select = !uvedit_edge_select_test(scene, hit->l, offsets);
    }
    else {
      select = true;
@@@ -3600,12 -3635,12 +3600,12 @@@ static int uv_box_select_exec(bContext 
          }
          bool has_selected = false;
          BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 -          luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
 -          if (select != uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
 +          luv = BM_ELEM_CD_GET_FLOAT_P(l, offsets.uv);
-           if ((select) != (uvedit_uv_select_test(scene, l, offsets))) {
++          if (select != uvedit_uv_select_test(scene, l, offsets)) {
              if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION)) {
                /* UV_SYNC_SELECTION - can't do pinned selection */
 -              if (BLI_rctf_isect_pt_v(&rectf, luv->uv)) {
 -                uvedit_uv_select_set(scene, em->bm, l, select, false, cd_loop_uv_offset);
 +              if (BLI_rctf_isect_pt_v(&rectf, luv)) {
 +                uvedit_uv_select_set(scene, em->bm, l, select, false, offsets);
                  BM_elem_flag_enable(l->v, BM_ELEM_TAG);
                  has_selected = true;
                }
@@@ -3823,11 -3856,11 +3823,11 @@@ static int uv_circle_select_exec(bConte
          }
          bool has_selected = false;
          BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
-           if ((select) != (uvedit_uv_select_test(scene, l, offsets))) {
 -          if (select != uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
 -            luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
 -            if (uv_circle_select_is_point_inside(luv->uv, offset, ellipse)) {
++          if (select != uvedit_uv_select_test(scene,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list