Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-03-30 19:53:46 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-03-30 19:53:46 +0300
commit3fdbd78a6b5f271a8022f01ddca649ef16cf5516 (patch)
treee9a7039bc9f1fea297bd8cbe98e1c9eff9092ac0
parentf2c6c831e3d47599157ca529e2cac3c091062bb4 (diff)
Layer / IDProperty: Prevent previously created demo files from crash
-rw-r--r--source/blender/blenloader/intern/versioning_280.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 55d88240100..d416f4faae4 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -212,6 +212,25 @@ void do_versions_after_linking_280(Main *main)
}
}
+static void do_version_layer_collections_idproperties(ListBase *lb)
+{
+ IDPropertyTemplate val = {0};
+ for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
+ lc->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+ BKE_layer_collection_engine_settings_create(lc->properties);
+
+ /* No overrides at first */
+ for (IDProperty *prop = lc->properties->data.group.first; prop; prop = prop->next) {
+ while (prop->data.group.first) {
+ IDP_FreeFromGroup(prop, prop->data.group.first);
+ }
+ }
+
+ /* Do it recursively */
+ do_version_layer_collections_idproperties(&lc->layer_collections);
+ }
+}
+
void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
{
if (!MAIN_VERSION_ATLEAST(main, 280, 0)) {
@@ -237,5 +256,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
ob->collection_properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
}
}
+
+ if (DNA_struct_elem_find(fd->filesdna, "LayerCollection", "ListBase", "engine_settings") &&
+ !DNA_struct_elem_find(fd->filesdna, "LayerCollection", "IDProperty", "properties"))
+ {
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) {
+ do_version_layer_collections_idproperties(&sl->layer_collections);
+ }
+ }
+ }
}
}