Revision: 59773
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59773
Author:   blendix
Date:     2013-09-03 17:24:07 +0000 (Tue, 03 Sep 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c   2013-09-03 
16:28:53 UTC (rev 59772)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c   2013-09-03 
17:24:07 UTC (rev 59773)
@@ -7139,7 +7139,7 @@
        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 @@
 {
        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 @@
                        }
                }
        }
+       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 @@
 
        (*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 @@
                        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) */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to