diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 20 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 41 |
3 files changed, 63 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index aa9178ee3fc..65217e09259 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -308,6 +308,8 @@ bool ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int mva #define ED_MESH_PICK_DEFAULT_VERT_SIZE 50 #define ED_MESH_PICK_DEFAULT_FACE_SIZE 3 +#define USE_LOOPSLIDE_HACK + #ifdef __cplusplus } #endif diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index bfd94a2ecf4..a126546c81c 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -445,6 +445,21 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event) loopcut_update_edge(lcd, e, 0); } +#ifdef USE_LOOPSLIDE_HACK + /* for use in macro so we can restore, HACK */ + { + Scene *scene = CTX_data_scene(C); + ToolSettings *settings = scene->toolsettings; + int mesh_select_mode[3] = { + (settings->selectmode & SCE_SELECT_VERTEX) != 0, + (settings->selectmode & SCE_SELECT_EDGE) != 0, + (settings->selectmode & SCE_SELECT_FACE) != 0, + }; + + RNA_boolean_set_array(op->ptr, "mesh_select_mode_init", mesh_select_mode); + } +#endif + if (is_interactive) { ScrArea *sa = CTX_wm_area(C); ED_area_headerprint(sa, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, " @@ -660,4 +675,9 @@ void MESH_OT_loopcut(wmOperatorType *ot) prop = RNA_def_int(ot->srna, "edge_index", -1, -1, INT_MAX, "Number of Cuts", "", 0, INT_MAX); RNA_def_property_flag(prop, PROP_HIDDEN); + +#ifdef USE_LOOPSLIDE_HACK + prop = RNA_def_boolean_array(ot->srna, "mesh_select_mode_init", 3, NULL, "", ""); + RNA_def_property_flag(prop, PROP_HIDDEN); +#endif } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index e2668416cfc..9e7545dee64 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -50,6 +50,7 @@ #include "UI_resources.h" #include "ED_screen.h" +#include "ED_mesh.h" #include "transform.h" @@ -289,8 +290,48 @@ static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot) "Overwrite previously created orientation with same name"); } + +#ifdef USE_LOOPSLIDE_HACK +/** + * Special hack for MESH_OT_loopcut_slide so we get back to the selection mode + */ +static void transformops_loopsel_hack(bContext *C, wmOperator *op) +{ + if (op->type->idname == OP_EDGE_SLIDE) { + if (op->opm && op->opm->opm && op->opm->opm->prev) { + wmOperator *op_prev = op->opm->opm->prev; + Scene *scene = CTX_data_scene(C); + int mesh_select_mode[3]; + PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init"); + + if (RNA_property_is_set(op_prev->ptr, prop)) { + ToolSettings *ts = scene->toolsettings; + short selectmode_orig; + + RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode); + selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) | + (mesh_select_mode[1] ? SCE_SELECT_EDGE : 0) | + (mesh_select_mode[2] ? SCE_SELECT_FACE : 0)); + + /* still switch if we were originally in face select mode */ + if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) { + BMEditMesh *em = BKE_editmesh_from_object(scene->obedit); + em->selectmode = ts->selectmode = selectmode_orig; + EDBM_selectmode_set(em); + } + } + } + } +} +#endif /* USE_LOOPSLIDE_HACK */ + + static void transformops_exit(bContext *C, wmOperator *op) { +#ifdef USE_LOOPSLIDE_HACK + transformops_loopsel_hack(C, op); +#endif + saveTransform(C, op->customdata, op); MEM_freeN(op->customdata); op->customdata = NULL; |