fix [#27437] Appending armatures with custom bone shapes brings no custom objects...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 19 May 2011 06:17:44 +0000 (06:17 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 19 May 2011 06:17:44 +0000 (06:17 +0000)
source/blender/blenloader/intern/readfile.c

index c25f9d9e04451012d8fe05b23976cbd67c45aa89..e5e1fb049b0e251e31821194458d2014e5c0849f 100644 (file)
@@ -4140,7 +4140,7 @@ static void direct_link_object(FileData *fd, Object *ob)
        bActuator *act;
        int a;
        
-       /* weak weak... this was only meant as draw flag, now is used in give_base too */
+       /* weak weak... this was only meant as draw flag, now is used in give_base_to_objects too */
        ob->flag &= ~OB_FROMGROUP;
 
        /* loading saved files with editmode enabled works, but for undo we like
@@ -12735,12 +12735,22 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, int is
                                
                                int do_it= 0;
                                
-                               if(ob->id.us==0)
+                               if(ob->id.us==0) {
                                        do_it= 1;
-                               else if(ob->id.us==1 && lib)
-                                       if(ob->id.lib==lib && (ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0)
+                               }
+                               else if (lib==NULL) { /* appending */
+                                       if(object_in_any_scene(mainvar, ob)==0) {
+                                               /* when appending, make sure any indirectly loaded objects
+                                                * get a base else they cant be accessed at all [#27437] */
                                                do_it= 1;
-                                               
+                                       }
+                               }
+                               else if(ob->id.us==1 && lib) {
+                                       if(ob->id.lib==lib && (ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
+                                               do_it= 1;
+                                       }
+                               }
+
                                if(do_it) {
                                        base= MEM_callocN( sizeof(Base), "add_ext_base");
                                        BLI_addtail(&(sce->base), base);
@@ -13010,6 +13020,9 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
                        give_base_to_objects(mainvar, scene, NULL, 0);
                }
        }
+       else {
+               printf("library_append_end, scene is NULL (objects wont get bases)\n");
+       }
        /* 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) */