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.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 7d278f37cfb..4d7a7c9a262 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -42,6 +40,7 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_world.h"
#include "BKE_library.h"
@@ -153,7 +152,7 @@ void make_local_world(World *wrld)
{
Main *bmain= G.main;
Scene *sce;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -162,28 +161,28 @@ void make_local_world(World *wrld)
if(wrld->id.lib==NULL) return;
if(wrld->id.us==1) {
- wrld->id.lib= NULL;
- wrld->id.flag= LIB_LOCAL;
- new_id(NULL, (ID *)wrld, NULL);
+ id_clear_lib_data(bmain, &wrld->id);
return;
}
- for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
+ for(sce= bmain->scene.first; sce && ELEM(FALSE, is_lib, is_local); sce= sce->id.next) {
if(sce->world == wrld) {
- if(sce->id.lib) lib= 1;
- else local= 1;
+ if(sce->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- wrld->id.lib= NULL;
- wrld->id.flag= LIB_LOCAL;
- new_id(NULL, (ID *)wrld, NULL);
+ if(is_local && is_lib==FALSE) {
+ id_clear_lib_data(bmain, &wrld->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, wrld->id.lib->filepath};
World *wrldn= copy_world(wrld);
wrldn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &wrldn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
for(sce= bmain->scene.first; sce; sce= sce->id.next) {
if(sce->world == wrld) {
if(sce->id.lib==NULL) {