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:
Diffstat (limited to 'source/blender/blenkernel/intern/world.c')
-rw-r--r--source/blender/blenkernel/intern/world.c36
1 files changed, 4 insertions, 32 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 9795a8174f8..de1e3187a70 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -138,14 +138,11 @@ World *BKE_world_copy(Main *bmain, World *wrld)
wrldn->nodetree = ntreeCopyTree(bmain, wrld->nodetree);
}
- wrldn->preview = BKE_previewimg_copy(wrld->preview);
+ BKE_previewimg_id_copy(&wrldn->id, &wrld->id);
BLI_listbase_clear(&wrldn->gpumaterial);
- if (ID_IS_LINKED_DATABLOCK(wrld)) {
- BKE_id_expand_local(&wrldn->id);
- BKE_id_lib_local_paths(bmain, wrld->id.lib, &wrldn->id);
- }
+ BKE_id_copy_ensure_local(bmain, &wrld->id, &wrldn->id);
return wrldn;
}
@@ -176,32 +173,7 @@ World *localize_world(World *wrld)
return wrldn;
}
-void BKE_world_make_local(Main *bmain, World *wrld)
+void BKE_world_make_local(Main *bmain, World *wrld, const bool lib_local)
{
- bool is_local = false, is_lib = false;
-
- /* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
-
- if (!ID_IS_LINKED_DATABLOCK(wrld)) {
- return;
- }
-
- BKE_library_ID_test_usages(bmain, wrld, &is_local, &is_lib);
-
- if (is_local) {
- if (!is_lib) {
- id_clear_lib_data(bmain, &wrld->id);
- BKE_id_expand_local(&wrld->id);
- }
- else {
- World *wrld_new = BKE_world_copy(bmain, wrld);
-
- wrld_new->id.us = 0;
-
- BKE_libblock_remap(bmain, wrld, wrld_new, ID_REMAP_SKIP_INDIRECT_USAGE);
- }
- }
+ BKE_id_make_local_generic(bmain, &wrld->id, true, lib_local);
}