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:
authorCampbell Barton <ideasman42@gmail.com>2011-10-27 09:34:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-27 09:34:39 +0400
commitf7d5cea669bd40de9c0aa5fc3aaa4c7f49f697a8 (patch)
tree30ad1870a5f6b3a3bbc1cb4904db92c882fe5a6f
parentfa6e6e7fc0977248e7ac10dddc79499304f05bda (diff)
use path remapping for all make local functions, patch from Alex Fraser with changes.
-rw-r--r--source/blender/blenkernel/intern/action.c28
-rw-r--r--source/blender/blenkernel/intern/armature.c23
-rw-r--r--source/blender/blenkernel/intern/brush.c21
-rw-r--r--source/blender/blenkernel/intern/curve.c22
-rw-r--r--source/blender/blenkernel/intern/image.c26
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/lattice.c21
-rw-r--r--source/blender/blenkernel/intern/library.c4
-rw-r--r--source/blender/blenkernel/intern/material.c38
-rw-r--r--source/blender/blenkernel/intern/mball.c22
-rw-r--r--source/blender/blenkernel/intern/mesh.c22
-rw-r--r--source/blender/blenkernel/intern/object.c67
-rw-r--r--source/blender/blenkernel/intern/particle.c24
-rw-r--r--source/blender/blenkernel/intern/speaker.c20
-rw-r--r--source/blender/blenkernel/intern/texture.c39
-rw-r--r--source/blender/blenkernel/intern/world.c23
-rw-r--r--source/blender/blenlib/BLI_bpath.h5
-rw-r--r--source/blender/blenlib/intern/bpath.c45
18 files changed, 266 insertions, 186 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index d02a1d6dd27..8e9d5ee34a8 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -43,6 +43,7 @@
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
@@ -94,8 +95,8 @@ typedef struct tMakeLocalActionContext {
bAction *act; /* original action */
bAction *actn; /* new action */
- int lib; /* some action users were libraries */
- int local; /* some action users were not libraries */
+ int is_lib; /* some action users were libraries */
+ int is_local; /* some action users were not libraries */
} tMakeLocalActionContext;
/* helper function for make_local_action() - local/lib init step */
@@ -104,10 +105,8 @@ static void make_localact_init_cb(ID *id, AnimData *adt, void *mlac_ptr)
tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
if (adt->action == mlac->act) {
- if (id->lib)
- mlac->lib = 1;
- else
- mlac->local = 1;
+ if (id->lib) mlac->is_lib= TRUE;
+ else mlac->is_local= TRUE;
}
}
@@ -129,7 +128,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
// does copy_fcurve...
void make_local_action(bAction *act)
{
- tMakeLocalActionContext mlac = {act, NULL, 0, 0};
+ tMakeLocalActionContext mlac = {act, NULL, FALSE, FALSE};
Main *bmain= G.main;
if (act->id.lib==NULL)
@@ -137,19 +136,24 @@ void make_local_action(bAction *act)
// XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default
if ((act->id.flag & LIB_FAKEUSER) && (act->id.us<=1)) {
- id_clear_lib_data(bmain, (ID *)act);
+ id_clear_lib_data(bmain, &act->id);
return;
}
BKE_animdata_main_cb(bmain, make_localact_init_cb, &mlac);
- if (mlac.local && mlac.lib==0) {
- id_clear_lib_data(bmain, (ID *)act);
+ if (mlac.is_local && mlac.is_lib==FALSE) {
+ id_clear_lib_data(bmain, &act->id);
}
- else if (mlac.local && mlac.lib) {
+ else if (mlac.is_local && mlac.is_lib) {
+ char *bpath_user_data[2]= {bmain->name, act->id.lib->filepath};
+
mlac.actn= copy_action(act);
mlac.actn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &mlac.actn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
BKE_animdata_main_cb(bmain, make_localact_apply_cb, &mlac);
}
}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index b4b5dfedad2..2ebede13d70 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -37,6 +37,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -136,29 +137,33 @@ void free_armature(bArmature *arm)
void make_local_armature(bArmature *arm)
{
Main *bmain= G.main;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
Object *ob;
if (arm->id.lib==NULL) return;
if (arm->id.us==1) {
- id_clear_lib_data(bmain, (ID *)arm);
+ id_clear_lib_data(bmain, &arm->id);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data == arm) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)arm);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &arm->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, arm->id.lib->filepath};
bArmature *armn= copy_armature(arm);
armn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &armn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == arm) {
if(ob->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 511f90f3d26..10f056e9b78 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -45,6 +45,7 @@
#include "RNA_access.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
@@ -194,26 +195,26 @@ void make_local_brush(Brush *brush)
Main *bmain= G.main;
Scene *scene;
- int local= 0, lib= 0;
+ int is_local= FALSE, is_lib= FALSE;
if(brush->id.lib==NULL) return;
if(brush->clone.image) {
/* special case: ima always local immediately. Clone image should only
have one user anyway. */
- id_clear_lib_data(bmain, (ID *)brush->clone.image);
+ id_clear_lib_data(bmain, &brush->clone.image->id);
extern_local_brush(brush);
}
- for(scene= bmain->scene.first; scene && ELEM(0, lib, local); scene=scene->id.next) {
+ for(scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
- if(scene->id.lib) lib= 1;
- else local= 1;
+ if(scene->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)brush);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &brush->id);
extern_local_brush(brush);
/* enable fake user by default */
@@ -222,10 +223,14 @@ void make_local_brush(Brush *brush)
brush->id.us++;
}
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, brush->id.lib->filepath};
Brush *brushn= copy_brush(brush);
brushn->id.us= 1; /* only keep fake user */
brushn->id.flag |= LIB_FAKEUSER;
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &brushn->id, bpath_relocate_visitor, 0, bpath_user_data);
for(scene= bmain->scene.first; scene; scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index f5335bb12cd..3f014f241ff 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -36,6 +36,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_bpath.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -245,7 +246,7 @@ void make_local_curve(Curve *cu)
{
Main *bmain= G.main;
Object *ob;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - when there are only lib users: don't do
* - when there are only local users: set flag
@@ -255,26 +256,31 @@ void make_local_curve(Curve *cu)
if(cu->id.lib==NULL) return;
if(cu->id.us==1) {
- id_clear_lib_data(bmain, (ID *)cu);
+ id_clear_lib_data(bmain, &cu->id);
extern_local_curve(cu);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data == cu) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)cu);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &cu->id);
extern_local_curve(cu);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, cu->id.lib->filepath};
Curve *cun= copy_curve(cu);
cun->id.us= 0;
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &cun->id, bpath_relocate_visitor, 0, bpath_user_data);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==cu) {
if(ob->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index ee0f1177fce..d88cbc33926 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -329,7 +329,7 @@ void make_local_image(struct Image *ima)
Tex *tex;
Brush *brush;
Mesh *me;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -342,7 +342,7 @@ void make_local_image(struct Image *ima)
texface ID refs. - z0r */
#if 0
if(ima->id.us==1) {
- id_clear_lib_data(bmain, (ID *)ima);
+ id_clear_lib_data(bmain, &ima->id);
extern_local_image(ima);
return;
}
@@ -350,14 +350,14 @@ void make_local_image(struct Image *ima)
for(tex= bmain->tex.first; tex; tex= tex->id.next) {
if(tex->ima == ima) {
- if(tex->id.lib) lib= 1;
- else local= 1;
+ if(tex->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
for(brush= bmain->brush.first; brush; brush= brush->id.next) {
if(brush->clone.image == ima) {
- if(brush->id.lib) lib= 1;
- else local= 1;
+ if(brush->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
for(me= bmain->mesh.first; me; me= me->id.next) {
@@ -371,8 +371,8 @@ void make_local_image(struct Image *ima)
for(a=0; a<me->totface; a++, tface++) {
if(tface->tpage == ima) {
- if(me->id.lib) lib=1;
- else local= 1;
+ if(me->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -380,18 +380,18 @@ void make_local_image(struct Image *ima)
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)ima);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &ima->id);
extern_local_image(ima);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, ima->id.lib->filepath};
Image *iman= copy_image(ima);
- char *user_data[2]= {bmain->name, iman->id.lib->filepath};
iman->id.us= 0;
/* Remap paths of new ID using old library as base. */
- bpath_traverse_id(bmain, &iman->id, bpath_relocate_visitor, 0, user_data);
+ bpath_traverse_id(bmain, &iman->id, bpath_relocate_visitor, 0, bpath_user_data);
tex= bmain->tex.first;
while(tex) {
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 5ac8780e4a2..5fbe1ca3a23 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -181,7 +181,7 @@ void make_local_key(Key *key)
if(key==NULL) return;
key->id.lib= NULL;
- new_id(NULL, (ID *)key, NULL);
+ new_id(NULL, &key->id, NULL);
}
/* Sort shape keys and Ipo curves after a change. This assumes that at most
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index d90cda19ea9..9a528b54143 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -39,6 +39,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -246,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
@@ -255,24 +256,28 @@ void make_local_lattice(Lattice *lt)
if(lt->id.lib==NULL) return;
if(lt->id.us==1) {
- id_clear_lib_data(bmain, (ID *)lt);
+ 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) {
- id_clear_lib_data(bmain, (ID *)lt);
+ 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) {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index be495a7882f..d94e6f844a9 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1252,8 +1252,8 @@ int new_id(ListBase *lb, ID *id, const char *tname)
don't have other library users. */
void id_clear_lib_data(Main *bmain, ID *id)
{
- char *user_data[2]= {bmain->name, id->lib->filepath};
- bpath_traverse_id(bmain, id, bpath_relocate_visitor, 0, user_data);
+ char *bpath_user_data[2]= {bmain->name, id->lib->filepath};
+ bpath_traverse_id(bmain, id, bpath_relocate_visitor, 0, bpath_user_data);
id->lib= NULL;
id->flag= LIB_LOCAL;
new_id(which_libbase(bmain, GS(id->name)), id, NULL);
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 4fd2c3ff2fc..2ad3da9f3a0 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -50,6 +50,7 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_animsys.h"
#include "BKE_displist.h"
@@ -285,8 +286,7 @@ void make_local_material(Material *ma)
Mesh *me;
Curve *cu;
MetaBall *mb;
- Material *man;
- int a, local=0, lib=0;
+ int a, is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -297,7 +297,7 @@ void make_local_material(Material *ma)
/* One local user; set flag and return. */
if(ma->id.us==1) {
- id_clear_lib_data(bmain, (ID *)ma);
+ id_clear_lib_data(bmain, &ma->id);
extern_local_material(ma);
return;
}
@@ -310,8 +310,8 @@ void make_local_material(Material *ma)
if(ob->mat) {
for(a=0; a<ob->totcol; a++) {
if(ob->mat[a]==ma) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -323,8 +323,8 @@ void make_local_material(Material *ma)
if(me->mat) {
for(a=0; a<me->totcol; a++) {
if(me->mat[a]==ma) {
- if(me->id.lib) lib= 1;
- else local= 1;
+ if(me->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -336,8 +336,8 @@ void make_local_material(Material *ma)
if(cu->mat) {
for(a=0; a<cu->totcol; a++) {
if(cu->mat[a]==ma) {
- if(cu->id.lib) lib= 1;
- else local= 1;
+ if(cu->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -349,8 +349,8 @@ void make_local_material(Material *ma)
if(mb->mat) {
for(a=0; a<mb->totcol; a++) {
if(mb->mat[a]==ma) {
- if(mb->id.lib) lib= 1;
- else local= 1;
+ if(mb->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
@@ -358,16 +358,20 @@ void make_local_material(Material *ma)
}
/* Only local users. */
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)ma);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &ma->id);
extern_local_material(ma);
}
/* Both user and local, so copy. */
- else if(local && lib) {
-
- man= copy_material(ma);
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, ma->id.lib->filepath};
+ Material *man= copy_material(ma);
+
man->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &man->id, bpath_relocate_visitor, 0, bpath_user_data);
+
/* do objects */
ob= bmain->object.first;
while(ob) {
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index db493b33ced..98646bd2faa 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -50,7 +50,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
-
+#include "BLI_bpath.h"
#include "BKE_global.h"
@@ -147,7 +147,7 @@ void make_local_mball(MetaBall *mb)
{
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
@@ -156,27 +156,31 @@ void make_local_mball(MetaBall *mb)
if(mb->id.lib==NULL) return;
if(mb->id.us==1) {
- id_clear_lib_data(bmain, (ID *)mb);
+ id_clear_lib_data(bmain, &mb->id);
extern_local_mball(mb);
return;
}
- for(ob= G.main->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= G.main->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data == mb) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)mb);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &mb->id);
extern_local_mball(mb);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, mb->id.lib->filepath};
MetaBall *mbn= copy_mball(mb);
mbn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &mbn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->data == mb) {
if(ob->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 5c7d9278783..50525c2b9cd 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -43,6 +43,7 @@
#include "DNA_ipo_types.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_edgehash.h"
@@ -271,7 +272,7 @@ void make_local_mesh(Mesh *me)
{
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
@@ -280,26 +281,31 @@ void make_local_mesh(Mesh *me)
if(me->id.lib==NULL) return;
if(me->id.us==1) {
- id_clear_lib_data(bmain, (ID *)me);
+ id_clear_lib_data(bmain, &me->id);
expand_local_mesh(me);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(me == ob->data) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)me);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &me->id);
expand_local_mesh(me);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, me->id.lib->filepath};
Mesh *men= copy_mesh(me);
men->id.us= 0;
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &men->id, bpath_relocate_visitor, 0, bpath_user_data);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(me == ob->data) {
if(ob->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 819a98248f9..e1a428ce242 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -56,6 +56,7 @@
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
+#include "BLI_bpath.h"
#include "BLI_editVert.h"
#include "BLI_math.h"
#include "BLI_pbvh.h"
@@ -747,7 +748,7 @@ void make_local_camera(Camera *cam)
{
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
@@ -756,24 +757,29 @@ void make_local_camera(Camera *cam)
if(cam->id.lib==NULL) return;
if(cam->id.us==1) {
- id_clear_lib_data(bmain, (ID *)cam);
+ id_clear_lib_data(bmain, &cam->id);
return;
}
- for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
+ for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
if(ob->data==cam) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)cam);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &cam->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, cam->id.lib->filepath};
Camera *camn= copy_camera(cam);
+
camn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &camn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == cam) {
if(ob->id.lib==NULL) {
@@ -907,8 +913,7 @@ void make_local_lamp(Lamp *la)
{
Main *bmain= G.main;
Object *ob;
- Lamp *lan;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -917,26 +922,31 @@ void make_local_lamp(Lamp *la)
if(la->id.lib==NULL) return;
if(la->id.us==1) {
- id_clear_lib_data(bmain, (ID *)la);
+ id_clear_lib_data(bmain, &la->id);
return;
}
ob= bmain->object.first;
while(ob) {
if(ob->data==la) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
ob= ob->id.next;
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)la);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &la->id);
}
- else if(local && lib) {
- lan= copy_lamp(la);
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, la->id.lib->filepath};
+ Lamp *lan= copy_lamp(la);
lan->id.us= 0;
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &lan->id, bpath_relocate_visitor, 0, bpath_user_data);
+
ob= bmain->object.first;
while(ob) {
if(ob->data==la) {
@@ -1448,7 +1458,7 @@ void make_local_object(Object *ob)
Main *bmain= G.main;
Scene *sce;
Base *base;
- int local=0, lib=0;
+ int is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -1460,25 +1470,30 @@ void make_local_object(Object *ob)
ob->proxy= ob->proxy_from= NULL;
if(ob->id.us==1) {
- id_clear_lib_data(bmain, (ID *)ob);
+ id_clear_lib_data(bmain, &ob->id);
extern_local_object(ob);
}
else {
- for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
+ for(sce= bmain->scene.first; sce && ELEM(0, is_lib, is_local); sce= sce->id.next) {
if(object_in_scene(ob, sce)) {
- if(sce->id.lib) lib= 1;
- else local= 1;
+ if(sce->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)ob);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &ob->id);
extern_local_object(ob);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, ob->id.lib->filepath};
Object *obn= copy_object(ob);
+
obn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &obn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
sce= bmain->scene.first;
while(sce) {
if(sce->id.lib==NULL) {
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 99d7a9af512..a1ed0862336 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -53,6 +53,7 @@
#include "BLI_rand.h"
#include "BLI_threads.h"
#include "BLI_linklist.h"
+#include "BLI_bpath.h"
#include "BKE_anim.h"
#include "BKE_animsys.h"
@@ -3601,7 +3602,7 @@ void make_local_particlesettings(ParticleSettings *part)
{
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
@@ -3610,30 +3611,35 @@ void make_local_particlesettings(ParticleSettings *part)
if(part->id.lib==0) return;
if(part->id.us==1) {
- id_clear_lib_data(bmain, (ID *)part);
+ id_clear_lib_data(bmain, &part->id);
expand_local_particlesettings(part);
return;
}
/* test objects */
- 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) {
ParticleSystem *psys=ob->particlesystem.first;
for(; psys; psys=psys->next){
if(psys->part==part) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)part);
+ if(is_local && is_lib==FALSE) {
+ id_clear_lib_data(bmain, &part->id);
expand_local_particlesettings(part);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, part->id.lib->filepath};
ParticleSettings *partn= psys_copy_settings(part);
+
partn->id.us= 0;
-
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &partn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
/* do objects */
for(ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys;
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index a01e2eae96e..d5788d7a748 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -34,6 +34,8 @@
#include "DNA_speaker_types.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_animsys.h"
#include "BKE_global.h"
@@ -78,7 +80,7 @@ void make_local_speaker(Speaker *spk)
{
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
@@ -87,26 +89,30 @@ void make_local_speaker(Speaker *spk)
if(spk->id.lib==NULL) return;
if(spk->id.us==1) {
- id_clear_lib_data(bmain, (ID *)spk);
+ id_clear_lib_data(bmain, &spk->id);
return;
}
ob= bmain->object.first;
while(ob) {
if(ob->data==spk) {
- if(ob->id.lib) lib= 1;
- else local= 1;
+ if(ob->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
ob= ob->id.next;
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)spk);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &spk->id);
}
- else if(local && lib) {
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, spk->id.lib->filepath};
Speaker *spkn= copy_speaker(spk);
spkn->id.us= 0;
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &spkn->id, bpath_relocate_visitor, 0, bpath_user_data);
+
ob= bmain->object.first;
while(ob) {
if(ob->data==spk) {
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index bf4cd84f571..e3713b1e177 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -42,6 +42,7 @@
#include "BLI_math.h"
#include "BLI_kdopbvh.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "DNA_key_types.h"
#include "DNA_object_types.h"
@@ -822,13 +823,12 @@ static void extern_local_texture(Tex *tex)
void make_local_texture(Tex *tex)
{
Main *bmain= G.main;
- Tex *texn;
Material *ma;
World *wrld;
Lamp *la;
Brush *br;
ParticleSettings *pa;
- int a, local=0, lib=0;
+ int a, is_local= FALSE, is_lib= FALSE;
/* - only lib users: do nothing
* - only local users: set flag
@@ -838,7 +838,7 @@ void make_local_texture(Tex *tex)
if(tex->id.lib==NULL) return;
if(tex->id.us==1) {
- id_clear_lib_data(bmain, (ID *)tex);
+ id_clear_lib_data(bmain, &tex->id);
extern_local_texture(tex);
return;
}
@@ -847,8 +847,8 @@ void make_local_texture(Tex *tex)
while(ma) {
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
- if(ma->id.lib) lib= 1;
- else local= 1;
+ if(ma->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
ma= ma->id.next;
@@ -857,8 +857,8 @@ void make_local_texture(Tex *tex)
while(la) {
for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a] && la->mtex[a]->tex==tex) {
- if(la->id.lib) lib= 1;
- else local= 1;
+ if(la->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
la= la->id.next;
@@ -867,8 +867,8 @@ void make_local_texture(Tex *tex)
while(wrld) {
for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
- if(wrld->id.lib) lib= 1;
- else local= 1;
+ if(wrld->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
wrld= wrld->id.next;
@@ -876,8 +876,8 @@ void make_local_texture(Tex *tex)
br= bmain->brush.first;
while(br) {
if(br->mtex.tex==tex) {
- if(br->id.lib) lib= 1;
- else local= 1;
+ if(br->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
br= br->id.next;
}
@@ -885,20 +885,25 @@ void make_local_texture(Tex *tex)
while(pa) {
for(a=0; a<MAX_MTEX; a++) {
if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
- if(pa->id.lib) lib= 1;
- else local= 1;
+ if(pa->id.lib) is_lib= TRUE;
+ else is_local= TRUE;
}
}
pa= pa->id.next;
}
- if(local && lib==0) {
- id_clear_lib_data(bmain, (ID *)tex);
+ if(is_local && is_lib == FALSE) {
+ id_clear_lib_data(bmain, &tex->id);
extern_local_texture(tex);
}
- else if(local && lib) {
- texn= copy_texture(tex);
+ else if(is_local && is_lib) {
+ char *bpath_user_data[2]= {bmain->name, tex->id.lib->filepath};
+ Tex *texn= copy_texture(tex);
+
texn->id.us= 0;
+
+ /* Remap paths of new ID using old library as base. */
+ bpath_traverse_id(bmain, &texn->id, bpath_relocate_visitor, 0, bpath_user_data);
ma= bmain->mat.first;
while(ma) {
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index ca719e58ea9..4d7a7c9a262 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -40,6 +40,7 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
+#include "BLI_bpath.h"
#include "BKE_world.h"
#include "BKE_library.h"
@@ -151,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
@@ -160,24 +161,28 @@ void make_local_world(World *wrld)
if(wrld->id.lib==NULL) return;
if(wrld->id.us==1) {
- id_clear_lib_data(bmain, (ID *)wrld);
+ 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) {
- id_clear_lib_data(bmain, (ID *)wrld);
+ 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) {
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index 1c953337230..89ba4b2675e 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -34,9 +34,10 @@
#ifndef BLI_BPATH_H
#define BLI_BPATH_H
-struct ReportList;
-struct Main;
struct ID;
+struct ListBase;
+struct Main;
+struct ReportList;
/* Function that does something with an ID's file path. Should return 1 if the
path has changed, and in that case, should write the result to pathOut. */
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index af12a59bc39..e42e02fb24f 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -360,7 +360,7 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
}
/* Run visitor function 'visit' on all paths contained in 'id'. */
-void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *userdata)
+void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
Image *ima;
const char *absbase= (flag & BPATH_TRAVERSE_ABS) ? (id->lib ? id->lib->filepath : bmain->name) : NULL;
@@ -374,7 +374,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
ima= (Image *)id;
if (ima->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) {
if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- rewrite_path_fixed(ima->name, visit_cb, absbase, userdata);
+ rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data);
}
}
break;
@@ -382,7 +382,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
{
Brush *brush= (Brush *)id;
if (brush->icon_filepath[0]) {
- rewrite_path_fixed(brush->icon_filepath, visit_cb, absbase, userdata);
+ rewrite_path_fixed(brush->icon_filepath, visit_cb, absbase, bpath_user_data);
}
}
break;
@@ -393,7 +393,10 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
PointCache *cache; \
for(cache= (ptcaches).first; cache; cache= cache->next) { \
if(cache->flag & PTCACHE_DISK_CACHE) { \
- rewrite_path_fixed(cache->path, visit_cb, absbase, userdata); \
+ rewrite_path_fixed(cache->path, \
+ visit_cb, \
+ absbase, \
+ bpath_user_data); \
} \
} \
} \
@@ -408,7 +411,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
/* do via modifiers instead */
#if 0
if (ob->fluidsimSettings) {
- rewrite_path_fixed(ob->fluidsimSettings->surfdataPath, visit_cb, absbase, userdata);
+ rewrite_path_fixed(ob->fluidsimSettings->surfdataPath, visit_cb, absbase, bpath_user_data);
}
#endif
@@ -416,7 +419,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
if (md->type == eModifierType_Fluidsim) {
FluidsimModifierData *fluidmd= (FluidsimModifierData *)md;
if (fluidmd->fss) {
- rewrite_path_fixed(fluidmd->fss->surfdataPath, visit_cb, absbase, userdata);
+ rewrite_path_fixed(fluidmd->fss->surfdataPath, visit_cb, absbase, bpath_user_data);
}
}
else if (md->type == eModifierType_Smoke) {
@@ -447,13 +450,13 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
{
bSound *sound= (bSound *)id;
if (sound->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) {
- rewrite_path_fixed(sound->name, visit_cb, absbase, userdata);
+ rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data);
}
}
break;
case ID_TXT:
if (((Text*)id)->name) {
- rewrite_path_alloc(&((Text *)id)->name, visit_cb, absbase, userdata);
+ rewrite_path_alloc(&((Text *)id)->name, visit_cb, absbase, bpath_user_data);
}
break;
case ID_VF:
@@ -461,7 +464,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
VFont *vf= (VFont *)id;
if (vf->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) {
if (strcmp(vf->name, FO_BUILTIN_NAME) != 0) {
- rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, userdata);
+ rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data);
}
}
}
@@ -472,10 +475,10 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
if (tex->plugin) {
/* FIXME: rewrite_path assumes path length of FILE_MAX, but
tex->plugin->name is 160. ... is this field even a path? */
- //rewrite_path(tex->plugin->name, visit_cb, userdata);
+ //rewrite_path(tex->plugin->name, visit_cb, bpath_user_data);
}
if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) {
- rewrite_path_fixed(tex->vd->source_path, visit_cb, absbase, userdata);
+ rewrite_path_fixed(tex->vd->source_path, visit_cb, absbase, bpath_user_data);
}
}
break;
@@ -489,7 +492,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
SEQ_BEGIN(scene->ed, seq) {
if (SEQ_HAS_PATH(seq)) {
if (ELEM(seq->type, SEQ_MOVIE, SEQ_SOUND)) {
- rewrite_path_fixed_dirfile(seq->strip->dir, seq->strip->stripdata->name, visit_cb, absbase, userdata);
+ rewrite_path_fixed_dirfile(seq->strip->dir, seq->strip->stripdata->name, visit_cb, absbase, bpath_user_data);
}
else if (seq->type == SEQ_IMAGE) {
/* might want an option not to loop over all strips */
@@ -498,16 +501,16 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
int i;
for(i= 0; i < len; i++, se++) {
- rewrite_path_fixed_dirfile(seq->strip->dir, se->name, visit_cb, absbase, userdata);
+ rewrite_path_fixed_dirfile(seq->strip->dir, se->name, visit_cb, absbase, bpath_user_data);
}
}
else {
/* simple case */
- rewrite_path_fixed(seq->strip->dir, visit_cb, absbase, userdata);
+ rewrite_path_fixed(seq->strip->dir, visit_cb, absbase, bpath_user_data);
}
}
else if (seq->plugin) {
- rewrite_path_fixed(seq->plugin->name, visit_cb, absbase, userdata);
+ rewrite_path_fixed(seq->plugin->name, visit_cb, absbase, bpath_user_data);
}
}
@@ -519,14 +522,14 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
{
Mesh *me= (Mesh *)id;
if (me->fdata.external) {
- rewrite_path_fixed(me->fdata.external->filename, visit_cb, absbase, userdata);
+ rewrite_path_fixed(me->fdata.external->filename, visit_cb, absbase, bpath_user_data);
}
}
break;
case ID_LI:
{
Library *lib= (Library *)id;
- if(rewrite_path_fixed(lib->name, visit_cb, absbase, userdata)) {
+ if(rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
BKE_library_filepath_set(lib, lib->name);
}
}
@@ -537,19 +540,19 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
}
}
-void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata)
+void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
ID *id;
for(id= lb->first; id; id= id->next) {
- bpath_traverse_id(bmain, id, visit_cb, flag, userdata);
+ bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data);
}
}
-void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata)
+void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
{
ListBase *lbarray[MAX_LIBARRAY];
int a= set_listbasepointers(bmain, lbarray);
- while(a--) bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, userdata);
+ while(a--) bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
}
/* Rewrites a relative path to be relative to the main file - unless the path is