[Bf-blender-cvs] [76731a90925] temp-group-collections: More work for 3/3 (aka 3.5/3)

Dalai Felinto noreply at git.blender.org
Wed Nov 1 18:14:32 CET 2017


Commit: 76731a90925bde402d2b4231ebb1bed1848f50a9
Author: Dalai Felinto
Date:   Thu Oct 26 20:34:39 2017 -0200
Branches: temp-group-collections
https://developer.blender.org/rB76731a90925bde402d2b4231ebb1bed1848f50a9

More work for 3/3 (aka 3.5/3)

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

M	source/blender/blenkernel/intern/collection.c
M	source/blender/blenkernel/intern/group.c
M	source/blender/blenkernel/intern/layer.c
M	source/blender/editors/space_outliner/outliner_collections.c
M	source/blender/makesdna/DNA_layer_types.h
M	source/blender/makesrna/intern/rna_layer.c

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

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 08b6c341ae7..c9bd5594001 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -533,6 +533,11 @@ void BKE_collection_group_create(Main *bmain, Scene *scene, LayerCollection *lc_
 
 	sc_dst = BKE_collection_add(&group->id, NULL, COLLECTION_TYPE_GROUP_INTERNAL, sc_src->name);
 	BKE_collection_copy_data(sc_dst, sc_src, LIB_ID_CREATE_NO_USER_REFCOUNT);
+	FOREACH_SCENE_COLLECTION(&group->id, sc_group)
+	{
+		sc_group->type = COLLECTION_TYPE_GROUP_INTERNAL;
+	}
+	FOREACH_SCENE_COLLECTION_END
 
 	lc_dst = BKE_collection_link(group->scene_layer, sc_dst);
 	layer_collection_sync(lc_dst, lc_src);
@@ -543,8 +548,8 @@ void BKE_collection_group_create(Main *bmain, Scene *scene, LayerCollection *lc_
 	}
 
 	/* Convert original SceneCollection into a group collection. */
-	BKE_collection_group_set(scene, sc_src, group);
 	sc_src->type = COLLECTION_TYPE_GROUP;
+	BKE_collection_group_set(scene, sc_src, group);
 	collection_free(sc_src, true);
 }
 
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 34109572436..e6ec53d84af 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -87,7 +87,10 @@ void BKE_group_init(Group *group)
 	BKE_collection_unlink(group->scene_layer, group->scene_layer->layer_collections.first);
 
 	/* Create and link a new default collection. */
-	SceneCollection *defaut_collection = BKE_collection_add(&group->id, NULL, COLLECTION_TYPE_NONE, "Default Collection");
+	SceneCollection *defaut_collection = BKE_collection_add(&group->id,
+	                                                        NULL,
+	                                                        COLLECTION_TYPE_GROUP_INTERNAL,
+	                                                        "Default Collection");
 	BKE_collection_link(group->scene_layer, defaut_collection);
 }
 
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 58211d16205..d24e0f0de88 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -2066,6 +2066,7 @@ static void layer_eval_layer_collections_pre_doit(Scene *scene, ListBase *lb, GS
 				}
 				break;
 			}
+			case COLLECTION_TYPE_GROUP_INTERNAL:
 			case COLLECTION_TYPE_NONE:
 				/* Continue recursively. */
 				layer_eval_layer_collections_pre_doit(scene, &layer_collection->layer_collections, gs);
@@ -2132,6 +2133,8 @@ void BKE_layer_eval_layer_collection(const struct EvaluationContext *eval_ctx,
 	            (parent_layer_collection != NULL) ? parent_layer_collection->scene_collection->name : "NONE",
 	            (parent_layer_collection != NULL) ? parent_layer_collection->scene_collection : NULL);
 
+	BLI_assert(layer_collection != parent_layer_collection);
+
 	/* visibility */
 	layer_collection->flag_evaluated = layer_collection->flag;
 	bool is_visible = (layer_collection->flag & COLLECTION_VISIBLE) != 0;
@@ -2165,11 +2168,13 @@ void BKE_layer_eval_layer_collection(const struct EvaluationContext *eval_ctx,
 				     group_layer_collection;
 				     group_layer_collection = group_layer_collection->next)
 				{
+					BLI_assert(group_layer_collection != layer_collection);
 					BKE_layer_eval_layer_collection(eval_ctx, group_layer_collection, layer_collection);
 				}
 			}
 			break;
 		}
+		case COLLECTION_TYPE_GROUP_INTERNAL:
 		case COLLECTION_TYPE_NONE:
 		{
 			for (LinkData *link = layer_collection->object_bases.first; link != NULL; link = link->next) {
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index eb6983405cd..dc66beae24d 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -304,6 +304,7 @@ static int collection_new_invoke(bContext *C, wmOperator *op, const wmEvent *eve
 	switch (collection_type) {
 		case COLLECTION_TYPE_GROUP:
 			return WM_enum_search_invoke(C, op, event);
+		case COLLECTION_TYPE_GROUP_INTERNAL:
 		case COLLECTION_TYPE_NONE:
 		default:
 			return collection_new_exec(C, op);
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index e51a34a0b5c..486951b8e69 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -128,6 +128,7 @@ enum {
 enum {
 	COLLECTION_TYPE_NONE =  0,
 	COLLECTION_TYPE_GROUP = 1,
+	COLLECTION_TYPE_GROUP_INTERNAL = 2,
 };
 
 /* *************************************************************** */
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index da5c80b37c1..bb24b323c73 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -57,6 +57,7 @@ const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = {
 const EnumPropertyItem rna_enum_collection_type_items[] = {
 	{COLLECTION_TYPE_NONE, "NONE", 0, "Normal", ""},
 	{COLLECTION_TYPE_GROUP, "GROUP", 0, "Group", ""},
+	{COLLECTION_TYPE_GROUP_INTERNAL, "GROUP INTERNAL", 0, "Group Internal", ""},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -81,6 +82,7 @@ static StructRNA *rna_SceneCollection_refine(PointerRNA *ptr)
 	switch (scene_collection->type) {
 		case COLLECTION_TYPE_GROUP:
 			return &RNA_SceneCollectionGroup;
+		case COLLECTION_TYPE_GROUP_INTERNAL:
 		case COLLECTION_TYPE_NONE:
 			return &RNA_SceneCollection;
 		default:



More information about the Bf-blender-cvs mailing list