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/lattice.c')
-rw-r--r--source/blender/blenkernel/intern/lattice.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index cbff9c2337e..9a528b54143 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -1,6 +1,4 @@
/*
- * $Id$
- *
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -41,6 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -248,7 +247,7 @@ void make_local_lattice(Lattice *lt)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -257,28 +256,28 @@ void make_local_lattice(Lattice *lt)
if(lt->id.lib==NULL) return;
if(lt->id.us==1) {
- lt->id.lib= NULL;
- lt->id.flag= LIB_LOCAL;
- new_id(&bmain->latt, (ID *)lt, NULL);
+ id_clear_lib_data(bmain, &lt->id);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
if(ob->data==lt) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- lt->id.lib= NULL;
- lt->id.flag= LIB_LOCAL;
- new_id(&bmain->latt, (ID *)lt, NULL);
+ if(is_local && is_lib==FALSE) {
+ id_clear_lib_data(bmain, &lt->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bath_user_data[2]= {bmain->name, lt->id.lib->filepath};
Lattice *ltn= copy_lattice(lt);
ltn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &ltn->id, bpath_relocate_visitor, 0, bath_user_data);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==lt) {
if(ob->id.lib==NULL) {