fix [#29459] Crash making a linked object group local

was an error with make-local refactor & path updating.
This commit is contained in:
Campbell Barton 2011-11-30 00:32:13 +00:00
parent aff705c430
commit 9b2df014d2
19 changed files with 111 additions and 106 deletions

@ -49,7 +49,7 @@ void *alloc_libblock(struct ListBase *lb, short type, const char *name);
void *copy_libblock(struct ID *id); void *copy_libblock(struct ID *id);
void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action); 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 id_lib_extern(struct ID *id);
void BKE_library_filepath_set(struct Library *lib, const char *filepath); void BKE_library_filepath_set(struct Library *lib, const char *filepath);
void id_us_plus(struct ID *id); void id_us_plus(struct ID *id);

@ -93,7 +93,7 @@ bAction *add_empty_action(const char name[])
/* temp data for make_local_action */ /* temp data for make_local_action */
typedef struct tMakeLocalActionContext { typedef struct tMakeLocalActionContext {
bAction *act; /* original action */ bAction *act; /* original action */
bAction *actn; /* new action */ bAction *act_new; /* new action */
int is_lib; /* some action users were libraries */ int is_lib; /* some action users were libraries */
int is_local; /* some action users were not 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 (adt->action == mlac->act) {
if (id->lib == NULL) { 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); id_us_min(&mlac->act->id);
} }
} }
@ -146,10 +146,10 @@ void make_local_action(bAction *act)
id_clear_lib_data(bmain, &act->id); id_clear_lib_data(bmain, &act->id);
} }
else if (mlac.is_local && mlac.is_lib) { else if (mlac.is_local && mlac.is_lib) {
mlac.actn= copy_action(act); mlac.act_new= copy_action(act);
mlac.actn->id.us= 0; 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); BKE_animdata_main_cb(bmain, make_localact_apply_cb, &mlac);
} }

@ -158,17 +158,17 @@ void make_local_armature(bArmature *arm)
id_clear_lib_data(bmain, &arm->id); id_clear_lib_data(bmain, &arm->id);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
bArmature *armn= copy_armature(arm); bArmature *arm_new= copy_armature(arm);
armn->id.us= 0; arm_new->id.us= 0;
/* Remap paths of new ID using old library as base. */ /* 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) { for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == arm) { if(ob->data == arm) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->data= armn; ob->data= arm_new;
armn->id.us++; arm_new->id.us++;
arm->id.us--; arm->id.us--;
} }
} }

@ -224,17 +224,17 @@ void make_local_brush(Brush *brush)
} }
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
Brush *brushn= copy_brush(brush); Brush *brush_new= copy_brush(brush);
brushn->id.us= 1; /* only keep fake user */ brush_new->id.us= 1; /* only keep fake user */
brushn->id.flag |= LIB_FAKEUSER; brush_new->id.flag |= LIB_FAKEUSER;
/* Remap paths of new ID using old library as base. */ /* 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) { for(scene= bmain->scene.first; scene; scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) { if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
if(scene->id.lib==NULL) { if(scene->id.lib==NULL) {
paint_brush_set(&scene->toolsettings->imapaint.paint, brushn); paint_brush_set(&scene->toolsettings->imapaint.paint, brush_new);
} }
} }
} }

@ -108,18 +108,18 @@ void make_local_camera(Camera *cam)
id_clear_lib_data(bmain, &cam->id); id_clear_lib_data(bmain, &cam->id);
} }
else if(is_local && is_lib) { 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. */ /* 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) { for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == cam) { if(ob->data == cam) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->data= camn; ob->data= cam_new;
camn->id.us++; cam_new->id.us++;
cam->id.us--; cam->id.us--;
} }
} }

@ -274,16 +274,16 @@ void make_local_curve(Curve *cu)
extern_local_curve(cu); extern_local_curve(cu);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
Curve *cun= copy_curve(cu); Curve *cu_new= copy_curve(cu);
cun->id.us= 0; 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) { for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==cu) { if(ob->data==cu) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->data= cun; ob->data= cu_new;
cun->id.us++; cu_new->id.us++;
cu->id.us--; cu->id.us--;
} }
} }

@ -385,19 +385,19 @@ void make_local_image(struct Image *ima)
extern_local_image(ima); extern_local_image(ima);
} }
else if(is_local && is_lib) { 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. */ /* 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; tex= bmain->tex.first;
while(tex) { while(tex) {
if(tex->id.lib==NULL) { if(tex->id.lib==NULL) {
if(tex->ima==ima) { if(tex->ima==ima) {
tex->ima = iman; tex->ima = ima_new;
iman->id.us++; ima_new->id.us++;
ima->id.us--; ima->id.us--;
} }
} }
@ -407,8 +407,8 @@ void make_local_image(struct Image *ima)
while(brush) { while(brush) {
if(brush->id.lib==NULL) { if(brush->id.lib==NULL) {
if(brush->clone.image==ima) { if(brush->clone.image==ima) {
brush->clone.image = iman; brush->clone.image = ima_new;
iman->id.us++; ima_new->id.us++;
ima->id.us--; ima->id.us--;
} }
} }
@ -429,11 +429,11 @@ void make_local_image(struct Image *ima)
for(a=0; a<me->totface; a++, tface++) { for(a=0; a<me->totface; a++, tface++) {
if(tface->tpage == ima) { if(tface->tpage == ima) {
tface->tpage = iman; tface->tpage = ima_new;
if(iman->id.us == 0) { if(ima_new->id.us == 0) {
tface->tpage->id.us= 1; tface->tpage->id.us= 1;
} }
id_lib_extern((ID*)iman); id_lib_extern((ID*)ima_new);
} }
} }
} }

@ -184,19 +184,19 @@ void make_local_lamp(Lamp *la)
id_clear_lib_data(bmain, &la->id); id_clear_lib_data(bmain, &la->id);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
Lamp *lan= copy_lamp(la); Lamp *la_new= copy_lamp(la);
lan->id.us= 0; la_new->id.us= 0;
/* Remap paths of new ID using old library as base. */ /* 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; ob= bmain->object.first;
while(ob) { while(ob) {
if(ob->data==la) { if(ob->data==la) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->data= lan; ob->data= la_new;
lan->id.us++; la_new->id.us++;
la->id.us--; la->id.us--;
} }
} }

@ -271,17 +271,17 @@ void make_local_lattice(Lattice *lt)
id_clear_lib_data(bmain, &lt->id); id_clear_lib_data(bmain, &lt->id);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
Lattice *ltn= copy_lattice(lt); Lattice *lt_new= copy_lattice(lt);
ltn->id.us= 0; lt_new->id.us= 0;
/* Remap paths of new ID using old library as base. */ /* 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) { for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==lt) { if(ob->data==lt) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->data= ltn; ob->data= lt_new;
ltn->id.us++; lt_new->id.us++;
lt->id.us--; lt->id.us--;
} }
} }

@ -136,9 +136,9 @@
* from id_make_local() but then the make local functions would not be self * from id_make_local() but then the make local functions would not be self
* contained. * contained.
* also note that the id _must_ have a library - campbell */ * 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_traverse_id(bmain, id,
bpath_relocate_visitor, bpath_relocate_visitor,
@ -1278,7 +1278,7 @@ int new_id(ListBase *lb, ID *id, const char *tname)
don't have other library users. */ don't have other library users. */
void id_clear_lib_data(Main *bmain, ID *id) 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->lib= NULL;
id->flag= LIB_LOCAL; id->flag= LIB_LOCAL;

@ -364,12 +364,12 @@ void make_local_material(Material *ma)
} }
/* Both user and local, so copy. */ /* Both user and local, so copy. */
else if(is_local && is_lib) { 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. */ /* 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 */ /* do objects */
ob= bmain->object.first; ob= bmain->object.first;
@ -378,8 +378,8 @@ void make_local_material(Material *ma)
for(a=0; a<ob->totcol; a++) { for(a=0; a<ob->totcol; a++) {
if(ob->mat[a]==ma) { if(ob->mat[a]==ma) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->mat[a]= man; ob->mat[a]= ma_new;
man->id.us++; ma_new->id.us++;
ma->id.us--; ma->id.us--;
} }
} }
@ -394,8 +394,8 @@ void make_local_material(Material *ma)
for(a=0; a<me->totcol; a++) { for(a=0; a<me->totcol; a++) {
if(me->mat[a]==ma) { if(me->mat[a]==ma) {
if(me->id.lib==NULL) { if(me->id.lib==NULL) {
me->mat[a]= man; me->mat[a]= ma_new;
man->id.us++; ma_new->id.us++;
ma->id.us--; ma->id.us--;
} }
} }
@ -410,8 +410,8 @@ void make_local_material(Material *ma)
for(a=0; a<cu->totcol; a++) { for(a=0; a<cu->totcol; a++) {
if(cu->mat[a]==ma) { if(cu->mat[a]==ma) {
if(cu->id.lib==NULL) { if(cu->id.lib==NULL) {
cu->mat[a]= man; cu->mat[a]= ma_new;
man->id.us++; ma_new->id.us++;
ma->id.us--; ma->id.us--;
} }
} }
@ -426,8 +426,8 @@ void make_local_material(Material *ma)
for(a=0; a<mb->totcol; a++) { for(a=0; a<mb->totcol; a++) {
if(mb->mat[a]==ma) { if(mb->mat[a]==ma) {
if(mb->id.lib==NULL) { if(mb->id.lib==NULL) {
mb->mat[a]= man; mb->mat[a]= ma_new;
man->id.us++; ma_new->id.us++;
ma->id.us--; ma->id.us--;
} }
} }

@ -174,17 +174,17 @@ void make_local_mball(MetaBall *mb)
extern_local_mball(mb); extern_local_mball(mb);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
MetaBall *mbn= copy_mball(mb); MetaBall *mb_new= copy_mball(mb);
mbn->id.us= 0; mb_new->id.us= 0;
/* Remap paths of new ID using old library as base. */ /* 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) { for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->data == mb) { if(ob->data == mb) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->data= mbn; ob->data= mb_new;
mbn->id.us++; mb_new->id.us++;
mb->id.us--; mb->id.us--;
} }
} }

@ -298,17 +298,17 @@ void make_local_mesh(Mesh *me)
expand_local_mesh(me); expand_local_mesh(me);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
Mesh *men= copy_mesh(me); Mesh *me_new= copy_mesh(me);
men->id.us= 0; me_new->id.us= 0;
/* Remap paths of new ID using old library as base. */ /* 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) { for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(me == ob->data) { if(me == ob->data) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
set_mesh(ob, men); set_mesh(ob, me_new);
} }
} }
} }

@ -1233,12 +1233,12 @@ void make_local_object(Object *ob)
extern_local_object(ob); extern_local_object(ob);
} }
else if(is_local && is_lib) { 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. */ /* 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; sce= bmain->scene.first;
while(sce) { while(sce) {
@ -1246,8 +1246,8 @@ void make_local_object(Object *ob)
base= sce->base.first; base= sce->base.first;
while(base) { while(base) {
if(base->object==ob) { if(base->object==ob) {
base->object= obn; base->object= ob_new;
obn->id.us++; ob_new->id.us++;
ob->id.us--; ob->id.us--;
} }
base= base->next; base= base->next;

@ -3643,20 +3643,20 @@ void make_local_particlesettings(ParticleSettings *part)
expand_local_particlesettings(part); expand_local_particlesettings(part);
} }
else if(is_local && is_lib) { 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. */ /* 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 */ /* do objects */
for(ob= bmain->object.first; ob; ob= ob->id.next) { for(ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys; ParticleSystem *psys;
for(psys= ob->particlesystem.first; psys; psys=psys->next){ for(psys= ob->particlesystem.first; psys; psys=psys->next){
if(psys->part==part && ob->id.lib==0) { if(psys->part==part && ob->id.lib==0) {
psys->part= partn; psys->part= part_new;
partn->id.us++; part_new->id.us++;
part->id.us--; part->id.us--;
} }
} }

@ -106,19 +106,19 @@ void make_local_speaker(Speaker *spk)
id_clear_lib_data(bmain, &spk->id); id_clear_lib_data(bmain, &spk->id);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
Speaker *spkn= copy_speaker(spk); Speaker *spk_new= copy_speaker(spk);
spkn->id.us= 0; spk_new->id.us= 0;
/* Remap paths of new ID using old library as base. */ /* 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; ob= bmain->object.first;
while(ob) { while(ob) {
if(ob->data==spk) { if(ob->data==spk) {
if(ob->id.lib==NULL) { if(ob->id.lib==NULL) {
ob->data= spkn; ob->data= spk_new;
spkn->id.us++; spk_new->id.us++;
spk->id.us--; spk->id.us--;
} }
} }

@ -973,20 +973,20 @@ void make_local_texture(Tex *tex)
extern_local_texture(tex); extern_local_texture(tex);
} }
else if(is_local && is_lib) { 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. */ /* 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; ma= bmain->mat.first;
while(ma) { while(ma) {
for(a=0; a<MAX_MTEX; a++) { for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a] && ma->mtex[a]->tex==tex) { if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
if(ma->id.lib==NULL) { if(ma->id.lib==NULL) {
ma->mtex[a]->tex= texn; ma->mtex[a]->tex= tex_new;
texn->id.us++; tex_new->id.us++;
tex->id.us--; tex->id.us--;
} }
} }
@ -998,8 +998,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) { for(a=0; a<MAX_MTEX; a++) {
if(la->mtex[a] && la->mtex[a]->tex==tex) { if(la->mtex[a] && la->mtex[a]->tex==tex) {
if(la->id.lib==NULL) { if(la->id.lib==NULL) {
la->mtex[a]->tex= texn; la->mtex[a]->tex= tex_new;
texn->id.us++; tex_new->id.us++;
tex->id.us--; tex->id.us--;
} }
} }
@ -1011,8 +1011,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) { for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) { if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
if(wrld->id.lib==NULL) { if(wrld->id.lib==NULL) {
wrld->mtex[a]->tex= texn; wrld->mtex[a]->tex= tex_new;
texn->id.us++; tex_new->id.us++;
tex->id.us--; tex->id.us--;
} }
} }
@ -1023,8 +1023,8 @@ void make_local_texture(Tex *tex)
while(br) { while(br) {
if(br->mtex.tex==tex) { if(br->mtex.tex==tex) {
if(br->id.lib==NULL) { if(br->id.lib==NULL) {
br->mtex.tex= texn; br->mtex.tex= tex_new;
texn->id.us++; tex_new->id.us++;
tex->id.us--; tex->id.us--;
} }
} }
@ -1035,8 +1035,8 @@ void make_local_texture(Tex *tex)
for(a=0; a<MAX_MTEX; a++) { for(a=0; a<MAX_MTEX; a++) {
if(pa->mtex[a] && pa->mtex[a]->tex==tex) { if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
if(pa->id.lib==NULL) { if(pa->id.lib==NULL) {
pa->mtex[a]->tex= texn; pa->mtex[a]->tex= tex_new;
texn->id.us++; tex_new->id.us++;
tex->id.us--; tex->id.us--;
} }
} }

@ -190,17 +190,17 @@ void make_local_world(World *wrld)
id_clear_lib_data(bmain, &wrld->id); id_clear_lib_data(bmain, &wrld->id);
} }
else if(is_local && is_lib) { else if(is_local && is_lib) {
World *wrldn= copy_world(wrld); World *wrld_new= copy_world(wrld);
wrldn->id.us= 0; wrld_new->id.us= 0;
/* Remap paths of new ID using old library as base. */ /* 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) { for(sce= bmain->scene.first; sce; sce= sce->id.next) {
if(sce->world == wrld) { if(sce->world == wrld) {
if(sce->id.lib==NULL) { if(sce->id.lib==NULL) {
sce->world= wrldn; sce->world= wrld_new;
wrldn->id.us++; wrld_new->id.us++;
wrld->id.us--; wrld->id.us--;
} }
} }

@ -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)) { 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);
}
} }
} }