From f87603662d03bf908094ed7a7f002a07bf13be38 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 14 Jul 2016 13:03:22 +0200 Subject: Add option to id_make_local to force localization of datablock, even if not used locally. Will be used by link/append code. --- source/blender/blenkernel/intern/action.c | 6 ++--- source/blender/blenkernel/intern/anim_sys.c | 10 ++++---- source/blender/blenkernel/intern/armature.c | 6 ++--- source/blender/blenkernel/intern/brush.c | 8 +++--- source/blender/blenkernel/intern/camera.c | 6 ++--- source/blender/blenkernel/intern/curve.c | 8 +++--- source/blender/blenkernel/intern/image.c | 6 ++--- source/blender/blenkernel/intern/key.c | 2 +- source/blender/blenkernel/intern/lamp.c | 6 ++--- source/blender/blenkernel/intern/lattice.c | 8 +++--- source/blender/blenkernel/intern/library.c | 40 ++++++++++++++--------------- source/blender/blenkernel/intern/material.c | 6 ++--- source/blender/blenkernel/intern/mball.c | 6 ++--- source/blender/blenkernel/intern/mesh.c | 8 +++--- source/blender/blenkernel/intern/node.c | 6 ++--- source/blender/blenkernel/intern/object.c | 6 ++--- source/blender/blenkernel/intern/particle.c | 6 ++--- source/blender/blenkernel/intern/speaker.c | 6 ++--- source/blender/blenkernel/intern/texture.c | 6 ++--- source/blender/blenkernel/intern/world.c | 6 ++--- 20 files changed, 81 insertions(+), 81 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index f7ff1261c8a..fa49797126d 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -95,11 +95,11 @@ bAction *add_empty_action(Main *bmain, const char name[]) /* .................................. */ // does copy_fcurve... -void BKE_action_make_local(Main *bmain, bAction *act) +void BKE_action_make_local(Main *bmain, bAction *act, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -110,7 +110,7 @@ void BKE_action_make_local(Main *bmain, bAction *act) BKE_library_ID_test_usages(bmain, act, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &act->id); BKE_id_expand_local(&act->id); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index d6f93528262..d04b950c043 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -400,8 +400,8 @@ static void make_local_strips(ListBase *strips) NlaStrip *strip; for (strip = strips->first; strip; strip = strip->next) { - if (strip->act) BKE_action_make_local(G.main, strip->act); - if (strip->remap && strip->remap->target) BKE_action_make_local(G.main, strip->remap->target); + if (strip->act) BKE_action_make_local(G.main, strip->act, false); + if (strip->remap && strip->remap->target) BKE_action_make_local(G.main, strip->remap->target, false); make_local_strips(&strip->strips); } @@ -413,10 +413,10 @@ void BKE_animdata_make_local(AnimData *adt) NlaTrack *nlt; /* Actions - Active and Temp */ - if (adt->action) BKE_action_make_local(G.main, adt->action); - if (adt->tmpact) BKE_action_make_local(G.main, adt->tmpact); + if (adt->action) BKE_action_make_local(G.main, adt->action, false); + if (adt->tmpact) BKE_action_make_local(G.main, adt->tmpact, false); /* Remaps */ - if (adt->remap && adt->remap->target) BKE_action_make_local(G.main, adt->remap->target); + if (adt->remap && adt->remap->target) BKE_action_make_local(G.main, adt->remap->target, false); /* Drivers */ /* TODO: need to remap the ID-targets too? */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 5f564e1c4d2..53e28177bdf 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -144,11 +144,11 @@ void BKE_armature_free(bArmature *arm) } } -void BKE_armature_make_local(Main *bmain, bArmature *arm) +void BKE_armature_make_local(Main *bmain, bArmature *arm, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -159,7 +159,7 @@ void BKE_armature_make_local(Main *bmain, bArmature *arm) BKE_library_ID_test_usages(bmain, arm, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &arm->id); BKE_id_expand_local(&arm->id); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 20621feac6c..3d9cabdc15d 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -219,11 +219,11 @@ void BKE_brush_free(Brush *brush) BKE_previewimg_free(&(brush->preview)); } -void BKE_brush_make_local(Main *bmain, Brush *brush) +void BKE_brush_make_local(Main *bmain, Brush *brush, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -234,12 +234,12 @@ void BKE_brush_make_local(Main *bmain, Brush *brush) if (brush->clone.image) { /* Special case: ima always local immediately. Clone image should only have one user anyway. */ - id_make_local(bmain, &brush->clone.image->id, false); + id_make_local(bmain, &brush->clone.image->id, false, false); } BKE_library_ID_test_usages(bmain, brush, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &brush->id); BKE_id_expand_local(&brush->id); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index ae7aac8b54f..cd085816b4d 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -107,11 +107,11 @@ Camera *BKE_camera_copy(Main *bmain, Camera *cam) return camn; } -void BKE_camera_make_local(Main *bmain, Camera *cam) +void BKE_camera_make_local(Main *bmain, Camera *cam, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -122,7 +122,7 @@ void BKE_camera_make_local(Main *bmain, Camera *cam) BKE_library_ID_test_usages(bmain, cam, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &cam->id); BKE_id_expand_local(&cam->id); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 0e634e21ea3..fa7dac5d432 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -215,11 +215,11 @@ Curve *BKE_curve_copy(Main *bmain, Curve *cu) return cun; } -void BKE_curve_make_local(Main *bmain, Curve *cu) +void BKE_curve_make_local(Main *bmain, Curve *cu, const bool force_local) { bool is_local = false, is_lib = false; - /* - when there are only lib users: don't do + /* - only lib users: do nothing (unless force_local is set) * - when there are only local users: set flag * - mixed: do a copy */ @@ -230,11 +230,11 @@ void BKE_curve_make_local(Main *bmain, Curve *cu) BKE_library_ID_test_usages(bmain, cu, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &cu->id); if (cu->key) { - BKE_key_make_local(bmain, cu->key); + BKE_key_make_local(bmain, cu->key, force_local); } BKE_id_expand_local(&cu->id); } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index f993c05e198..ae3163d388e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -469,11 +469,11 @@ Image *BKE_image_copy(Main *bmain, Image *ima) return nima; } -void BKE_image_make_local(Main *bmain, Image *ima) +void BKE_image_make_local(Main *bmain, Image *ima, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -484,7 +484,7 @@ void BKE_image_make_local(Main *bmain, Image *ima) BKE_library_ID_test_usages(bmain, ima, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &ima->id); BKE_id_expand_local(&ima->id); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index e59facd3c39..c61aee704d2 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -203,7 +203,7 @@ Key *BKE_key_copy_nolib(Key *key) return keyn; } -void BKE_key_make_local(Main *bmain, Key *key) +void BKE_key_make_local(Main *bmain, Key *key, const bool UNUSED(force_local)) { /* Note that here for now we simply just make it local... * Sounds fishy behavior, but since skeys are not *real* IDs... */ diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index 003b154a70b..c224b5ca0a7 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -172,11 +172,11 @@ Lamp *localize_lamp(Lamp *la) return lan; } -void BKE_lamp_make_local(Main *bmain, Lamp *la) +void BKE_lamp_make_local(Main *bmain, Lamp *la, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -187,7 +187,7 @@ void BKE_lamp_make_local(Main *bmain, Lamp *la) BKE_library_ID_test_usages(bmain, la, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &la->id); BKE_id_expand_local(&la->id); diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 67f49266efc..9d4f14110a2 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -330,11 +330,11 @@ void BKE_lattice_free(Lattice *lt) } -void BKE_lattice_make_local(Main *bmain, Lattice *lt) +void BKE_lattice_make_local(Main *bmain, Lattice *lt, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -345,11 +345,11 @@ void BKE_lattice_make_local(Main *bmain, Lattice *lt) BKE_library_ID_test_usages(bmain, lt, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, <->id); if (lt->key) { - BKE_key_make_local(bmain, lt->key); + BKE_key_make_local(bmain, lt->key, force_local); } BKE_id_expand_local(<->id); } diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 869e02448ea..4680d481ff6 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -271,7 +271,7 @@ void BKE_id_expand_local(ID *id) /* calls the appropriate make_local method for the block, unless test. Returns true * if the block can be made local. */ -bool id_make_local(Main *bmain, ID *id, bool test) +bool id_make_local(Main *bmain, ID *id, const bool test, const bool force_local) { if (id->tag & LIB_TAG_INDIRECT) return false; @@ -282,45 +282,45 @@ bool id_make_local(Main *bmain, ID *id, bool test) case ID_LI: return false; /* can't be linked */ case ID_OB: - if (!test) BKE_object_make_local(bmain, (Object *)id); + if (!test) BKE_object_make_local(bmain, (Object *)id, force_local); return true; case ID_ME: - if (!test) BKE_mesh_make_local(bmain, (Mesh *)id); + if (!test) BKE_mesh_make_local(bmain, (Mesh *)id, force_local); return true; case ID_CU: - if (!test) BKE_curve_make_local(bmain, (Curve *)id); + if (!test) BKE_curve_make_local(bmain, (Curve *)id, force_local); return true; case ID_MB: - if (!test) BKE_mball_make_local(bmain, (MetaBall *)id); + if (!test) BKE_mball_make_local(bmain, (MetaBall *)id, force_local); return true; case ID_MA: - if (!test) BKE_material_make_local(bmain, (Material *)id); + if (!test) BKE_material_make_local(bmain, (Material *)id, force_local); return true; case ID_TE: - if (!test) BKE_texture_make_local(bmain, (Tex *)id); + if (!test) BKE_texture_make_local(bmain, (Tex *)id, force_local); return true; case ID_IM: - if (!test) BKE_image_make_local(bmain, (Image *)id); + if (!test) BKE_image_make_local(bmain, (Image *)id, force_local); return true; case ID_LT: - if (!test) BKE_lattice_make_local(bmain, (Lattice *)id); + if (!test) BKE_lattice_make_local(bmain, (Lattice *)id, force_local); return true; case ID_LA: - if (!test) BKE_lamp_make_local(bmain, (Lamp *)id); + if (!test) BKE_lamp_make_local(bmain, (Lamp *)id, force_local); return true; case ID_CA: - if (!test) BKE_camera_make_local(bmain, (Camera *)id); + if (!test) BKE_camera_make_local(bmain, (Camera *)id, force_local); return true; case ID_SPK: - if (!test) BKE_speaker_make_local(bmain, (Speaker *)id); + if (!test) BKE_speaker_make_local(bmain, (Speaker *)id, force_local); return true; case ID_IP: return false; /* deprecated */ case ID_KE: - if (!test) BKE_key_make_local(bmain, (Key *)id); + if (!test) BKE_key_make_local(bmain, (Key *)id, force_local); return true; case ID_WO: - if (!test) BKE_world_make_local(bmain, (World *)id); + if (!test) BKE_world_make_local(bmain, (World *)id, force_local); return true; case ID_SCR: return false; /* can't be linked */ @@ -333,19 +333,19 @@ bool id_make_local(Main *bmain, ID *id, bool test) case ID_GR: return false; /* not implemented */ case ID_AR: - if (!test) BKE_armature_make_local(bmain, (bArmature *)id); + if (!test) BKE_armature_make_local(bmain, (bArmature *)id, force_local); return true; case ID_AC: - if (!test) BKE_action_make_local(bmain, (bAction *)id); + if (!test) BKE_action_make_local(bmain, (bAction *)id, force_local); return true; case ID_NT: - if (!test) ntreeMakeLocal(bmain, (bNodeTree *)id, true); + if (!test) ntreeMakeLocal(bmain, (bNodeTree *)id, true, force_local); return true; case ID_BR: - if (!test) BKE_brush_make_local(bmain, (Brush *)id); + if (!test) BKE_brush_make_local(bmain, (Brush *)id, force_local); return true; case ID_PA: - if (!test) BKE_particlesettings_make_local(bmain, (ParticleSettings *)id); + if (!test) BKE_particlesettings_make_local(bmain, (ParticleSettings *)id, force_local); return true; case ID_WM: return false; /* can't be linked */ @@ -1487,7 +1487,7 @@ void id_clear_lib_data_ex(Main *bmain, ID *id, bool id_in_mainlist) ntree = ntreeFromID(id); if (ntree) { - ntreeMakeLocal(bmain, ntree, false); + ntreeMakeLocal(bmain, ntree, false, false); } if (GS(id->name) == ID_OB) { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 17811893c03..2ae369fdd1b 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -285,11 +285,11 @@ Material *localize_material(Material *ma) return man; } -void BKE_material_make_local(Main *bmain, Material *ma) +void BKE_material_make_local(Main *bmain, Material *ma, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -300,7 +300,7 @@ void BKE_material_make_local(Main *bmain, Material *ma) BKE_library_ID_test_usages(bmain, ma, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &ma->id); BKE_id_expand_local(&ma->id); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 9a0a6e3540c..aeb38b3bd1d 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -127,11 +127,11 @@ MetaBall *BKE_mball_copy(Main *bmain, MetaBall *mb) return mbn; } -void BKE_mball_make_local(Main *bmain, MetaBall *mb) +void BKE_mball_make_local(Main *bmain, MetaBall *mb, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -142,7 +142,7 @@ void BKE_mball_make_local(Main *bmain, MetaBall *mb) BKE_library_ID_test_usages(bmain, mb, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &mb->id); BKE_id_expand_local(&mb->id); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 787b9905734..1dd22f4a32b 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -555,11 +555,11 @@ BMesh *BKE_mesh_to_bmesh( return bm; } -void BKE_mesh_make_local(Main *bmain, Mesh *me) +void BKE_mesh_make_local(Main *bmain, Mesh *me, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -570,11 +570,11 @@ void BKE_mesh_make_local(Main *bmain, Mesh *me) BKE_library_ID_test_usages(bmain, me, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &me->id); if (me->key) { - BKE_key_make_local(bmain, me->key); + BKE_key_make_local(bmain, me->key, force_local); } BKE_id_expand_local(&me->id); } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 296a00388c4..1058b22f96e 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1951,11 +1951,11 @@ bNodeTree *ntreeFromID(ID *id) } } -void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, bool id_in_mainlist) +void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, bool id_in_mainlist, const bool force_local) { bool is_lib = false, is_local = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -1966,7 +1966,7 @@ void ntreeMakeLocal(Main *bmain, bNodeTree *ntree, bool id_in_mainlist) BKE_library_ID_test_usages(bmain, ntree, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data_ex(bmain, (ID *)ntree, id_in_mainlist); BKE_id_expand_local(&ntree->id); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 30a193506a6..4bdcec51360 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1186,11 +1186,11 @@ Object *BKE_object_copy(Main *bmain, Object *ob) return BKE_object_copy_ex(bmain, ob, false); } -void BKE_object_make_local(Main *bmain, Object *ob) +void BKE_object_make_local(Main *bmain, Object *ob, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -1201,7 +1201,7 @@ void BKE_object_make_local(Main *bmain, Object *ob) BKE_library_ID_test_usages(bmain, ob, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &ob->id); BKE_id_expand_local(&ob->id); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 934c5b9ff06..2ff6c6c8b65 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3343,11 +3343,11 @@ ParticleSettings *BKE_particlesettings_copy(Main *bmain, ParticleSettings *part) return partn; } -void BKE_particlesettings_make_local(Main *bmain, ParticleSettings *part) +void BKE_particlesettings_make_local(Main *bmain, ParticleSettings *part, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -3358,7 +3358,7 @@ void BKE_particlesettings_make_local(Main *bmain, ParticleSettings *part) BKE_library_ID_test_usages(bmain, part, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &part->id); BKE_id_expand_local(&part->id); diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index a91d8657179..c027f3b38ca 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -85,11 +85,11 @@ Speaker *BKE_speaker_copy(Main *bmain, Speaker *spk) return spkn; } -void BKE_speaker_make_local(Main *bmain, Speaker *spk) +void BKE_speaker_make_local(Main *bmain, Speaker *spk, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -100,7 +100,7 @@ void BKE_speaker_make_local(Main *bmain, Speaker *spk) BKE_library_ID_test_usages(bmain, spk, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &spk->id); BKE_id_expand_local(&spk->id); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index e34d632f2ca..460417cc2c0 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -918,11 +918,11 @@ Tex *BKE_texture_localize(Tex *tex) /* ------------------------------------------------------------------------- */ -void BKE_texture_make_local(Main *bmain, Tex *tex) +void BKE_texture_make_local(Main *bmain, Tex *tex, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -933,7 +933,7 @@ void BKE_texture_make_local(Main *bmain, Tex *tex) BKE_library_ID_test_usages(bmain, tex, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &tex->id); BKE_id_expand_local(&tex->id); diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 9795a8174f8..277aeaa7e42 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -176,11 +176,11 @@ World *localize_world(World *wrld) return wrldn; } -void BKE_world_make_local(Main *bmain, World *wrld) +void BKE_world_make_local(Main *bmain, World *wrld, const bool force_local) { bool is_local = false, is_lib = false; - /* - only lib users: do nothing + /* - only lib users: do nothing (unless force_local is set) * - only local users: set flag * - mixed: make copy */ @@ -191,7 +191,7 @@ void BKE_world_make_local(Main *bmain, World *wrld) BKE_library_ID_test_usages(bmain, wrld, &is_local, &is_lib); - if (is_local) { + if (force_local || is_local) { if (!is_lib) { id_clear_lib_data(bmain, &wrld->id); BKE_id_expand_local(&wrld->id); -- cgit v1.2.3