[Bf-blender-cvs] [7269eba1115] soc-2020-outliner: Outliner: New Collection Menu

Nathan Craddock noreply at git.blender.org
Thu Jul 9 05:31:02 CEST 2020


Commit: 7269eba1115ac742e8e56339e81e2e8749447d61
Author: Nathan Craddock
Date:   Sat Jul 4 12:04:13 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB7269eba1115ac742e8e56339e81e2e8749447d61

Outliner: New Collection Menu

===================================================================

M	source/blender/editors/space_outliner/outliner_collections.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index da96f6c90d2..4b52eac4dea 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -178,6 +178,12 @@ static bool outliner_view_layer_collections_editor_poll(bContext *C)
 /** \name New Collection
  * \{ */
 
+typedef enum NewCollectionType {
+  COLLECTION_NEW_EMPTY,
+  COLLECTION_NEW_FROM_SELECTION,
+  COLLECTION_NEW_FROM_SELECTION_LINKED,
+} NewCollectionType;
+
 struct CollectionNewData {
   bool error;
   Collection *collection;
@@ -247,13 +253,33 @@ static int collection_new_exec(bContext *C, wmOperator *op)
 
 void OUTLINER_OT_collection_new(wmOperatorType *ot)
 {
+  static EnumPropertyItem type_items[] = {
+      {COLLECTION_NEW_EMPTY,
+       "EMPTY",
+       0,
+       "Empty",
+       "Create a new collection inside the active collection"},
+      {COLLECTION_NEW_FROM_SELECTION,
+       "SELECTION",
+       0,
+       "Move Selection",
+       "Move the selected objects to a new collection"},
+      {COLLECTION_NEW_FROM_SELECTION_LINKED,
+       "SELECTION_LINKED",
+       0,
+       "Link Selection",
+       "Link the selected objects to a new collection"},
+      {0, NULL, 0, NULL, NULL},
+  };
+
   /* identifiers */
   ot->name = "New Collection";
   ot->idname = "OUTLINER_OT_collection_new";
-  ot->description = "Add a new collection inside selected collection";
+  ot->description = "Create a new collection";
 
   /* api callbacks */
   ot->exec = collection_new_exec;
+  ot->invoke = WM_menu_invoke;
   ot->poll = ED_outliner_collections_editor_poll;
 
   /* flags */
@@ -263,6 +289,8 @@ void OUTLINER_OT_collection_new(wmOperatorType *ot)
   PropertyRNA *prop = RNA_def_boolean(
       ot->srna, "nested", true, "Nested", "Add as child of selected collection");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+  ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
 }
 
 /** \} */



More information about the Bf-blender-cvs mailing list