[Bf-blender-cvs] [8146a44] render-layers: Fix writing nested scene collections

Dalai Felinto noreply at git.blender.org
Tue Dec 6 14:16:53 CET 2016


Commit: 8146a4498a733610aba8e7e8f3c65a26fa722488
Author: Dalai Felinto
Date:   Tue Dec 6 14:16:42 2016 +0100
Branches: render-layers
https://developer.blender.org/rB8146a4498a733610aba8e7e8f3c65a26fa722488

Fix writing nested scene collections

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

M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/versioning_280.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ea5687f..842d8b8 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5509,11 +5509,6 @@ static void direct_link_view_settings(FileData *fd, ColorManagedViewSettings *vi
 
 static void direct_link_scene_collection(FileData *fd, SceneCollection *sc)
 {
-	/* this runs before the very first doversion */
-	if (sc == NULL) {
-		return;
-	}
-
 	link_list(fd, &sc->objects);
 	for (LinkData *link = sc->objects.first; link; link = link->next) {
 		link->data = newdataadr(fd, link->data);
@@ -5786,7 +5781,11 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 
 	direct_link_curvemapping(fd, &sce->r.mblur_shutter_curve);
 
-	direct_link_scene_collection(fd, sce->collection);
+	/* this runs before the very first doversion */
+	if (sce->collection != NULL) {
+		sce->collection = newdataadr(fd, sce->collection);
+		direct_link_scene_collection(fd, sce->collection);
+	}
 
 	link_list(fd, &sce->render_layers);
 	for (sl = sce->render_layers.first; sl; sl = sl->next) {
@@ -9057,7 +9056,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 	}
 }
 
-static void expand_layer_collection(FileData *fd, Main *mainvar, SceneCollection *sc)
+static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection *sc)
 {
 	for (LinkData *link = sc->objects.first; link; link = link->next) {
 		expand_doit(fd, mainvar, link->data);
@@ -9068,7 +9067,7 @@ static void expand_layer_collection(FileData *fd, Main *mainvar, SceneCollection
 	}
 
 	for (SceneCollection *nsc= sc->scene_collections.first; nsc; nsc = nsc->next) {
-		expand_layer_collection(fd, mainvar, nsc);
+		expand_scene_collection(fd, mainvar, nsc);
 	}
 }
 
@@ -9142,7 +9141,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
 
 	expand_doit(fd, mainvar, sce->clip);
 
-	expand_layer_collection(fd, mainvar, sce->collection);
+	expand_scene_collection(fd, mainvar, sce->collection);
 }
 
 static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 0368df6..ae39173 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -135,7 +135,7 @@ void blo_do_versions_280_after_linking(FileData *fd, Library *UNUSED(lib), Main
 void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 {
 	if (!MAIN_VERSION_ATLEAST(main, 280, 0)) {
-		if (!DNA_struct_elem_find(fd->filesdna, "Scene", "SceneCollection", "collection")) {
+		if (!DNA_struct_elem_find(fd->filesdna, "Scene", "ListBase", "render_layers")) {
 			for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
 				/* Master Collection */
 				scene->collection = MEM_callocN(sizeof(SceneCollection), "Master Collection");




More information about the Bf-blender-cvs mailing list