make relative paths wasnt working, also disallowed it when the blend file isnt saved

This commit is contained in:
Campbell Barton
2007-12-20 10:52:56 +00:00
parent 9b89abaa8b
commit a637aca44a
2 changed files with 6 additions and 4 deletions

View File

@@ -345,7 +345,7 @@ void makeFilesRelative(int *tot, int *changed, int *failed, int *linked) {
filepath = BLI_bpathIterator_getPath(&bpi); filepath = BLI_bpathIterator_getPath(&bpi);
libpath = BLI_bpathIterator_getLib(&bpi); libpath = BLI_bpathIterator_getLib(&bpi);
if(strncmp(filepath, "//", 2)==0) { if(strncmp(filepath, "//", 2)) {
if (libpath) { /* cant make relative if we are kibrary - TODO, LOG THIS */ if (libpath) { /* cant make relative if we are kibrary - TODO, LOG THIS */
(*linked)++; (*linked)++;
} else { /* local data, use the blend files path */ } else { /* local data, use the blend files path */
@@ -356,10 +356,10 @@ void makeFilesRelative(int *tot, int *changed, int *failed, int *linked) {
} else { } else {
/* safe to to check the length */ /* safe to to check the length */
if(strncmp(filepath_relative, "//", 2)==0) { if(strncmp(filepath_relative, "//", 2)==0) {
(*failed)++;
} else {
strcpy(filepath, filepath_relative); strcpy(filepath, filepath_relative);
(*changed)++; (*changed)++;
} else {
(*failed)++;
} }
} }
} }

View File

@@ -953,12 +953,14 @@ static void do_info_externalfiles(void *arg, int event)
} }
break; break;
case 10: /* make all paths relative */ case 10: /* make all paths relative */
{ if (G.relbase_valid) {
int tot,changed,failed,linked; int tot,changed,failed,linked;
char str[512]; char str[512];
makeFilesRelative(&tot, &changed, &failed, &linked); makeFilesRelative(&tot, &changed, &failed, &linked);
sprintf(str, "Make Relative%%t|Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked); sprintf(str, "Make Relative%%t|Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
pupmenu(str); pupmenu(str);
} else {
pupmenu("Can't set relative paths with an unsaved blend file");
} }
break; break;
case 11: /* check images exist */ case 11: /* check images exist */