Outliner/Collection: Operator to delete selected collections

This is part of T53495.

This operator is actually using existing code. The only new thing about it is
that it has a shortcut.

It will be exposed in the UI soon together with the nested collection operator.
This commit is contained in:
Dalai Felinto 2017-12-29 12:13:47 -02:00
parent 8252a414d8
commit 4d08ef822c
3 changed files with 24 additions and 0 deletions

View File

@ -51,6 +51,9 @@
#include "outliner_intern.h" /* own include */
/* Prototypes. */
static int collection_delete_exec(struct bContext *C, struct wmOperator *op);
/* -------------------------------------------------------------------- */
static LayerCollection *outliner_collection_active(bContext *C)
@ -421,6 +424,24 @@ void OUTLINER_OT_collection_nested_new(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/**********************************************************************************/
/* Delete selected collection. */
void OUTLINER_OT_collection_delete_selected(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Delete Selected Collections";
ot->idname = "OUTLINER_OT_collection_delete_selected";
ot->description = "Delete all the selected collections";
/* api callbacks */
ot->exec = collection_delete_exec;
ot->poll = collections_editor_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/**********************************************************************************/
/**

View File

@ -341,6 +341,7 @@ void OUTLINER_OT_collection_objects_select(struct wmOperatorType *ot);
void OUTLINER_OT_collection_objects_deselect(struct wmOperatorType *ot);
void OUTLINER_OT_collection_nested_new(struct wmOperatorType *ot);
void OUTLINER_OT_collection_delete_selected(struct wmOperatorType *ot);
/* outliner_utils.c ---------------------------------------------- */

View File

@ -337,6 +337,7 @@ void outliner_operatortypes(void)
WM_operatortype_append(OUTLINER_OT_collection_objects_deselect);
WM_operatortype_append(OUTLINER_OT_collection_nested_new);
WM_operatortype_append(OUTLINER_OT_collection_delete_selected);
}
static wmKeyMap *outliner_item_drag_drop_modal_keymap(wmKeyConfig *keyconf)
@ -435,6 +436,7 @@ void outliner_keymap(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_delete_selected", DKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_nested_new", CKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_delete_selected", XKEY, KM_PRESS, 0, 0);
outliner_item_drag_drop_modal_keymap(keyconf);
}