Added 'File->External Data->Make all files Absolute'
OpenGL stamp also wasnt checking correctly (own error)
This commit is contained in:
@@ -812,8 +812,8 @@ static void stampdata(StampData *stamp_data, int do_prefix)
|
||||
}
|
||||
|
||||
if (G.scene->r.stamp & R_STAMP_NOTE) {
|
||||
if (do_prefix) sprintf(stamp_data->note, "Note %s", G.scene->r.stamp_udata);
|
||||
else sprintf(stamp_data->note, "%s", G.scene->r.stamp_udata);
|
||||
/* Never do prefix for Note */
|
||||
sprintf(stamp_data->note, "%s", G.scene->r.stamp_udata);
|
||||
} else {
|
||||
stamp_data->note[0] = '\0';
|
||||
}
|
||||
|
@@ -56,4 +56,5 @@ void BLI_bpathIterator_copyPathExpanded( struct BPathIterator *bpi, char *path
|
||||
/* creates a text file with missing files if there are any */
|
||||
struct Text * checkMissingFiles(void);
|
||||
void makeFilesRelative(int *tot, int *changed, int *failed, int *linked);
|
||||
void makeFilesAbsolute(int *tot, int *changed, int *failed, int *linked);
|
||||
void findMissingFiles(char *str);
|
||||
|
@@ -347,15 +347,15 @@ void makeFilesRelative(int *tot, int *changed, int *failed, int *linked) {
|
||||
libpath = BLI_bpathIterator_getLib(&bpi);
|
||||
|
||||
if(strncmp(filepath, "//", 2)) {
|
||||
if (libpath) { /* cant make relative if we are kibrary - TODO, LOG THIS */
|
||||
if (libpath) { /* cant make relative if we are library - TODO, LOG THIS */
|
||||
(*linked)++;
|
||||
} else { /* local data, use the blend files path */
|
||||
BLI_strncpy(filepath_relative, filepath, sizeof(filepath_relative));
|
||||
BLI_makestringcode(G.sce, filepath_relative);
|
||||
if (BLI_bpathIterator_getPathMaxLen(&bpi) < strlen(filepath_relative)) {
|
||||
/* be safe and check the length */
|
||||
if (BLI_bpathIterator_getPathMaxLen(&bpi) <= strlen(filepath_relative)) {
|
||||
(*failed)++;
|
||||
} else {
|
||||
/* safe to to check the length */
|
||||
if(strncmp(filepath_relative, "//", 2)==0) {
|
||||
strcpy(filepath, filepath_relative);
|
||||
(*changed)++;
|
||||
@@ -365,12 +365,52 @@ void makeFilesRelative(int *tot, int *changed, int *failed, int *linked) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BLI_bpathIterator_step(&bpi);
|
||||
(*tot)++;
|
||||
}
|
||||
}
|
||||
|
||||
/* dont log any errors at the moment, should probably do this -
|
||||
* Verry similar to makeFilesRelative - keep in sync! */
|
||||
void makeFilesAbsolute(int *tot, int *changed, int *failed, int *linked) {
|
||||
struct BPathIterator bpi;
|
||||
char *filepath, *libpath;
|
||||
|
||||
/* be sure there is low chance of the path being too short */
|
||||
char filepath_absolute[(FILE_MAXDIR * 2) + FILE_MAXFILE];
|
||||
|
||||
*tot = *changed = *failed = *linked = 0;
|
||||
|
||||
BLI_bpathIterator_init(&bpi);
|
||||
while (!BLI_bpathIterator_isDone(&bpi)) {
|
||||
filepath = BLI_bpathIterator_getPath(&bpi);
|
||||
libpath = BLI_bpathIterator_getLib(&bpi);
|
||||
|
||||
if(strncmp(filepath, "//", 2)==0) {
|
||||
if (libpath) { /* cant make absolute if we are library - TODO, LOG THIS */
|
||||
(*linked)++;
|
||||
} else { /* get the expanded path and check it is relative or too long */
|
||||
BLI_bpathIterator_copyPathExpanded( &bpi, filepath_absolute );
|
||||
|
||||
/* safe be safe, check the length */
|
||||
if (BLI_bpathIterator_getPathMaxLen(&bpi) <= strlen(filepath_absolute)) {
|
||||
(*failed)++;
|
||||
} else {
|
||||
if(strncmp(filepath_absolute, "//", 2)) {
|
||||
strcpy(filepath, filepath_absolute);
|
||||
(*changed)++;
|
||||
} else {
|
||||
(*failed)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_bpathIterator_step(&bpi);
|
||||
(*tot)++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
|
||||
- dir: subdir to search
|
||||
- filename: set this filename
|
||||
@@ -387,8 +427,6 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
|
||||
char path[FILE_MAX];
|
||||
int size;
|
||||
|
||||
printf("DIR %s\n", dirname);
|
||||
|
||||
dir = opendir(dirname);
|
||||
|
||||
if (dir==0)
|
||||
|
@@ -963,7 +963,16 @@ static void do_info_externalfiles(void *arg, int event)
|
||||
pupmenu("Can't set relative paths with an unsaved blend file");
|
||||
}
|
||||
break;
|
||||
case 11: /* check images exist */
|
||||
case 11: /* make all paths relative */
|
||||
{
|
||||
int tot,changed,failed,linked;
|
||||
char str[512];
|
||||
makeFilesAbsolute(&tot, &changed, &failed, &linked);
|
||||
sprintf(str, "Make Absolute%%t|Total files %i|Changed %i|Failed %i|Linked %i", tot, changed, failed, linked);
|
||||
pupmenu(str);
|
||||
}
|
||||
break;
|
||||
case 12: /* check images exist */
|
||||
{
|
||||
/* Its really text but only care about the name */
|
||||
ID *btxt = (ID *)checkMissingFiles();
|
||||
@@ -977,7 +986,7 @@ static void do_info_externalfiles(void *arg, int event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 12: /* search for referenced files that are not available */
|
||||
case 13: /* search for referenced files that are not available */
|
||||
activate_fileselect(FILE_SPECIAL, "Find Missing Files", "", findMissingFiles);
|
||||
break;
|
||||
}
|
||||
@@ -1002,8 +1011,9 @@ static uiBlock *info_externalfiles(void *arg_unused)
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Relative", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 10, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 11, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make all Paths Absolute", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 11, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Report Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 12, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Find Missing Files", 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, 13, "");
|
||||
|
||||
uiBlockSetDirection(block, UI_RIGHT);
|
||||
uiTextBoundsBlock(block, 60);
|
||||
|
@@ -1300,7 +1300,9 @@ void BIF_do_ogl_render(View3D *v3d, int anim)
|
||||
|
||||
do_ogl_view3d_render(re, v3d, winx, winy);
|
||||
glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32);
|
||||
BKE_stamp_buf((unsigned char *)rr->rect32, rr->rectf, rr->rectx, rr->recty);
|
||||
if((G.scene->r.scemode & R_STAMP_INFO) && (G.scene->r.stamp & R_STAMP_DRAW)) {
|
||||
BKE_stamp_buf((unsigned char *)rr->rect32, rr->rectf, rr->rectx, rr->recty);
|
||||
}
|
||||
window_swap_buffers(render_win->win);
|
||||
|
||||
if(BKE_imtype_is_movie(G.scene->r.imtype)) {
|
||||
@@ -1340,7 +1342,9 @@ void BIF_do_ogl_render(View3D *v3d, int anim)
|
||||
else {
|
||||
do_ogl_view3d_render(re, v3d, winx, winy);
|
||||
glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32);
|
||||
BKE_stamp_buf((unsigned char *)rr->rect32, rr->rectf, rr->rectx, rr->recty);
|
||||
if((G.scene->r.scemode & R_STAMP_INFO) && (G.scene->r.stamp & R_STAMP_DRAW)) {
|
||||
BKE_stamp_buf((unsigned char *)rr->rect32, rr->rectf, rr->rectx, rr->recty);
|
||||
}
|
||||
window_swap_buffers(render_win->win);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user