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

Baardaap noreply at git.blender.org
Sun Dec 11 15:49:24 CET 2022


Commit: 750c5d346a009a6490d360ce1202ce7d9f19efb4
Author: Baardaap
Date:   Sun Dec 11 12:58:43 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB750c5d346a009a6490d360ce1202ce7d9f19efb4

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

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



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

diff --cc source/blender/editors/uvedit/uvedit_islands.cc
index f87ce15d4db,efba43b7ffd..6c96c6a6c26
--- a/source/blender/editors/uvedit/uvedit_islands.cc
+++ b/source/blender/editors/uvedit/uvedit_islands.cc
@@@ -714,19 -716,12 +714,12 @@@ void ED_uvedit_pack_islands_multi(cons
  
    for (int index = 0; index < island_vector.size(); index++) {
      FaceIsland *island = island_vector[index];
-     /* Skip calculation if using specified UDIM option. */
-     if (udim_params && (udim_params->use_target_udim == false)) {
-       float bounds_min[2], bounds_max[2];
-       INIT_MINMAX2(bounds_min, bounds_max);
+     if (closest_udim) {
+       /* Only calculate selection bounding box if using closest_udim. */
        for (int i = 0; i < island->faces_len; i++) {
          BMFace *f = island->faces[i];
-         BM_face_uv_minmax(f, bounds_min, bounds_max, island->offsets.uv);
 -        BM_face_uv_minmax(f, selection_min_co, selection_max_co, island->cd_loop_uv_offset);
++        BM_face_uv_minmax(f, selection_min_co, selection_max_co, island->offsets.uv);
        }
- 
-       selection_min_co[0] = MIN2(bounds_min[0], selection_min_co[0]);
-       selection_min_co[1] = MIN2(bounds_min[1], selection_min_co[1]);
-       selection_max_co[0] = MAX2(bounds_max[0], selection_max_co[0]);
-       selection_max_co[1] = MAX2(bounds_max[1], selection_max_co[1]);
      }
  
      if (params->rotate) {
diff --cc source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index 93d96260347,181180267db..45fc252b378
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@@ -283,33 -285,27 +285,31 @@@ Vector<int> OBJMesh::calc_poly_vertex_i
  
  void OBJMesh::store_uv_coords_and_indices()
  {
-   const StringRef active_uv_name = CustomData_get_active_layer_name(&export_mesh_eval_->ldata,
+   const int totvert = export_mesh_->totvert;
 -  const MLoopUV *mloopuv = static_cast<const MLoopUV *>(
 -      CustomData_get_layer(&export_mesh_->ldata, CD_MLOOPUV));
 -  if (!mloopuv) {
++  const StringRef active_uv_name = CustomData_get_active_layer_name(&export_mesh_->ldata,
 +                                                                    CD_PROP_FLOAT2);
 +  if (active_uv_name.is_empty()) {
      tot_uv_vertices_ = 0;
      return;
    }
-   const Span<MPoly> polys = export_mesh_eval_->polys();
-   const Span<MLoop> loops = export_mesh_eval_->loops();
-   const int totvert = export_mesh_eval_->totvert;
-   const bke::AttributeAccessor attributes = export_mesh_eval_->attributes();
++    const bke::AttributeAccessor attributes = export_mesh_->attributes();
 +  const VArraySpan<float2> uv_map = attributes.lookup<float2>(active_uv_name, ATTR_DOMAIN_CORNER);
 +
    const float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT};
  
 -  UvVertMap *uv_vert_map = BKE_mesh_uv_vert_map_create(mesh_polys_.data(),
 -                                                       nullptr,
 -                                                       nullptr,
 -                                                       mesh_loops_.data(),
 -                                                       mloopuv,
 -                                                       mesh_polys_.size(),
 -                                                       totvert,
 -                                                       limit,
 -                                                       false,
 -                                                       false);
 +  UvVertMap *uv_vert_map = BKE_mesh_uv_vert_map_create(
-       polys.data(),
++      mesh_polys_.data(),
 +      nullptr,
 +      nullptr,
-       loops.data(),
++      mesh_loops_.data(),
 +      reinterpret_cast<const float(*)[2]>(uv_map.data()),
-       polys.size(),
++      mesh_polys_.size(),
 +      totvert,
 +      limit,
 +      false,
 +      false);
  
-   uv_indices_.resize(polys.size());
+   uv_indices_.resize(mesh_polys_.size());
    /* At least total vertices of a mesh will be present in its texture map. So
     * reserve minimum space early. */
    uv_coords_.reserve(totvert);
@@@ -325,8 -321,8 +325,8 @@@
  
        /* Store UV vertex coordinates. */
        uv_coords_.resize(tot_uv_vertices_);
-       const int loopstart = polys[uv_vert->poly_index].loopstart;
+       const int loopstart = mesh_polys_[uv_vert->poly_index].loopstart;
 -      Span<float> vert_uv_coords(mloopuv[loopstart + uv_vert->loop_of_poly_index].uv, 2);
 +      Span<float> vert_uv_coords(uv_map[loopstart + uv_vert->loop_of_poly_index], 2);
        uv_coords_[tot_uv_vertices_ - 1] = float2(vert_uv_coords[0], vert_uv_coords[1]);
  
        /* Store UV vertex indices. */



More information about the Bf-blender-cvs mailing list