From b1566742516a66d2b68ebb4bacb6802582c09489 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 21 Jul 2016 16:09:08 +0200 Subject: Fix missing datablocks types in id_make_local. Adding make_local for vfont/gpencil/group/freestyle linestyle/mask/scene/sound/text. Note that there are still some lose ends here, since some type are not handled by id_copy (Scene, Sound and VFont), which means in case a datablock of that type is used both directly and indirectly, localization will fail. Scene copying might be doable though (maybe with a simple new 'full shalow' mode to existing BKE_scene_copy?), not sure about sounds and vfonts... Situations where this becomes an issue should be very rare corner cases anyway. --- source/blender/blenkernel/intern/text.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenkernel/intern/text.c') diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 269d6d32b31..82c3132d73e 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -499,6 +499,11 @@ Text *BKE_text_copy(Main *bmain, Text *ta) return tan; } +void BKE_text_make_local(Main *bmain, Text *text, const bool lib_local) +{ + BKE_id_make_local_generic(bmain, &text->id, true, lib_local); +} + void BKE_text_clear(Text *text) /* called directly from rna */ { int oldstate; -- cgit v1.2.3 From 1870e166deaa4ced1bb5226e97e037db10dbd06c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 25 Jul 2016 16:15:37 +0200 Subject: Cleanup: factorize the 'ensure local' part of datablock copy into a single BKE_id_copy_ensure_local function. --- source/blender/blenkernel/intern/text.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/text.c') diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 82c3132d73e..1636042f479 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -491,10 +491,7 @@ Text *BKE_text_copy(Main *bmain, Text *ta) init_undo_text(tan); - if (ID_IS_LINKED_DATABLOCK(ta)) { - BKE_id_expand_local(&tan->id); - BKE_id_lib_local_paths(bmain, ta->id.lib, &tan->id); - } + BKE_id_copy_ensure_local(bmain, &ta->id, &tan->id); return tan; } -- cgit v1.2.3