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:
authorCampbell Barton <ideasman42@gmail.com>2010-12-06 02:14:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-06 02:14:48 +0300
commit9668c29ba00ed830109665ea132b6292cdfe9e2a (patch)
tree45a9c23c9aaa382b10985b9c640b363f54c3f9c9 /source/blender/blenlib/intern/bpath.c
parentb110c7c8f2c5fafa6412e01d21d751a884bfe8b2 (diff)
bpath iterator updates
- loop over sequencer plugin and texture voxel paths. - fix leak in python bpy.utils.blend_path() and use PyUnicode_DecodeFSDefault() to ensure correct paths with different encodings. - operators to make paths absolute & relative now redraw the view.
Diffstat (limited to 'source/blender/blenlib/intern/bpath.c')
-rw-r--r--source/blender/blenlib/intern/bpath.c368
1 files changed, 262 insertions, 106 deletions
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index a21db4751f1..ab25f9f8982 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -29,6 +29,7 @@
#include <sys/stat.h>
#include <string.h>
+#include <assert.h>
/* path/file handeling stuff */
#ifndef WIN32
@@ -44,6 +45,8 @@
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h" /* to get the current frame */
#include "DNA_image_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_text_types.h"
#include "DNA_sound_types.h"
#include "DNA_sequence_types.h"
#include "DNA_vfont_types.h"
@@ -65,11 +68,39 @@
//XXX #include "BSE_sequence.h"
//XXX define below from BSE_sequence.h - otherwise potentially odd behaviour
+
+typedef struct BPathIteratorSeqData {
+ int totseq;
+ int seq;
+ struct Sequence **seqar; /* Sequence */
+ struct Scene *scene; /* Current scene */
+} BPathIteratorSeqData;
+
+typedef struct BPathIterator {
+ char* _path; /* never access directly, use BLI_bpathIterator_getPath */
+ const char* _lib;
+ const char* _name;
+ void* data;
+ int len;
+ int type;
+
+ void (*setpath_callback)(struct BPathIterator *, const char *);
+ void (*getpath_callback)(struct BPathIterator *, char *);
+
+ const char* base_path; /* base path, the directry the blend file is in - normally G.main->name */
+
+ /* only for seq data */
+ struct BPathIteratorSeqData seqdata;
+} BPathIterator;
+
#define FILE_MAX 240
+
/* TODO - BPATH_PLUGIN, BPATH_SEQ */
enum BPathTypes {
- BPATH_IMAGE = 0,
+ BPATH_IMAGE= 0,
+ BPATH_TEXTURE,
+ BPATH_TEXT,
BPATH_SOUND,
BPATH_FONT,
BPATH_LIB,
@@ -80,35 +111,39 @@ enum BPathTypes {
};
void BLI_bpathIterator_init( struct BPathIterator *bpi, const char *base_path ) {
- bpi->type = BPATH_IMAGE;
- bpi->data = NULL;
+ bpi->type= BPATH_IMAGE;
+ bpi->data= NULL;
- bpi->getpath_callback = NULL;
- bpi->setpath_callback = NULL;
+ bpi->getpath_callback= NULL;
+ bpi->setpath_callback= NULL;
/* Sequencer specific */
- bpi->seqdata.totseq = 0;
- bpi->seqdata.seq = 0;
- bpi->seqdata.seqar = NULL;
- bpi->seqdata.scene = NULL;
+ bpi->seqdata.totseq= 0;
+ bpi->seqdata.seq= 0;
+ bpi->seqdata.seqar= NULL;
+ bpi->seqdata.scene= NULL;
bpi->base_path= base_path ? base_path : G.main->name;
BLI_bpathIterator_step(bpi);
}
+void BLI_bpathIterator_alloc(struct BPathIterator **bpi) {
+ *bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc");
+}
+
void BLI_bpathIterator_free( struct BPathIterator *bpi ) {
if (bpi->seqdata.seqar)
MEM_freeN((void *)bpi->seqdata.seqar);
- bpi->seqdata.seqar = NULL;
- bpi->seqdata.scene = NULL;
+ bpi->seqdata.seqar= NULL;
+ bpi->seqdata.scene= NULL;
}
void BLI_bpathIterator_getPath( struct BPathIterator *bpi, char *path) {
if (bpi->getpath_callback) {
bpi->getpath_callback( bpi, path );
} else {
- strcpy(path, bpi->path); /* warning, we assume 'path' are long enough */
+ strcpy(path, bpi->_path); /* warning, we assume 'path' are long enough */
}
}
@@ -116,7 +151,7 @@ void BLI_bpathIterator_setPath( struct BPathIterator *bpi, const char *path) {
if (bpi->setpath_callback) {
bpi->setpath_callback( bpi, path );
} else {
- strcpy(bpi->path, path); /* warning, we assume 'path' are long enough */
+ strcpy(bpi->_path, path); /* warning, we assume 'path' are long enough */
}
}
@@ -124,7 +159,7 @@ void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_ex
const char *libpath;
BLI_bpathIterator_getPath(bpi, path_expanded);
- libpath = BLI_bpathIterator_getLib(bpi);
+ libpath= BLI_bpathIterator_getLib(bpi);
if (libpath) { /* check the files location relative to its library path */
BLI_path_abs(path_expanded, libpath);
@@ -134,10 +169,10 @@ void BLI_bpathIterator_getPathExpanded( struct BPathIterator *bpi, char *path_ex
BLI_cleanup_file(NULL, path_expanded);
}
const char* BLI_bpathIterator_getLib( struct BPathIterator *bpi) {
- return bpi->lib;
+ return bpi->_lib;
}
const char* BLI_bpathIterator_getName( struct BPathIterator *bpi) {
- return bpi->name;
+ return bpi->_name;
}
int BLI_bpathIterator_getType( struct BPathIterator *bpi) {
return bpi->type;
@@ -145,6 +180,9 @@ int BLI_bpathIterator_getType( struct BPathIterator *bpi) {
int BLI_bpathIterator_getPathMaxLen( struct BPathIterator *bpi) {
return bpi->len;
}
+const char* BLI_bpathIterator_getBasePath( struct BPathIterator *bpi) {
+ return bpi->base_path;
+}
/* gets the first or the next image that has a path - not a viewer node or generated image */
static struct Image *ima_stepdata__internal(struct Image *ima, int step_next) {
@@ -152,23 +190,55 @@ static struct Image *ima_stepdata__internal(struct Image *ima, int step_next) {
return NULL;
if (step_next)
- ima = ima->id.next;
+ ima= ima->id.next;
while (ima) {
if (ima->packedfile==NULL && ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
break;
/* image is not a image with a path, skip it */
- ima = ima->id.next;
+ ima= ima->id.next;
}
return ima;
}
+static struct Tex *tex_stepdata__internal(struct Tex *tex, int step_next) {
+ if (tex==NULL)
+ return NULL;
+
+ if (step_next)
+ tex= tex->id.next;
+
+ while (tex) {
+ if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format))
+ break;
+ /* image is not a image with a path, skip it */
+ tex= tex->id.next;
+ }
+ return tex;
+}
+
+static struct Text *text_stepdata__internal(struct Text *text, int step_next) {
+ if (text==NULL)
+ return NULL;
+
+ if (step_next)
+ text= text->id.next;
+
+ while (text) {
+ if (text->name)
+ break;
+ /* image is not a image with a path, skip it */
+ text= text->id.next;
+ }
+ return text;
+}
+
static struct VFont *vf_stepdata__internal(struct VFont *vf, int step_next) {
if (vf==NULL)
return NULL;
if (step_next)
- vf = vf->id.next;
+ vf= vf->id.next;
while (vf) {
if (vf->packedfile==NULL && strcmp(vf->name, FO_BUILTIN_NAME)!=0) {
@@ -176,7 +246,7 @@ static struct VFont *vf_stepdata__internal(struct VFont *vf, int step_next) {
}
/* font with no path, skip it */
- vf = vf->id.next;
+ vf= vf->id.next;
}
return vf;
}
@@ -186,7 +256,7 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next)
return NULL;
if (step_next)
- snd = snd->id.next;
+ snd= snd->id.next;
while (snd) {
if (snd->packedfile==NULL) {
@@ -194,7 +264,7 @@ static struct bSound *snd_stepdata__internal(struct bSound *snd, int step_next)
}
/* font with no path, skip it */
- snd = snd->id.next;
+ snd= snd->id.next;
}
return snd;
}
@@ -219,20 +289,20 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
if (bpi->seqdata.seqar == NULL) {
/* allocate the sequencer array */
seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
- bpi->seqdata.seq = 0;
+ bpi->seqdata.seq= 0;
}
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
- seq = NULL;
+ seq= NULL;
} else {
- seq = bpi->seqdata.seqar[bpi->seqdata.seq];
- while (!SEQ_HAS_PATH(seq)) {
+ seq= bpi->seqdata.seqar[bpi->seqdata.seq];
+ while (!SEQ_HAS_PATH(seq) && seq->plugin==NULL) {
bpi->seqdata.seq++;
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
- seq = NULL;
+ seq= NULL;
break;
}
- seq = bpi->seqdata.seqar[bpi->seqdata.seq];
+ seq= bpi->seqdata.seqar[bpi->seqdata.seq];
}
}
if (seq) {
@@ -241,13 +311,13 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
/* keep looking through the next scene, reallocate seq array */
if (bpi->seqdata.seqar) {
MEM_freeN((void *)bpi->seqdata.seqar);
- bpi->seqdata.seqar = NULL;
+ bpi->seqdata.seqar= NULL;
}
- bpi->seqdata.scene = bpi->seqdata.scene->id.next;
+ bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
} else {
/* no seq data in this scene, next */
- bpi->seqdata.scene = bpi->seqdata.scene->id.next;
+ bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
}
@@ -255,10 +325,10 @@ static struct Sequence *seq_stepdata__internal(struct BPathIterator *bpi, int st
}
static void seq_getpath(struct BPathIterator *bpi, char *path) {
- Sequence *seq = (Sequence *)bpi->data;
+ Sequence *seq= (Sequence *)bpi->data;
- path[0] = '\0'; /* incase we cant get the path */
+ path[0]= '\0'; /* incase we cant get the path */
if (seq==NULL) return;
if (SEQ_HAS_PATH(seq)) {
if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
@@ -268,25 +338,52 @@ static void seq_getpath(struct BPathIterator *bpi, char *path) {
/* Using the first image is weak for image sequences */
strcat(path, seq->strip->stripdata->name);
}
- } else {
+ }
+ else {
/* simple case */
BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));
}
}
+ else if (seq->plugin) {
+ BLI_strncpy(seq->plugin->name, path, sizeof(seq->plugin->name));
+ }
}
static void seq_setpath(struct BPathIterator *bpi, const char *path) {
- Sequence *seq = (Sequence *)bpi->data;
+ Sequence *seq= (Sequence *)bpi->data;
if (seq==NULL) return;
if (SEQ_HAS_PATH(seq)) {
if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) {
BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name);
- } else {
+ }
+ else {
/* simple case */
BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));
}
}
+ else if (seq->plugin) {
+ BLI_strncpy(seq->plugin->name, path, sizeof(seq->plugin->name));
+ }
+}
+
+static void text_getpath(struct BPathIterator *bpi, char *path) {
+ Text *text= (Text *)bpi->data;
+ path[0]= '\0'; /* incase we cant get the path */
+ if(text->name) {
+ strcpy(path, text->name);
+ }
+}
+
+static void text_setpath(struct BPathIterator *bpi, const char *path) {
+ Text *text= (Text *)bpi->data;
+ if (text==NULL) return;
+
+ if(text->name) {
+ MEM_freeN(text->name);
+ }
+
+ text->name= BLI_strdup(path);
}
static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next) {
@@ -294,30 +391,34 @@ static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next) {
return NULL;
if (step_next)
- me = me->id.next;
+ me= me->id.next;
while (me) {
if (me->fdata.external) {
break;
}
- me = me->id.next;
+ me= me->id.next;
}
return me;
}
static void bpi_type_step__internal( struct BPathIterator *bpi) {
bpi->type++; /* advance to the next type */
- bpi->data = NULL;
+ bpi->data= NULL;
switch (bpi->type) {
case BPATH_SEQ:
- bpi->getpath_callback = seq_getpath;
- bpi->setpath_callback = seq_setpath;
+ bpi->getpath_callback= seq_getpath;
+ bpi->setpath_callback= seq_setpath;
+ break;
+ case BPATH_TEXT: /* path is malloc'd */
+ bpi->getpath_callback= text_getpath;
+ bpi->setpath_callback= text_setpath;
break;
default:
- bpi->getpath_callback = NULL;
- bpi->setpath_callback = NULL;
+ bpi->getpath_callback= NULL;
+ bpi->setpath_callback= NULL;
break;
}
}
@@ -326,40 +427,89 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
while (bpi->type != BPATH_DONE) {
if ((bpi->type) == BPATH_IMAGE) {
- /*if (bpi->data) bpi->data = ((ID *)bpi->data)->next;*/
- if (bpi->data) bpi->data = ima_stepdata__internal( (Image *)bpi->data, 1 ); /* must skip images that have no path */
- else bpi->data = ima_stepdata__internal(G.main->image.first, 0);
+ /*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
+ if (bpi->data) bpi->data= ima_stepdata__internal( (Image *)bpi->data, 1 ); /* must skip images that have no path */
+ else bpi->data= ima_stepdata__internal(G.main->image.first, 0);
if (bpi->data) {
/* get the path info from this datatype */
- Image *ima = (Image *)bpi->data;
+ Image *ima= (Image *)bpi->data;
- bpi->lib = ima->id.lib ? ima->id.lib->filepath : NULL;
- bpi->path = ima->name;
- bpi->name = ima->id.name+2;
- bpi->len = sizeof(ima->name);
+ bpi->_lib= ima->id.lib ? ima->id.lib->filepath : NULL;
+ bpi->_path= ima->name;
+ bpi->_name= ima->id.name+2;
+ bpi->len= sizeof(ima->name);
/* we are done, advancing to the next item, this type worked fine */
break;
-
+
} else {
bpi_type_step__internal(bpi);
}
-
-
- } else if ((bpi->type) == BPATH_SOUND) {
- if (bpi->data) bpi->data = snd_stepdata__internal( (bSound *)bpi->data, 1 ); /* must skip images that have no path */
- else bpi->data = snd_stepdata__internal(G.main->sound.first, 0);
-
+ }
+
+ if ((bpi->type) == BPATH_TEXTURE) {
+ /*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
+ if (bpi->data) bpi->data= tex_stepdata__internal( (Tex *)bpi->data, 1 ); /* must skip images that have no path */
+ else bpi->data= tex_stepdata__internal(G.main->tex.first, 0);
+
if (bpi->data) {
/* get the path info from this datatype */
- bSound *snd = (bSound *)bpi->data;
-
- bpi->lib = snd->id.lib ? snd->id.lib->filepath : NULL;
- bpi->path = snd->name;
- bpi->name = snd->id.name+2;
- bpi->len = sizeof(snd->name);
-
+ Tex *tex= (Tex *)bpi->data;
+
+ if(tex->type == TEX_VOXELDATA) {
+ bpi->_lib= tex->id.lib ? tex->id.lib->filepath : NULL;
+ bpi->_path= tex->vd->source_path;
+ bpi->_name= tex->id.name+2;
+ bpi->len= sizeof(tex->vd->source_path);
+ }
+ else {
+ assert(!"Texture has no path, incorrect step 'tex_stepdata__internal'");
+ }
+
+ /* we are done, advancing to the next item, this type worked fine */
+ break;
+
+ } else {
+ bpi_type_step__internal(bpi);
+ }
+ }
+
+ if ((bpi->type) == BPATH_TEXT) {
+ /*if (bpi->data) bpi->data= ((ID *)bpi->data)->next;*/
+ if (bpi->data) bpi->data= text_stepdata__internal( (Text *)bpi->data, 1 ); /* must skip images that have no path */
+ else bpi->data= text_stepdata__internal(G.main->text.first, 0);
+
+ if (bpi->data) {
+ /* get the path info from this datatype */
+ Text *text= (Text *)bpi->data;
+
+ bpi->_lib= text->id.lib ? text->id.lib->filepath : NULL;
+ bpi->_path= NULL; /* bpi->path= text->name; */ /* get/set functions override. */
+ bpi->_name= text->id.name+2;
+ bpi->len= FILE_MAX; /* malloc'd but limit anyway since large paths may mess up other areas */
+
+ /* we are done, advancing to the next item, this type worked fine */
+ break;
+
+ } else {
+ bpi_type_step__internal(bpi);
+ }
+ }
+
+ else if ((bpi->type) == BPATH_SOUND) {
+ if (bpi->data) bpi->data= snd_stepdata__internal( (bSound *)bpi->data, 1 ); /* must skip images that have no path */
+ else bpi->data= snd_stepdata__internal(G.main->sound.first, 0);
+
+ if (bpi->data) {
+ /* get the path info from this datatype */
+ bSound *snd= (bSound *)bpi->data;
+
+ bpi->_lib= snd->id.lib ? snd->id.lib->filepath : NULL;
+ bpi->_path= snd->name;
+ bpi->_name= snd->id.name+2;
+ bpi->len= sizeof(snd->name);
+
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
@@ -369,36 +519,36 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
} else if ((bpi->type) == BPATH_FONT) {
- if (bpi->data) bpi->data = vf_stepdata__internal( (VFont *)bpi->data, 1 );
- else bpi->data = vf_stepdata__internal( G.main->vfont.first, 0 );
+ if (bpi->data) bpi->data= vf_stepdata__internal( (VFont *)bpi->data, 1 );
+ else bpi->data= vf_stepdata__internal( G.main->vfont.first, 0 );
if (bpi->data) {
/* get the path info from this datatype */
- VFont *vf = (VFont *)bpi->data;
-
- bpi->lib = vf->id.lib ? vf->id.lib->filepath : NULL;
- bpi->path = vf->name;
- bpi->name = vf->id.name+2;
- bpi->len = sizeof(vf->name);
-
+ VFont *vf= (VFont *)bpi->data;
+
+ bpi->_lib= vf->id.lib ? vf->id.lib->filepath : NULL;
+ bpi->_path= vf->name;
+ bpi->_name= vf->id.name+2;
+ bpi->len= sizeof(vf->name);
+
/* we are done, advancing to the next item, this type worked fine */
break;
} else {
bpi_type_step__internal(bpi);
}
-
+
} else if ((bpi->type) == BPATH_LIB) {
- if (bpi->data) bpi->data = ((ID *)bpi->data)->next;
- else bpi->data = G.main->library.first;
+ if (bpi->data) bpi->data= ((ID *)bpi->data)->next;
+ else bpi->data= G.main->library.first;
if (bpi->data) {
/* get the path info from this datatype */
- Library *lib = (Library *)bpi->data;
+ Library *lib= (Library *)bpi->data;
- bpi->lib = NULL;
- bpi->path = lib->name;
- bpi->name = NULL;
- bpi->len = sizeof(lib->name);
+ bpi->_lib= NULL;
+ bpi->_path= lib->name;
+ bpi->_name= NULL;
+ bpi->len= sizeof(lib->name);
/* we are done, advancing to the next item, this type worked fine */
break;
@@ -406,27 +556,27 @@ void BLI_bpathIterator_step( struct BPathIterator *bpi) {
bpi_type_step__internal(bpi);
}
} else if ((bpi->type) == BPATH_SEQ) {
- if (bpi->data) bpi->data = seq_stepdata__internal( bpi, 1 );
- else bpi->data = seq_stepdata__internal( bpi, 0 );
+ if (bpi->data) bpi->data= seq_stepdata__internal( bpi, 1 );
+ else bpi->data= seq_stepdata__internal( bpi, 0 );
if (bpi->data) {
- Sequence *seq = (Sequence *)bpi->data;
- bpi->lib = NULL;
- bpi->name = seq->name+2;
- bpi->len = sizeof(seq->strip->stripdata->name);
+ Sequence *seq= (Sequence *)bpi->data;
+ bpi->_lib= NULL;
+ bpi->_name= seq->name+2;
+ bpi->len= seq->plugin ? sizeof(seq->plugin->name) : sizeof(seq->strip->dir) + sizeof(seq->strip->stripdata->name);
break;
} else {
bpi_type_step__internal(bpi);
}
} else if ((bpi->type) == BPATH_CDATA) {
- if (bpi->data) bpi->data = cdata_stepdata__internal( bpi->data, 1 );
- else bpi->data = cdata_stepdata__internal( G.main->mesh.first, 0 );
+ if (bpi->data) bpi->data= cdata_stepdata__internal( bpi->data, 1 );
+ else bpi->data= cdata_stepdata__internal( G.main->mesh.first, 0 );
if (bpi->data) {
- Mesh *me = (Mesh *)bpi->data;
- bpi->lib = me->id.lib ? me->id.lib->filepath : NULL;
- bpi->path = me->fdata.external->filename;
- bpi->name = me->id.name+2;
- bpi->len = sizeof(me->fdata.external->filename);
+ Mesh *me= (Mesh *)bpi->data;
+ bpi->_lib= me->id.lib ? me->id.lib->filepath : NULL;
+ bpi->_path= me->fdata.external->filename;
+ bpi->_name= me->id.name+2;
+ bpi->len= sizeof(me->fdata.external->filename);
break;
} else {
bpi_type_step__internal(bpi);
@@ -453,6 +603,12 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
case BPATH_IMAGE:
prefix= "Image";
break;
+ case BPATH_TEXTURE:
+ prefix= "Texture";
+ break;
+ case BPATH_TEXT:
+ prefix= "Text";
+ break;
case BPATH_SOUND:
prefix= "Sound";
break;
@@ -473,7 +629,7 @@ static void bpath_as_report(struct BPathIterator *bpi, const char *message, Repo
break;
}
- name = BLI_bpathIterator_getName(bpi);
+ name= BLI_bpathIterator_getName(bpi);
BLI_bpathIterator_getPathExpanded(bpi, path_expanded);
if(reports) {
@@ -515,7 +671,7 @@ void makeFilesRelative(const char *basepath, ReportList *reports) {
BLI_bpathIterator_init(&bpi, basepath);
while (!BLI_bpathIterator_isDone(&bpi)) {
BLI_bpathIterator_getPath(&bpi, filepath);
- libpath = BLI_bpathIterator_getLib(&bpi);
+ libpath= BLI_bpathIterator_getLib(&bpi);
if(strncmp(filepath, "//", 2)) {
if (libpath) { /* cant make relative if we are library - TODO, LOG THIS */
@@ -566,7 +722,7 @@ void makeFilesAbsolute(const char *basepath, ReportList *reports)
BLI_bpathIterator_init(&bpi, basepath);
while (!BLI_bpathIterator_isDone(&bpi)) {
BLI_bpathIterator_getPath(&bpi, filepath);
- libpath = BLI_bpathIterator_getLib(&bpi);
+ libpath= BLI_bpathIterator_getLib(&bpi);
if(strncmp(filepath, "//", 2)==0) {
if (libpath) { /* cant make absolute if we are library - TODO, LOG THIS */
@@ -614,15 +770,15 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
char path[FILE_MAX];
int size;
- dir = opendir(dirname);
+ dir= opendir(dirname);
if (dir==0)
return 0;
if (*filesize == -1)
- *filesize = 0; /* dir opened fine */
+ *filesize= 0; /* dir opened fine */
- while ((de = readdir(dir)) != NULL) {
+ while ((de= readdir(dir)) != NULL) {
if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
continue;
@@ -635,9 +791,9 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
if (S_ISREG(status.st_mode)) { /* is file */
if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
/* open the file to read its size */
- size = status.st_size;
+ size= status.st_size;
if ((size > 0) && (size > *filesize)) { /* find the biggest file */
- *filesize = size;
+ *filesize= size;
BLI_strncpy(filename_new, path, FILE_MAX);
}
}
@@ -673,7 +829,7 @@ void findMissingFiles(const char *basepath, const char *str) {
while (!BLI_bpathIterator_isDone(&bpi)) {
BLI_bpathIterator_getPath(&bpi, filepath);
- libpath = BLI_bpathIterator_getLib(&bpi);
+ libpath= BLI_bpathIterator_getLib(&bpi);
/* Check if esc was pressed because searching files can be slow */
/*XXX if (blender_test_break()) {
@@ -686,8 +842,8 @@ void findMissingFiles(const char *basepath, const char *str) {
if (!BLI_exists(filepath_expanded)) {
/* can the dir be opened? */
- filesize = -1;
- recur_depth = 0;
+ filesize= -1;
+ recur_depth= 0;
findFileRecursive(filename_new, dirname, BLI_path_basename(filepath), &filesize, &recur_depth);
if (filesize == -1) { /* could not open dir */