[Bf-blender-cvs] [7d4e1ac727f] master: Outliner: Collections Duplicate - remove original duplicate operator

Dalai Felinto noreply at git.blender.org
Fri Mar 1 15:45:38 CET 2019


Commit: 7d4e1ac727f3cd697d137935a9dbd30d5cfe5192
Author: Dalai Felinto
Date:   Fri Mar 1 11:43:30 2019 -0300
Branches: master
https://developer.blender.org/rB7d4e1ac727f3cd697d137935a9dbd30d5cfe5192

Outliner: Collections Duplicate - remove original duplicate operator

Now that we have better options (duplicate collection and duplicate linked) there is no
longer need for the original dupli operator.

In fact, as it was it was of little use if you ever had nested collections.

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

M	release/scripts/startup/bl_ui/space_outliner.py
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/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index 159a97e8625..2076fde336e 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -157,17 +157,6 @@ class OUTLINER_MT_collection_view_layer(Menu):
             layout.operator("outliner.collection_holdout_clear")
 
 
-class OUTLINER_MT_collection_duplicate(Menu):
-    bl_label = "Duplicate"
-
-    def draw(self, context):
-        layout = self.layout
-
-        layout.operator("outliner.collection_duplicate", text="Collection")
-        layout.operator("outliner.collection_duplicate_hierarchy", text="Hierarchy")
-        layout.operator("outliner.collection_duplicate_linked_hierarchy", text="Linked Hierarchy")
-
-
 class OUTLINER_MT_collection_visibility(Menu):
     bl_label = "Visibility"
 
@@ -203,7 +192,8 @@ class OUTLINER_MT_collection(Menu):
         space = context.space_data
 
         layout.operator("outliner.collection_new", text="New").nested = True
-        layout.menu("OUTLINER_MT_collection_duplicate")
+        layout.operator("outliner.collection_duplicate", text="Duplicate Collection")
+        layout.operator("outliner.collection_duplicate_linked", text="Duplicate Linked")
 
         layout.separator()
 
@@ -356,7 +346,6 @@ classes = (
     OUTLINER_MT_editor_menus,
     OUTLINER_MT_edit_datablocks,
     OUTLINER_MT_collection,
-    OUTLINER_MT_collection_duplicate,
     OUTLINER_MT_collection_new,
     OUTLINER_MT_collection_visibility,
     OUTLINER_MT_collection_view_layer,
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 61c02d18f8f..750c78d76b9 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -448,7 +448,6 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
 	Main *bmain = CTX_data_main(C);
 	SpaceOutliner *soops = CTX_wm_space_outliner(C);
 	TreeElement *te = outliner_active_collection(C);
-	bool hierarchy = strstr(op->idname, "hierarchy") != NULL;
 	bool linked = strstr(op->idname, "linked") != NULL;
 
 	/* Can happen when calling from a key binding. */
@@ -469,7 +468,7 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
 		case SO_SCENES:
 		case SO_VIEW_LAYER:
 		case SO_LIBRARIES:
-			BKE_collection_duplicate(bmain, parent, collection, hierarchy, !linked);
+			BKE_collection_duplicate(bmain, parent, collection, true, !linked);
 			break;
 	}
 
@@ -484,7 +483,7 @@ void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
 	/* identifiers */
 	ot->name = "Duplicate Collection";
 	ot->idname = "OUTLINER_OT_collection_duplicate";
-	ot->description = "Make a new collection with linked content (collection and objects)";
+	ot->description = "Duplicate all objects and collections and make them single user";
 
 	/* api callbacks */
 	ot->exec = collection_duplicate_exec;
@@ -494,27 +493,12 @@ void OUTLINER_OT_collection_duplicate(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-void OUTLINER_OT_collection_duplicate_hierarchy(wmOperatorType *ot)
+void OUTLINER_OT_collection_duplicate_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Duplicate Collection Hierarchy";
-	ot->idname = "OUTLINER_OT_collection_duplicate_hierarchy";
-	ot->description = "Duplicate entire hierarchy and make all content single user";
-
-	/* api callbacks */
-	ot->exec = collection_duplicate_exec;
-	ot->poll = ED_outliner_collections_editor_poll;
-
-	/* flags */
-	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-void OUTLINER_OT_collection_duplicate_linked_hierarchy(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name = "Duplicate Linked Collection Hierarchy";
-	ot->idname = "OUTLINER_OT_collection_duplicate_linked_hierarchy";
-	ot->description = "Duplicate entire hierarchy with linked object data";
+	ot->name = "Duplicate Linked Collection";
+	ot->idname = "OUTLINER_OT_collection_duplicate_linked";
+	ot->description = "Duplicate all objects and collections with linked object data";
 
 	/* api callbacks */
 	ot->exec = collection_duplicate_exec;
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index a1751e90660..0e215c595c1 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -316,8 +316,7 @@ struct Collection *outliner_collection_from_tree_element(const TreeElement *te);
 
 void OUTLINER_OT_collection_new(struct wmOperatorType *ot);
 void OUTLINER_OT_collection_duplicate(struct wmOperatorType *ot);
-void OUTLINER_OT_collection_duplicate_hierarchy(struct wmOperatorType *ot);
-void OUTLINER_OT_collection_duplicate_linked_hierarchy(struct wmOperatorType *ot);
+void OUTLINER_OT_collection_duplicate_linked(struct wmOperatorType *ot);
 void OUTLINER_OT_collection_delete(struct wmOperatorType *ot);
 void OUTLINER_OT_collection_objects_select(struct wmOperatorType *ot);
 void OUTLINER_OT_collection_objects_deselect(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 404ad17ba4e..eea06fc0b0c 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -94,8 +94,7 @@ void outliner_operatortypes(void)
 	/* collections */
 	WM_operatortype_append(OUTLINER_OT_collection_new);
 	WM_operatortype_append(OUTLINER_OT_collection_duplicate);
-	WM_operatortype_append(OUTLINER_OT_collection_duplicate_hierarchy);
-	WM_operatortype_append(OUTLINER_OT_collection_duplicate_linked_hierarchy);
+	WM_operatortype_append(OUTLINER_OT_collection_duplicate_linked);
 	WM_operatortype_append(OUTLINER_OT_collection_delete);
 	WM_operatortype_append(OUTLINER_OT_collection_objects_select);
 	WM_operatortype_append(OUTLINER_OT_collection_objects_deselect);



More information about the Bf-blender-cvs mailing list