Fix #106251: "Shift to extend" doesn't work in 3D View Collections panel

Regression in [0], use shift to initialize the extend option when unset.

[0]: d7dd7403a8
This commit is contained in:
Campbell Barton
2023-03-29 19:57:14 +11:00
parent c0a252b833
commit bb2c89b20d

View File

@@ -469,11 +469,17 @@ void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout)
}
}
static int object_hide_collection_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
static int object_hide_collection_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
/* Immediately execute if collection index was specified. */
int index = RNA_int_get(op->ptr, "collection_index");
if (index != COLLECTION_INVALID_INDEX) {
/* Only initialize extend from the shift key if the property isn't set
* (typically initialized from the key-map). */
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "extend");
if (!RNA_property_is_set(op->ptr, prop)) {
RNA_property_boolean_set(op->ptr, prop, (event->modifier & KM_SHIFT) != 0);
}
return object_hide_collection_exec(C, op);
}