diff options
-rw-r--r-- | source/blender/blenkernel/BKE_library.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 40 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 2 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 2 | ||||
-rw-r--r-- | source/blender/src/filesel.c | 10 |
5 files changed, 25 insertions, 31 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index 0331afe580b..e4c7006959c 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -59,7 +59,7 @@ void free_main(struct Main *mainvar); void splitIDname(char *name, char *left, int *nr); void rename_id(struct ID *id, char *name); void test_idbutton(char *name); -void all_local(void); +void all_local(Library *lib); struct ID *find_id(char *type, char *name); void clear_id_newpoins(void); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 3b325a06627..48355d6cc49 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -107,7 +107,7 @@ #include "BPI_script.h" #define MAX_IDPUP 30 /* was 24 */ -#define MAX_LIBARRAY 100 /* was 30 */ +#define MAX_LIBARRAY 100 /* was 30, warning: used it readfile.c too */ /* ************* general ************************ */ @@ -836,7 +836,8 @@ void clear_id_newpoins() } } -void all_local(void) +/* if lib!=NULL, only all from lib local */ +void all_local(Library *lib) { ListBase *lbarray[MAX_LIBARRAY], tempbase={0, 0}; ID *id, *idn; @@ -847,35 +848,20 @@ void all_local(void) id= lbarray[a]->first; while(id) { - id->newid= 0; - id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW); - + id->newid= NULL; idn= id->next; /* id is possibly being inserted again */ - if(id->lib) { - id->lib= 0; - new_id(lbarray[a], id, 0); /* new_id only does it with double names */ - sort_alpha_id(lbarray[a], id); - } - else { - /* patch: check for alphabetic ordering */ - /* has been removed... why!? (ton) */ -/* - if(idn) { - if(strcasecmp(id->name, idn->name)>0) { - remlink(lbarray[a], id); - addtail(&tempbase, id); - } - else if(id->prev) { - idp= id->prev; - if(strcasecmp(idp->name, id->name)>0) { - remlink(lbarray[a], id); - addtail(&tempbase, id); - } + + if(id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW)) { + if(lib==NULL || id->lib==lib) { + id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW); + + if(id->lib) { + id->lib= NULL; + new_id(lbarray[a], id, 0); /* new_id only does it with double names */ + sort_alpha_id(lbarray[a], id); } } -*/ } - id= idn; } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6d8272f7a48..42d4e3c52a4 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -374,7 +374,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist); static void add_main_to_main(Main *mainvar, Main *from) { - ListBase *lbarray[30], *fromarray[30]; + ListBase *lbarray[100], *fromarray[100]; // define in library.c too int a; a= set_listbasepointers(mainvar, lbarray); diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 41ea244c3e7..6b9344a5014 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -6466,7 +6466,7 @@ void make_local(void) mode= pupmenu("Make Local%t|Selected %x1|All %x2"); if(mode==2) { - all_local(); + all_local(NULL); // NULL is all libs allqueue(REDRAWALL, 0); return; } diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index 0bc79c84ef7..88b7f793c2c 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -2231,6 +2231,7 @@ static int is_a_library(SpaceFile *sfile, char *dir, char *group) static void do_library_append(SpaceFile *sfile) { + Library *lib; char dir[FILE_MAXDIR], group[32]; if ( is_a_library(sfile, dir, group)==0 ) { @@ -2269,7 +2270,14 @@ static void do_library_append(SpaceFile *sfile) /* in sfile->dir is the whole lib name */ strcpy(G.lib, sfile->dir); - if((sfile->flag & FILE_LINK)==0) all_local(); + /* and now find the latest append lib file */ + lib= G.main->library.first; + while(lib) { + if (BLI_streq(dir, lib->name)) break; + lib= lib->id.next; + } + + if((sfile->flag & FILE_LINK)==0) all_local(lib); } } |