diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2020-09-24 13:21:18 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2020-09-24 14:06:37 +0300 |
commit | 748efc710cfe9835a9b474bb4a1569b42ad94b7f (patch) | |
tree | 672a8ccc8aeaa1bf938039e2b25905e74b436f5c | |
parent | 5b612e788ccd9ffc12ff18b7d20d926cc5d147ae (diff) |
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
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 6 |
1 files changed, 5 insertions, 1 deletions
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__); |