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-11-30 04:32:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-30 04:32:13 +0400
commit9b2df014d2ab714c4ff0ec9848f25a7db7f54142 (patch)
treea571e2a262f8d5ccbeb8b94fcc3d320c9dadb378 /source/blender
parentaff705c4305cf972992fd4750dccc8b7b4a343b8 (diff)
fix [#29459] Crash making a linked object group local
was an error with make-local refactor & path updating.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/intern/action.c14
-rw-r--r--source/blender/blenkernel/intern/armature.c10
-rw-r--r--source/blender/blenkernel/intern/brush.c10
-rw-r--r--source/blender/blenkernel/intern/camera.c10
-rw-r--r--source/blender/blenkernel/intern/curve.c10
-rw-r--r--source/blender/blenkernel/intern/image.c20
-rw-r--r--source/blender/blenkernel/intern/lamp.c10
-rw-r--r--source/blender/blenkernel/intern/lattice.c10
-rw-r--r--source/blender/blenkernel/intern/library.c6
-rw-r--r--source/blender/blenkernel/intern/material.c22
-rw-r--r--source/blender/blenkernel/intern/mball.c10
-rw-r--r--source/blender/blenkernel/intern/mesh.c8
-rw-r--r--source/blender/blenkernel/intern/object.c10
-rw-r--r--source/blender/blenkernel/intern/particle.c10
-rw-r--r--source/blender/blenkernel/intern/speaker.c10
-rw-r--r--source/blender/blenkernel/intern/texture.c26
-rw-r--r--source/blender/blenkernel/intern/world.c10
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c9
19 files changed, 111 insertions, 106 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index ade055ac457..e8d6c85664b 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -49,7 +49,7 @@ void *alloc_libblock(struct ListBase *lb, short type, const char *name);
void *copy_libblock(struct ID *id);
void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action);
-void BKE_id_lib_local_paths(struct Main *bmain, struct ID *id);
+void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
void id_lib_extern(struct ID *id);
void BKE_library_filepath_set(struct Library *lib, const char *filepath);
void id_us_plus(struct ID *id);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 5fb03b7bbd0..767401a55ef 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -92,8 +92,8 @@ bAction *add_empty_action(const char name[])
/* temp data for make_local_action */
typedef struct tMakeLocalActionContext {
- bAction *act; /* original action */
- bAction *actn; /* new action */
+ bAction *act; /* original action */
+ bAction *act_new; /* new action */
int is_lib; /* some action users were libraries */
int is_local; /* some action users were not libraries */
@@ -117,9 +117,9 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
if (adt->action == mlac->act) {
if (id->lib == NULL) {
- adt->action = mlac->actn;
+ adt->action = mlac->act_new;
- id_us_plus(&mlac->actn->id);
+ id_us_plus(&mlac->act_new->id);
id_us_min(&mlac->act->id);
}
}
@@ -146,10 +146,10 @@ void make_local_action(bAction *act)
id_clear_lib_data(bmain, &act->id);
}
else if (mlac.is_local && mlac.is_lib) {
- mlac.actn= copy_action(act);
- mlac.actn->id.us= 0;
+ mlac.act_new= copy_action(act);
+ mlac.act_new->id.us= 0;
- BKE_id_lib_local_paths(bmain, &mlac.actn->id);
+ BKE_id_lib_local_paths(bmain, act->id.lib, &mlac.act_new->id);
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 a9c29728650..2157bd5999b 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -158,17 +158,17 @@ void make_local_armature(bArmature *arm)
id_clear_lib_data(bmain, &arm->id);
}
else if(is_local && is_lib) {
- bArmature *armn= copy_armature(arm);
- armn->id.us= 0;
+ bArmature *arm_new= copy_armature(arm);
+ arm_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &armn->id);
+ BKE_id_lib_local_paths(bmain, arm->id.lib, &arm_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == arm) {
if(ob->id.lib==NULL) {
- ob->data= armn;
- armn->id.us++;
+ ob->data= arm_new;
+ arm_new->id.us++;
arm->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 5303baddbca..7fac273ef77 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -224,17 +224,17 @@ void make_local_brush(Brush *brush)
}
}
else if(is_local && is_lib) {
- Brush *brushn= copy_brush(brush);
- brushn->id.us= 1; /* only keep fake user */
- brushn->id.flag |= LIB_FAKEUSER;
+ Brush *brush_new= copy_brush(brush);
+ brush_new->id.us= 1; /* only keep fake user */
+ brush_new->id.flag |= LIB_FAKEUSER;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &brush->id);
+ BKE_id_lib_local_paths(bmain, brush->id.lib, &brush_new->id);
for(scene= bmain->scene.first; scene; scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
if(scene->id.lib==NULL) {
- paint_brush_set(&scene->toolsettings->imapaint.paint, brushn);
+ paint_brush_set(&scene->toolsettings->imapaint.paint, brush_new);
}
}
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 08e8a80750e..2bd973d7799 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -108,18 +108,18 @@ void make_local_camera(Camera *cam)
id_clear_lib_data(bmain, &cam->id);
}
else if(is_local && is_lib) {
- Camera *camn= copy_camera(cam);
+ Camera *cam_new= copy_camera(cam);
- camn->id.us= 0;
+ cam_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &camn->id);
+ BKE_id_lib_local_paths(bmain, cam->id.lib, &cam_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == cam) {
if(ob->id.lib==NULL) {
- ob->data= camn;
- camn->id.us++;
+ ob->data= cam_new;
+ cam_new->id.us++;
cam->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 358c63b4f9f..0f1c73c59c1 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -274,16 +274,16 @@ void make_local_curve(Curve *cu)
extern_local_curve(cu);
}
else if(is_local && is_lib) {
- Curve *cun= copy_curve(cu);
- cun->id.us= 0;
+ Curve *cu_new= copy_curve(cu);
+ cu_new->id.us= 0;
- BKE_id_lib_local_paths(bmain, &cun->id);
+ BKE_id_lib_local_paths(bmain, cu->id.lib, &cu_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==cu) {
if(ob->id.lib==NULL) {
- ob->data= cun;
- cun->id.us++;
+ ob->data= cu_new;
+ cu_new->id.us++;
cu->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index c7f74f37a2d..fb734ea4f3d 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -385,19 +385,19 @@ void make_local_image(struct Image *ima)
extern_local_image(ima);
}
else if(is_local && is_lib) {
- Image *iman= copy_image(ima);
+ Image *ima_new= copy_image(ima);
- iman->id.us= 0;
+ ima_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &iman->id);
+ BKE_id_lib_local_paths(bmain, ima->id.lib, &ima_new->id);
tex= bmain->tex.first;
while(tex) {
if(tex->id.lib==NULL) {
if(tex->ima==ima) {
- tex->ima = iman;
- iman->id.us++;
+ tex->ima = ima_new;
+ ima_new->id.us++;
ima->id.us--;
}
}
@@ -407,8 +407,8 @@ void make_local_image(struct Image *ima)
while(brush) {
if(brush->id.lib==NULL) {
if(brush->clone.image==ima) {
- brush->clone.image = iman;
- iman->id.us++;
+ brush->clone.image = ima_new;
+ ima_new->id.us++;
ima->id.us--;
}
}
@@ -429,11 +429,11 @@ void make_local_image(struct Image *ima)
for(a=0; a<me->totface; a++, tface++) {
if(tface->tpage == ima) {
- tface->tpage = iman;
- if(iman->id.us == 0) {
+ tface->tpage = ima_new;
+ if(ima_new->id.us == 0) {
tface->tpage->id.us= 1;
}
- id_lib_extern((ID*)iman);
+ id_lib_extern((ID*)ima_new);
}
}
}
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 4edd032dc04..6b4cdc70aea 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -184,19 +184,19 @@ void make_local_lamp(Lamp *la)
id_clear_lib_data(bmain, &la->id);
}
else if(is_local && is_lib) {
- Lamp *lan= copy_lamp(la);
- lan->id.us= 0;
+ Lamp *la_new= copy_lamp(la);
+ la_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &lan->id);
+ BKE_id_lib_local_paths(bmain, la->id.lib, &la_new->id);
ob= bmain->object.first;
while(ob) {
if(ob->data==la) {
if(ob->id.lib==NULL) {
- ob->data= lan;
- lan->id.us++;
+ ob->data= la_new;
+ la_new->id.us++;
la->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 7c9e2be4493..4f02fdd1f46 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -271,17 +271,17 @@ void make_local_lattice(Lattice *lt)
id_clear_lib_data(bmain, &lt->id);
}
else if(is_local && is_lib) {
- Lattice *ltn= copy_lattice(lt);
- ltn->id.us= 0;
+ Lattice *lt_new= copy_lattice(lt);
+ lt_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &ltn->id);
+ BKE_id_lib_local_paths(bmain, lt->id.lib, &lt_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==lt) {
if(ob->id.lib==NULL) {
- ob->data= ltn;
- ltn->id.us++;
+ ob->data= lt_new;
+ lt_new->id.us++;
lt->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 7332b89f629..7a4780eb984 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -136,9 +136,9 @@
* from id_make_local() but then the make local functions would not be self
* contained.
* also note that the id _must_ have a library - campbell */
-void BKE_id_lib_local_paths(Main *bmain, ID *id)
+void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
{
- char *bpath_user_data[2]= {bmain->name, (id)->lib->filepath};
+ char *bpath_user_data[2]= {bmain->name, lib->filepath};
bpath_traverse_id(bmain, id,
bpath_relocate_visitor,
@@ -1278,7 +1278,7 @@ 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)
{
- BKE_id_lib_local_paths(bmain, id);
+ BKE_id_lib_local_paths(bmain, id->lib, id);
id->lib= NULL;
id->flag= LIB_LOCAL;
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index ecf74b1d8e1..60ae86063e8 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -364,12 +364,12 @@ void make_local_material(Material *ma)
}
/* Both user and local, so copy. */
else if(is_local && is_lib) {
- Material *man= copy_material(ma);
+ Material *ma_new= copy_material(ma);
- man->id.us= 0;
+ ma_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &man->id);
+ BKE_id_lib_local_paths(bmain, ma->id.lib, &ma_new->id);
/* do objects */
ob= bmain->object.first;
@@ -378,8 +378,8 @@ void make_local_material(Material *ma)
for(a=0; a<ob->totcol; a++) {
if(ob->mat[a]==ma) {
if(ob->id.lib==NULL) {
- ob->mat[a]= man;
- man->id.us++;
+ ob->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
@@ -394,8 +394,8 @@ void make_local_material(Material *ma)
for(a=0; a<me->totcol; a++) {
if(me->mat[a]==ma) {
if(me->id.lib==NULL) {
- me->mat[a]= man;
- man->id.us++;
+ me->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
@@ -410,8 +410,8 @@ void make_local_material(Material *ma)
for(a=0; a<cu->totcol; a++) {
if(cu->mat[a]==ma) {
if(cu->id.lib==NULL) {
- cu->mat[a]= man;
- man->id.us++;
+ cu->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
@@ -426,8 +426,8 @@ void make_local_material(Material *ma)
for(a=0; a<mb->totcol; a++) {
if(mb->mat[a]==ma) {
if(mb->id.lib==NULL) {
- mb->mat[a]= man;
- man->id.us++;
+ mb->mat[a]= ma_new;
+ ma_new->id.us++;
ma->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 3e3f16dcfa3..0883ec121d6 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -174,17 +174,17 @@ void make_local_mball(MetaBall *mb)
extern_local_mball(mb);
}
else if(is_local && is_lib) {
- MetaBall *mbn= copy_mball(mb);
- mbn->id.us= 0;
+ MetaBall *mb_new= copy_mball(mb);
+ mb_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &mbn->id);
+ BKE_id_lib_local_paths(bmain, mb->id.lib, &mb_new->id);
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->data == mb) {
if(ob->id.lib==NULL) {
- ob->data= mbn;
- mbn->id.us++;
+ ob->data= mb_new;
+ mb_new->id.us++;
mb->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index ec9d4873057..ab45aeed8c3 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -298,17 +298,17 @@ void make_local_mesh(Mesh *me)
expand_local_mesh(me);
}
else if(is_local && is_lib) {
- Mesh *men= copy_mesh(me);
- men->id.us= 0;
+ Mesh *me_new= copy_mesh(me);
+ me_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &men->id);
+ BKE_id_lib_local_paths(bmain, me->id.lib, &me_new->id);
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(me == ob->data) {
if(ob->id.lib==NULL) {
- set_mesh(ob, men);
+ set_mesh(ob, me_new);
}
}
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 887b8409e59..7ebb63c4e16 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1233,12 +1233,12 @@ void make_local_object(Object *ob)
extern_local_object(ob);
}
else if(is_local && is_lib) {
- Object *obn= copy_object(ob);
+ Object *ob_new= copy_object(ob);
- obn->id.us= 0;
+ ob_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &obn->id);
+ BKE_id_lib_local_paths(bmain, ob->id.lib, &ob_new->id);
sce= bmain->scene.first;
while(sce) {
@@ -1246,8 +1246,8 @@ void make_local_object(Object *ob)
base= sce->base.first;
while(base) {
if(base->object==ob) {
- base->object= obn;
- obn->id.us++;
+ base->object= ob_new;
+ ob_new->id.us++;
ob->id.us--;
}
base= base->next;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 7c71df9fece..0f2d14e3858 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3643,20 +3643,20 @@ void make_local_particlesettings(ParticleSettings *part)
expand_local_particlesettings(part);
}
else if(is_local && is_lib) {
- ParticleSettings *partn= psys_copy_settings(part);
+ ParticleSettings *part_new= psys_copy_settings(part);
- partn->id.us= 0;
+ part_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &partn->id);
+ BKE_id_lib_local_paths(bmain, part->id.lib, &part_new->id);
/* do objects */
for(ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys;
for(psys= ob->particlesystem.first; psys; psys=psys->next){
if(psys->part==part && ob->id.lib==0) {
- psys->part= partn;
- partn->id.us++;
+ psys->part= part_new;
+ part_new->id.us++;
part->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index a14233e9179..d2c8a8031ee 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -106,19 +106,19 @@ void make_local_speaker(Speaker *spk)
id_clear_lib_data(bmain, &spk->id);
}
else if(is_local && is_lib) {
- Speaker *spkn= copy_speaker(spk);
- spkn->id.us= 0;
+ Speaker *spk_new= copy_speaker(spk);
+ spk_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &spkn->id);
+ BKE_id_lib_local_paths(bmain, spk->id.lib, &spk_new->id);
ob= bmain->object.first;
while(ob) {
if(ob->data==spk) {
if(ob->id.lib==NULL) {
- ob->data= spkn;
- spkn->id.us++;
+ ob->data= spk_new;
+ spk_new->id.us++;
spk->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index a67a61c7638..13205326dd2 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -973,20 +973,20 @@ void make_local_texture(Tex *tex)
extern_local_texture(tex);
}
else if(is_local && is_lib) {
- Tex *texn= copy_texture(tex);
+ Tex *tex_new= copy_texture(tex);
- texn->id.us= 0;
+ tex_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &texn->id);
+ BKE_id_lib_local_paths(bmain, tex->id.lib, &tex_new->id);
ma= bmain->mat.first;
while(ma) {
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
if(ma->id.lib==NULL) {
- ma->mtex[a]->tex= texn;
- texn->id.us++;
+ ma->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -998,8 +998,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a] && la->mtex[a]->tex==tex) {
if(la->id.lib==NULL) {
- la->mtex[a]->tex= texn;
- texn->id.us++;
+ la->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -1011,8 +1011,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
if(wrld->id.lib==NULL) {
- wrld->mtex[a]->tex= texn;
- texn->id.us++;
+ wrld->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -1023,8 +1023,8 @@ void make_local_texture(Tex *tex)
while(br) {
if(br->mtex.tex==tex) {
if(br->id.lib==NULL) {
- br->mtex.tex= texn;
- texn->id.us++;
+ br->mtex.tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
@@ -1035,8 +1035,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) {
if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
if(pa->id.lib==NULL) {
- pa->mtex[a]->tex= texn;
- texn->id.us++;
+ pa->mtex[a]->tex= tex_new;
+ tex_new->id.us++;
tex->id.us--;
}
}
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 1d6972b9d61..b3f1e140829 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -190,17 +190,17 @@ void make_local_world(World *wrld)
id_clear_lib_data(bmain, &wrld->id);
}
else if(is_local && is_lib) {
- World *wrldn= copy_world(wrld);
- wrldn->id.us= 0;
+ World *wrld_new= copy_world(wrld);
+ wrld_new->id.us= 0;
/* Remap paths of new ID using old library as base. */
- BKE_id_lib_local_paths(bmain, &wrldn->id);
+ BKE_id_lib_local_paths(bmain, wrld->id.lib, &wrld_new->id);
for(sce= bmain->scene.first; sce; sce= sce->id.next) {
if(sce->world == wrld) {
if(sce->id.lib==NULL) {
- sce->world= wrldn;
- wrldn->id.us++;
+ sce->world= wrld_new;
+ wrld_new->id.us++;
wrld->id.us--;
}
}
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index f4e46d0255d..09a125692d2 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -307,10 +307,15 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
}
}
-static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
{
if (tselem->id->lib && (tselem->id->flag & LIB_EXTERN)) {
- id_clear_lib_data(NULL, tselem->id);
+ /* if the ID type has no special local function,
+ * just clear the lib */
+ if (id_make_local(tselem->id, FALSE) == FALSE) {
+ Main *bmain= CTX_data_main(C);
+ id_clear_lib_data(bmain, tselem->id);
+ }
}
}