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>2020-10-13 08:51:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-13 08:59:38 +0300
commit211d7ff3cf27db44d961b704d11cda8d26c0e81a (patch)
treeaf6a5075eed69fd371595b79523957acbfaf1bce /source/blender/editors/mesh/editmesh_select.c
parent65965a892fd116267ed94d1c8b59c99589671856 (diff)
Fix T81288:Select Linked fails with multi-object edit mode
Changing options after using select-linked didn't work when the object being selected wasn't the active object.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_select.c')
-rw-r--r--source/blender/editors/mesh/editmesh_select.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 52c109b3854..48405c7f534 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -3572,13 +3572,17 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
edbm_select_linked_pick_ex(em, ele, sel, delimit);
- /* to support redo */
- BM_mesh_elem_index_ensure(bm, ele->head.htype);
- index = EDBM_elem_to_index_any(em, ele);
-
- /* TODO(MULTI_EDIT), index doesn't know which object,
- * index selections isn't very common. */
- RNA_int_set(op->ptr, "index", index);
+ /* To support redo. */
+ {
+ /* Note that the `base_index` can't be used as the index depends on the view-port
+ * which might not be available on redo. */
+ BM_mesh_elem_index_ensure(bm, ele->head.htype);
+ int object_index;
+ index = EDBM_elem_to_index_any_multi(vc.view_layer, em, ele, &object_index);
+ BLI_assert(object_index >= 0);
+ RNA_int_set(op->ptr, "object_index", object_index);
+ RNA_int_set(op->ptr, "index", index);
+ }
DEG_id_tag_update(basact->object->data, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, basact->object->data);
@@ -3589,18 +3593,22 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
static int edbm_select_linked_pick_exec(bContext *C, wmOperator *op)
{
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMesh *bm = em->bm;
- int index;
- const bool sel = !RNA_boolean_get(op->ptr, "deselect");
+ Object *obedit = NULL;
+ BMElem *ele;
+
+ {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ const int object_index = RNA_int_get(op->ptr, "object_index");
+ const int index = RNA_int_get(op->ptr, "index");
+ ele = EDBM_elem_from_index_any_multi(view_layer, object_index, index, &obedit);
+ }
- index = RNA_int_get(op->ptr, "index");
- if (index < 0 || index >= (bm->totvert + bm->totedge + bm->totface)) {
+ if (ele == NULL) {
return OPERATOR_CANCELLED;
}
- BMElem *ele = EDBM_elem_from_index_any(em, index);
+ BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ const bool sel = !RNA_boolean_get(op->ptr, "deselect");
#ifdef USE_LINKED_SELECT_DEFAULT_HACK
int delimit = select_linked_delimit_default_from_op(op, em->selectmode);
@@ -3645,6 +3653,8 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot)
#endif
/* use for redo */
+ prop = RNA_def_int(ot->srna, "object_index", -1, -1, INT_MAX, "", "", 0, INT_MAX);
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
prop = RNA_def_int(ot->srna, "index", -1, -1, INT_MAX, "", "", 0, INT_MAX);
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}