Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-09-06 10:18:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-06 10:18:10 +0400
commitafaa67b5b8770a8f02f0501d0f9205e066e91ef9 (patch)
treeb78db721976a5a0ae5e86ad3deb9205cc70f1f5e /source/blender/editors/mesh
parent3bb17bd64ab4d9ab2e69ee487a4be4fc0fa8adb8 (diff)
fix [#32502] Shift + V Vertex slide doesn't work for x-mirror edit
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_slide.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index f08c229d38a..397f224ef2e 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -27,6 +27,7 @@
/* Takes heavily from editmesh_loopcut.c */
#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
#include "MEM_guardedalloc.h"
@@ -99,7 +100,7 @@ typedef struct VertexSlideOp {
} VertexSlideOp;
static void vtx_slide_draw(const bContext *C, ARegion *ar, void *arg);
-static int edbm_vertex_slide_exec(bContext *C, wmOperator *op);
+static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_update);
static void vtx_slide_exit(const bContext *C, wmOperator *op);
static int vtx_slide_set_frame(VertexSlideOp *vso);
@@ -195,16 +196,38 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
VertexSlideOp *vso = op->customdata;
BMEditMesh *em = BMEdit_FromObject(vso->obj);
BMesh *bm = em->bm;
+ BMVert *other = NULL;
+
+ BMVert *mirr_vtx = NULL;
+ BMVert *mirr_vtx_other = NULL;
/* Select new edge */
BM_edge_select_set(bm, vso->sel_edge, TRUE);
- /* Invoke operator */
- edbm_vertex_slide_exec(C, op);
+ if (vso->snap_n_merge) {
+ other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx);
+ }
+
+ if (em->me->editflag & ME_EDIT_MIRROR_X) {
+ EDBM_verts_mirror_cache_begin(em, TRUE);
+
+ mirr_vtx = EDBM_verts_mirror_get(em, vso->start_vtx);
+ if (vso->snap_n_merge) {
+ mirr_vtx_other = EDBM_verts_mirror_get(em, other);
+ }
+ }
+
+ /* Invoke operator - warning */
+ edbm_vertex_slide_exec_ex(C, op, FALSE);
+
+ if (mirr_vtx) {
+ mirr_vtx->co[0] = -vso->start_vtx->co[0];
+ mirr_vtx->co[1] = vso->start_vtx->co[1];
+ mirr_vtx->co[2] = vso->start_vtx->co[2];
+ }
if (vso->snap_n_merge) {
float other_d;
- BMVert *other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx);
other_d = len_v3v3(vso->interp, other->co);
/* Only snap if within threshold */
@@ -213,6 +236,13 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
BM_vert_select_set(bm, vso->start_vtx, TRUE);
EDBM_op_callf(em, op, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, other->co);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
+ if (mirr_vtx_other) {
+ BM_vert_select_set(bm, mirr_vtx, TRUE);
+ BM_vert_select_set(bm, mirr_vtx_other, TRUE);
+ EDBM_op_callf(em, op, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, mirr_vtx_other->co);
+ EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ }
}
else {
/* Store in historty if not merging */
@@ -225,6 +255,10 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
BM_select_history_store(em->bm, vso->start_vtx);
}
+ if (em->me->editflag & ME_EDIT_MIRROR_X) {
+ EDBM_verts_mirror_cache_end(em);
+ }
+
EDBM_selectmode_flush(em);
/* NC_GEOM | ND_DATA & Retess */
@@ -644,7 +678,7 @@ static int edbm_vertex_slide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
}
/* Vertex Slide */
-static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
+static int edbm_vertex_slide_exec_ex(bContext *C, wmOperator *op, const int do_update)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -708,11 +742,17 @@ static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* Update Geometry */
- EDBM_update_generic(C, em, TRUE);
+ if (do_update) {
+ /* Update Geometry */
+ EDBM_update_generic(C, em, TRUE);
+ }
return OPERATOR_FINISHED;
}
+static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
+{
+ return edbm_vertex_slide_exec_ex(C, op, TRUE);
+}
void MESH_OT_vert_slide(wmOperatorType *ot)
{