[Bf-blender-cvs] [4d08ef822ce] blender2.8: Outliner/Collection: Operator to delete selected collections
Dalai Felinto
noreply at git.blender.org
Fri Dec 29 16:39:12 CET 2017
Commit: 4d08ef822ce291744d40e0fef47975e7f61826e8
Author: Dalai Felinto
Date: Fri Dec 29 12:13:47 2017 -0200
Branches: blender2.8
https://developer.blender.org/rB4d08ef822ce291744d40e0fef47975e7f61826e8
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.
===================================================================
M source/blender/editors/space_outliner/outliner_collections.c
M source/blender/editors/space_outliner/outliner_intern.h
M source/blender/editors/space_outliner/outliner_ops.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 35d0a34b984..a01cfa4812a 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -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;
+}
+
/**********************************************************************************/
/**
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 0025631c85f..c73e4f4aadd 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -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 ---------------------------------------------- */
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 925d7a83b36..98e8aca0e1f 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -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);
}
More information about the Bf-blender-cvs
mailing list