diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 87e75384476..ac1e20d1e84 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5846,6 +5846,18 @@ static void lib_link_scene_collection(FileData *fd, Library *lib, SceneCollectio } } +static void lib_link_layer_collection(FileData *fd, LayerCollection *layer_collection) +{ + IDP_LibLinkProperty(layer_collection->properties, fd); + + for (LayerCollection *layer_collection_nested = layer_collection->layer_collections.first; + layer_collection_nested != NULL; + layer_collection_nested = layer_collection_nested->next) + { + lib_link_layer_collection(fd, layer_collection_nested); + } +} + static void lib_link_view_layer(FileData *fd, Library *lib, ViewLayer *view_layer) { /* tag scene layer to update for collection tree evaluation */ @@ -5866,6 +5878,16 @@ static void lib_link_view_layer(FileData *fd, Library *lib, ViewLayer *view_laye base->flag |= BASE_DIRTY_ENGINE_SETTINGS; base->collection_properties = NULL; } + + for (LayerCollection *layer_collection = view_layer->layer_collections.first; + layer_collection != NULL; + layer_collection = layer_collection->next) + { + lib_link_layer_collection(fd, layer_collection); + } + + IDP_LibLinkProperty(view_layer->properties, fd); + IDP_LibLinkProperty(view_layer->id_properties, fd); } static void lib_link_scene(FileData *fd, Main *main) @@ -9913,6 +9935,18 @@ static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection } } +static void expand_layer_collection(FileData *fd, Main *mainvar, LayerCollection *layer_collection) +{ + expand_idprops(fd, mainvar, layer_collection->properties); + + for (LayerCollection *layer_collection_nested = layer_collection->layer_collections.first; + layer_collection_nested != NULL; + layer_collection_nested = layer_collection_nested->next) + { + expand_layer_collection(fd, mainvar, layer_collection_nested); + } +} + static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) { SceneRenderLayer *srl; @@ -9949,6 +9983,9 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) } for (ViewLayer *view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) { + expand_idprops(fd, mainvar, view_layer->properties); + expand_idprops(fd, mainvar, view_layer->id_properties); + for (module = view_layer->freestyle_config.modules.first; module; module = module->next) { if (module->script) { expand_doit(fd, mainvar, module->script); @@ -9961,6 +9998,13 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) } expand_doit(fd, mainvar, lineset->linestyle); } + + for (LayerCollection *layer_collection = view_layer->layer_collections.first; + layer_collection != NULL; + layer_collection = layer_collection->next) + { + expand_layer_collection(fd, mainvar, layer_collection); + } } if (sce->r.dometext)