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
This commit is contained in:
Philipp Oeser
2020-09-24 12:21:18 +02:00
parent 5b612e788c
commit 748efc710c

View File

@@ -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__);