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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-09-03 21:24:07 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-09-03 21:24:07 +0400
commitd14121308d1ea5842b68a372da13e327abdef823 (patch)
treee5212c99a217954e3d6c54646a45088ff83f1bd5 /source/blender/blenloader/intern/readfile.c
parent6cc84d7c99cb30b722aaaba672b4068f265a8f03 (diff)
Fix #36189: link group, delete instanced object, link group again would not
create an instance. Now it creates the instance even if the group was already linked into the .blend file.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 4b7c6f838f5..276538a7e18 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7139,7 +7139,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
if (id->flag & LIB_FAKEUSER) id->us= 1;
else id->us = 0;
id->icon_id = 0;
- id->flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA);
+ id->flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA|LIB_DOIT);
/* this case cannot be direct_linked: it's just the ID part */
if (bhead->code == ID_ID) {
@@ -10945,10 +10945,13 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
{
Group *group;
- /* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
+ /* give all objects which are tagged a base */
for (group = mainvar->group.first; group; group = group->id.next) {
- if (((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) {
+ if (group->id.flag & LIB_DOIT) {
Base *base;
+
+ /* any indirect group should not have been tagged */
+ BLI_assert((group->id.flag & LIB_INDIRECT)==0);
/* BKE_object_add(...) messes with the selection */
Object *ob = BKE_object_add_only_object(mainvar, OB_EMPTY, group->id.name + 2);
@@ -11076,6 +11079,11 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
}
}
}
+ else if (id && (GS(id->name) == ID_GR)) {
+ /* tag as needing to be instanced */
+ if (flag & FILE_GROUP_INSTANCE)
+ id->flag |= LIB_DOIT;
+ }
return id;
}
@@ -11121,6 +11129,9 @@ static Main *library_append_begin(Main *mainvar, FileData **fd, const char *file
(*fd)->mainlist = MEM_callocN(sizeof(ListBase), "FileData.mainlist");
+ /* clear for group instancing tag */
+ tag_main_lb(&(mainvar->group), 0);
+
/* make mains */
blo_split_main((*fd)->mainlist, mainvar);
@@ -11197,6 +11208,10 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
printf("library_append_end, scene is NULL (objects wont get bases)\n");
}
}
+
+ /* clear group instancing tag */
+ tag_main_lb(&(mainvar->group), 0);
+
/* has been removed... erm, why? s..ton) */
/* 20040907: looks like they are give base already in append_named_part(); -Nathan L */
/* 20041208: put back. It only linked direct, not indirect objects (ton) */