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:
authorTon Roosendaal <ton@blender.org>2004-04-22 23:58:54 +0400
committerTon Roosendaal <ton@blender.org>2004-04-22 23:58:54 +0400
commit438331af8e4679a0dcd3c32b95a71861c38b75c1 (patch)
tree53e9ac2b8fee78e20165bd5d1200fdb22c4f85f4 /source/blender
parent66578d290002950bec57310b9967ceee3dc502a6 (diff)
Nasty Library linking and appending stuff!
Problem: when appending data, it called the local_all() function, which indeed made all data local, including all other dynamic linked data. Not very nice... but mixing dynamic & appending data from single file is headcrunching code. Solution: when appending data, it now only makes local_all() the data from that specific library file, leaving dynamic data from other files linked. (Bug report 1183)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/intern/library.c40
-rw-r--r--source/blender/blenloader/intern/readfile.c2
-rw-r--r--source/blender/src/editobject.c2
-rw-r--r--source/blender/src/filesel.c10
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);
}
}