diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-28 21:13:09 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-28 21:13:09 +0400 |
commit | 77e0709e48a067b765bd79382e202aa7a781d65a (patch) | |
tree | 73e9a3bd4768b8f9f98e3470e645b3a5cbfbacdf /source/blender/editors/object | |
parent | e5ff9cced440708c34a48a274cc8dc24ff3b2d49 (diff) |
Fix #35551: the topology mirror setting affected shape key and vertex group but
this was confusing as there was no setting visible for it. Now these menus
contain an entry to mirror without and with topology mirror.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_shapekey.c | 11 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 18 |
2 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 8fead6024fb..ea96db514b2 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -168,7 +168,7 @@ static bool ED_object_shape_key_remove(Main *bmain, Object *ob) } static bool object_shape_key_mirror(bContext *C, Object *ob, - int *r_totmirr, int *r_totfail) + int *r_totmirr, int *r_totfail, bool use_topology) { KeyBlock *kb; Key *key; @@ -196,7 +196,7 @@ static bool object_shape_key_mirror(bContext *C, Object *ob, mesh_octree_table(ob, NULL, NULL, 's'); for (i1 = 0, mv = me->mvert; i1 < me->totvert; i1++, mv++) { - i2 = mesh_get_x_mirror_vert(ob, i1); + i2 = mesh_get_x_mirror_vert(ob, i1, use_topology); if (i2 == i1) { fp1 = ((float *)kb->data) + i1 * 3; fp1[0] = -fp1[0]; @@ -440,8 +440,9 @@ static int shape_key_mirror_exec(bContext *C, wmOperator *op) { Object *ob = ED_object_context(C); int totmirr = 0, totfail = 0; + bool use_topology = RNA_boolean_get(op->ptr, "use_topology"); - if (!object_shape_key_mirror(C, ob, &totmirr, &totfail)) + if (!object_shape_key_mirror(C, ob, &totmirr, &totfail, use_topology)) return OPERATOR_CANCELLED; ED_mesh_report_mirror(op, totmirr, totfail); @@ -462,6 +463,10 @@ void OBJECT_OT_shape_key_mirror(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* properties */ + RNA_def_boolean(ot->srna, "use_topology", 0, "Topology Mirror", + "Use topology based mirroring (for when both sides of mesh have matching, unique topology)"); } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index c2a352eaea8..14829569c25 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -438,8 +438,9 @@ static void ED_mesh_defvert_mirror_update_em(Object *ob, BMVert *eve, int def_nr Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; BMVert *eve_mirr; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; - eve_mirr = editbmesh_get_x_mirror_vert(ob, em, eve, eve->co, vidx); + eve_mirr = editbmesh_get_x_mirror_vert(ob, em, eve, eve->co, vidx, use_topology); if (eve_mirr && eve_mirr != eve) { MDeformVert *dvert_src = BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset); @@ -452,10 +453,12 @@ static void ED_mesh_defvert_mirror_update_ob(Object *ob, int def_nr, int vidx) { int vidx_mirr; Mesh *me = ob->data; + bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; + if (vidx == -1) return; - vidx_mirr = mesh_get_x_mirror_vert(ob, vidx); + vidx_mirr = mesh_get_x_mirror_vert(ob, vidx, use_topology); if ((vidx_mirr) >= 0 && (vidx_mirr != vidx)) { MDeformVert *dvert_src = &me->dvert[vidx]; @@ -2314,7 +2317,8 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr, /* TODO, vgroup locking */ /* TODO, face masking */ void ED_vgroup_mirror(Object *ob, - const bool mirror_weights, const bool flip_vgroups, const bool all_vgroups, + const bool mirror_weights, const bool flip_vgroups, + const bool all_vgroups, const bool use_topology, int *r_totmirr, int *r_totfail) { @@ -2371,7 +2375,7 @@ void ED_vgroup_mirror(Object *ob, goto cleanup; } - EDBM_verts_mirror_cache_begin(em, 0, true, false); + EDBM_verts_mirror_cache_begin(em, 0, true, false, use_topology); /* Go through the list of editverts and assign them */ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { @@ -2420,7 +2424,7 @@ void ED_vgroup_mirror(Object *ob, for (vidx = 0, mv = me->mvert; vidx < me->totvert; vidx++, mv++) { if ((mv->flag & ME_VERT_TMP_TAG) == 0) { - if ((vidx_mirr = mesh_get_x_mirror_vert(ob, vidx)) != -1) { + if ((vidx_mirr = mesh_get_x_mirror_vert(ob, vidx, use_topology)) != -1) { if (vidx != vidx_mirr) { mv_mirr = &me->mvert[vidx_mirr]; if ((mv_mirr->flag & ME_VERT_TMP_TAG) == 0) { @@ -3623,6 +3627,7 @@ static int vertex_group_mirror_exec(bContext *C, wmOperator *op) RNA_boolean_get(op->ptr, "mirror_weights"), RNA_boolean_get(op->ptr, "flip_group_names"), RNA_boolean_get(op->ptr, "all_groups"), + RNA_boolean_get(op->ptr, "use_topology"), &totmirr, &totfail); ED_mesh_report_mirror(op, totmirr, totfail); @@ -3653,7 +3658,8 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot) RNA_def_boolean(ot->srna, "mirror_weights", true, "Mirror Weights", "Mirror weights"); RNA_def_boolean(ot->srna, "flip_group_names", true, "Flip Group Names", "Flip vertex group names"); RNA_def_boolean(ot->srna, "all_groups", false, "All Groups", "Mirror all vertex groups weights"); - + RNA_def_boolean(ot->srna, "use_topology", 0, "Topology Mirror", + "Use topology based mirroring (for when both sides of mesh have matching, unique topology)"); } static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op)) |