Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_ops.c
| Show All 11 Lines | |||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_editmesh.h" | #include "BKE_editmesh.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_layer.h" | |||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| false, | false, | ||||
| "Overwrite Previous", | "Overwrite Previous", | ||||
| "Overwrite previously created orientation with same name"); | "Overwrite previously created orientation with same name"); | ||||
| } | } | ||||
| #ifdef USE_LOOPSLIDE_HACK | #ifdef USE_LOOPSLIDE_HACK | ||||
| /** | /** | ||||
| * Special hack for MESH_OT_loopcut_slide so we get back to the selection mode | * Special hack for MESH_OT_loopcut_slide so we get back to the selection mode | ||||
| * Do this for all meshes in multi-object editmode so their selectmode is in sync for following | |||||
| * operators | |||||
| */ | */ | ||||
| static void transformops_loopsel_hack(bContext *C, wmOperator *op) | static void transformops_loopsel_hack(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| if (op->type->idname == OP_EDGE_SLIDE) { | if (op->type->idname == OP_EDGE_SLIDE) { | ||||
| if (op->opm && op->opm->opm && op->opm->opm->prev) { | if (op->opm && op->opm->opm && op->opm->opm->prev) { | ||||
| wmOperator *op_prev = op->opm->opm->prev; | wmOperator *op_prev = op->opm->opm->prev; | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| bool mesh_select_mode[3]; | bool mesh_select_mode[3]; | ||||
| PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init"); | PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init"); | ||||
| if (prop && RNA_property_is_set(op_prev->ptr, prop)) { | if (prop && RNA_property_is_set(op_prev->ptr, prop)) { | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| short selectmode_orig; | short selectmode_orig; | ||||
| RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode); | RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode); | ||||
| selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) | | selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) | | ||||
| (mesh_select_mode[1] ? SCE_SELECT_EDGE : 0) | | (mesh_select_mode[1] ? SCE_SELECT_EDGE : 0) | | ||||
| (mesh_select_mode[2] ? SCE_SELECT_FACE : 0)); | (mesh_select_mode[2] ? SCE_SELECT_FACE : 0)); | ||||
| /* still switch if we were originally in face select mode */ | /* Still switch if we were originally in face select mode. */ | ||||
| if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) { | if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) { | ||||
| Object *obedit = CTX_data_edit_object(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| BMEditMesh *em = BKE_editmesh_from_object(obedit); | View3D *v3d = CTX_wm_view3d(C); | ||||
| em->selectmode = ts->selectmode = selectmode_orig; | uint bases_len; | ||||
| EDBM_selectmode_set(em); | Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(view_layer, v3d, &bases_len); | ||||
| for (uint base_index = 0; base_index < bases_len; base_index++) { | |||||
| Object *ob_iter = bases[base_index]->object; | |||||
| BMEditMesh *em = BKE_editmesh_from_object(ob_iter); | |||||
| em->selectmode = ts->selectmode = selectmode_orig; | |||||
| EDBM_selectmode_set(em); | |||||
| } | |||||
| MEM_freeN(bases); | |||||
campbellbarton: Again, would think that `EDBM_selectmode_set_multi` could be used here instead. | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| #else | #else | ||||
| /* prevent removal by cleanup */ | /* prevent removal by cleanup */ | ||||
| # error "loopslide hack removed!" | # error "loopslide hack removed!" | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||
Again, would think that EDBM_selectmode_set_multi could be used here instead.