From 637387b8ac81d74167aeae0a47b9ac1264c2ea05 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 15 Apr 2012 09:20:42 +0000 Subject: Fix #30949: live unwrap when marking seams did not work with bmesh. --- source/blender/editors/include/ED_uvedit.h | 2 ++ source/blender/editors/mesh/editmesh_select.c | 2 ++ source/blender/editors/mesh/editmesh_tools.c | 7 +++++-- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 12 +++++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index f122987b4e1..dfdbb1969cf 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -78,6 +78,8 @@ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit); void ED_uvedit_live_unwrap_re_solve(void); void ED_uvedit_live_unwrap_end(short cancel); +void ED_uvedit_live_unwrap(struct Scene *scene, struct Object *obedit); + /* single call up unwrap using scene settings, used for edge tag unwrapping */ void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 355d64a9fe1..e40f068ee59 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -56,6 +56,7 @@ #include "ED_mesh.h" #include "ED_screen.h" +#include "ED_uvedit.h" #include "ED_view3d.h" #include "BIF_gl.h" @@ -1399,6 +1400,7 @@ static void mouse_mesh_shortest_path(bContext *C, int mval[2]) case EDGE_MODE_TAG_SEAM: me->drawflag |= ME_DRAWSEAMS; + ED_uvedit_live_unwrap(vc.scene, vc.obedit); break; case EDGE_MODE_TAG_SHARP: me->drawflag |= ME_DRAWSHARP; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 2c7d43f948e..73027c8fa7e 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -58,10 +58,11 @@ #include "WM_types.h" #include "ED_mesh.h" -#include "ED_view3d.h" +#include "ED_object.h" #include "ED_screen.h" #include "ED_transform.h" -#include "ED_object.h" +#include "ED_uvedit.h" +#include "ED_view3d.h" #include "RE_render_ext.h" @@ -1056,6 +1057,7 @@ void MESH_OT_edge_face_add(wmOperatorType *ot) static int edbm_mark_seam(bContext *C, wmOperator *op) { + Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Mesh *me = ((Mesh *)obedit->data); BMEditMesh *em = BMEdit_FromObject(obedit); @@ -1085,6 +1087,7 @@ static int edbm_mark_seam(bContext *C, wmOperator *op) } } + ED_uvedit_live_unwrap(scene, obedit); EDBM_update_generic(C, em, TRUE); return OPERATOR_FINISHED; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index a3cbcc57a9c..136134a95b0 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -268,7 +268,7 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, BLI_addfilledge(firstv, v); - /*mode 2 enables faster handling of tri/quads*/ + /* mode 2 enables faster handling of tri/quads */ BLI_edgefill(2); for (sefa = fillfacebase.first; sefa; sefa = sefa->next) { ls[0] = sefa->v1->tmp.p; @@ -829,6 +829,16 @@ void ED_uvedit_live_unwrap_end(short cancel) } } +void ED_uvedit_live_unwrap(Scene *scene, Object *obedit) +{ + BMEditMesh *em = BMEdit_FromObject(obedit); + + if (scene->toolsettings->edge_mode_live_unwrap && + CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) { + ED_unwrap_lscm(scene, obedit, FALSE); /* unwrap all not just sel */ + } +} + /*************** UV Map Common Transforms *****************/ #define VIEW_ON_EQUATOR 0 -- cgit v1.2.3