[Bf-blender-cvs] [e18cf6f9980] newboolean: Interpolate face loop data from example faces.

Howard Trickey noreply at git.blender.org
Fri Jul 24 16:00:21 CEST 2020


Commit: e18cf6f99801ee63fc045bf82b2fe8a002fae1de
Author: Howard Trickey
Date:   Fri Jul 24 09:58:34 2020 -0400
Branches: newboolean
https://developer.blender.org/rBe18cf6f99801ee63fc045bf82b2fe8a002fae1de

Interpolate face loop data from example faces.

This makes for a reasonable first pass at getting OK UV maps.

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

M	source/blender/bmesh/tools/bmesh_boolean.cc

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

diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc
index 85f86ac4a82..ab264e21b12 100644
--- a/source/blender/bmesh/tools/bmesh_boolean.cc
+++ b/source/blender/bmesh/tools/bmesh_boolean.cc
@@ -211,6 +211,7 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, Mesh &m_out)
     else {
       int orig = face.orig;
       BMFace *orig_face;
+      /* There should always be an orig face, but just being extra careful here. */
       if (orig != NO_INDEX) {
         orig_face = old_bmfs[orig];
       }
@@ -234,6 +235,15 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, Mesh &m_out)
       BMFace *bmf = BM_face_create(
           bm, face_bmverts.data(), face_bmedges.data(), flen, orig_face, BM_CREATE_NOP);
       BM_elem_flag_enable(bmf, KEEP_FLAG);
+      /* Now do interpolation of loop data (e.g., UVs) using the example face. */
+      if (orig_face != NULL) {
+        BMIter liter;
+        BMLoop *l = static_cast<BMLoop *>(BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, bmf));
+        while (l != NULL) {
+          BM_loop_interp_from_face(bm, l, orig_face, true, true);
+          l = static_cast<BMLoop *>(BM_iter_step(&liter));
+        }
+      }
       any_change = true;
     }
   }



More information about the Bf-blender-cvs mailing list