[Bf-blender-cvs] [748efc710cf] master: Fix (unreported) Smart UV Project not adding UVMap

Philipp Oeser noreply at git.blender.org
Thu Sep 24 13:07:43 CEST 2020


Commit: 748efc710cfe9835a9b474bb4a1569b42ad94b7f
Author: Philipp Oeser
Date:   Thu Sep 24 12:21:18 2020 +0200
Branches: master
https://developer.blender.org/rB748efc710cfe9835a9b474bb4a1569b42ad94b7f

Fix (unreported) Smart UV Project not adding UVMap

Since porting this to C in rB850234c1b10a, Smart UV Project would not
add a UVMap (if none existed already) anymore.

Not having a UVMap already is a reasonable situation though when e.g.
starting off fresh by deleting an existing UVMap or also when applying
certain generative modifiers. This is also inconsistent with all other
unwrap operators (all of them will create a UVMap if none exists
already)

Differential Revision: https://developer.blender.org/D9001

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

M	source/blender/editors/uvedit/uvedit_unwrap_ops.c

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

diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index f043dc92624..e4c0fd86377 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -2017,7 +2017,7 @@ static int smart_project_exec(bContext *C, wmOperator *op)
   MemArena *arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
 
   uint objects_len = 0;
-  Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
+  Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
       view_layer, v3d, &objects_len);
 
   Object **objects_changed = MEM_mallocN(sizeof(*objects_changed) * objects_len, __func__);
@@ -2032,6 +2032,10 @@ static int smart_project_exec(bContext *C, wmOperator *op)
     BMEditMesh *em = BKE_editmesh_from_object(obedit);
     bool changed = false;
 
+    if (!ED_uvedit_ensure_uvs(obedit)) {
+      continue;
+    }
+
     const uint cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
     ThickFace *thick_faces = MEM_mallocN(sizeof(*thick_faces) * em->bm->totface, __func__);



More information about the Bf-blender-cvs mailing list