diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-12 10:45:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-12 10:46:35 +0300 |
commit | f410e83b2c3cf8a11d5d80ac3751e30d730dd597 (patch) | |
tree | 697a5a334f3e5c95cb157a03ca3d3befc714ec10 /source/blender/editors/uvedit | |
parent | dcc55c89fa19b3e14bd783c00c912f82bac764cd (diff) |
EditMode: multi-object UV reset
D3343 by @Cykyrios
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 74521edf45f..5d40ba733be 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1587,19 +1587,31 @@ void UV_OT_project_from_view(wmOperatorType *ot) static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - Object *obedit = CTX_data_edit_object(C); - Mesh *me = (Mesh *)obedit->data; - /* add uvs if they don't exist yet */ - if (!ED_uvedit_ensure_uvs(C, scene, obedit)) { - return OPERATOR_CANCELLED; - } + ViewLayer *view_layer = CTX_data_view_layer(C); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len); + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + Object *obedit = objects[ob_index]; + Mesh *me = (Mesh *)obedit->data; + BMEditMesh *em = BKE_editmesh_from_object(obedit); + + if (em->bm->totfacesel == 0) { + continue; + } - ED_mesh_uv_loop_reset(C, me); + /* add uvs if they don't exist yet */ + if (!ED_uvedit_ensure_uvs(C, scene, obedit)) { + continue; + } + + ED_mesh_uv_loop_reset(C, me); + + DEG_id_tag_update(obedit->data, 0); + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); + } + MEM_freeN(objects); - DEG_id_tag_update(obedit->data, 0); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - return OPERATOR_FINISHED; } |