From 748efc710cfe9835a9b474bb4a1569b42ad94b7f Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Thu, 24 Sep 2020 12:21:18 +0200 Subject: 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 --- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/editors') 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__); -- cgit v1.2.3