[Bf-blender-cvs] [3874856cb67] temp-group-collections: Fix adding new collections to group collections

Dalai Felinto noreply at git.blender.org
Wed Nov 1 18:15:12 CET 2017


Commit: 3874856cb67e0f076e6ada663b202bd0acd95e75
Author: Dalai Felinto
Date:   Wed Nov 1 11:59:34 2017 -0200
Branches: temp-group-collections
https://developer.blender.org/rB3874856cb67e0f076e6ada663b202bd0acd95e75

Fix adding new collections to group collections

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

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

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

diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index d492bb189a5..dca1c4a614c 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -825,6 +825,7 @@ static void collection_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
 	bContext *C = (bContext *)Carg;
 	Scene *scene = CTX_data_scene(C);
 	LayerCollection *lc = te->directdata;
+	ID *id = te->store_elem->id;
 	SceneCollection *sc = lc->scene_collection;
 
 	if (event == OL_COLLECTION_OP_OBJECTS_ADD) {
@@ -849,7 +850,13 @@ static void collection_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
 		te->store_elem->flag &= ~TSE_SELECTED;
 	}
 	else if (event == OL_COLLECTION_OP_COLLECTION_NEW) {
-		BKE_collection_add(&scene->id, sc, COLLECTION_TYPE_NONE, NULL); /* XXX what if it's a group? */
+		if (GS(id->name) == ID_GR) {
+			BKE_collection_add(id, sc, COLLECTION_TYPE_GROUP_INTERNAL, NULL);
+		}
+		else {
+			BLI_assert(GS(id->name) == ID_SCE);
+			BKE_collection_add(id, sc, COLLECTION_TYPE_NONE, NULL);
+		}
 		WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
 	}
 	else if (event == OL_COLLECTION_OP_COLLECTION_UNLINK) {



More information about the Bf-blender-cvs mailing list