[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36781] trunk/blender/source/blender/ blenlib/intern/bpath.c: formatting changes only.
Campbell Barton
ideasman42 at gmail.com
Thu May 19 15:50:54 CEST 2011
Revision: 36781
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36781
Author: campbellbarton
Date: 2011-05-19 13:50:53 +0000 (Thu, 19 May 2011)
Log Message:
-----------
formatting changes only.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/intern/bpath.c
Modified: trunk/blender/source/blender/blenlib/intern/bpath.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/bpath.c 2011-05-19 13:05:50 UTC (rev 36780)
+++ trunk/blender/source/blender/blenlib/intern/bpath.c 2011-05-19 13:50:53 UTC (rev 36781)
@@ -68,21 +68,16 @@
#include "BKE_utildefines.h"
#include "BKE_report.h"
-//XXX #include "BIF_screen.h" /* only for wait cursor */
-//
-/* for sequence */
-//XXX #include "BSE_sequence.h"
-//XXX define below from BSE_sequence.h - otherwise potentially odd behaviour
-
-
-typedef struct BPathIteratorSeqData {
+typedef struct BPathIteratorSeqData
+{
int totseq;
int seq;
- struct Sequence **seqar; /* Sequence */
- struct Scene *scene; /* Current scene */
+ struct Sequence **seqar; /* Sequence */
+ struct Scene *scene; /* Current scene */
} BPathIteratorSeqData;
-typedef struct BPathIterator {
+typedef struct BPathIterator
+{
char* _path; /* never access directly, use BLI_bpathIterator_getPath */
const char* _lib;
const char* _name;
@@ -94,7 +89,7 @@
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 bmain->name */
+ const char* base_path; /* base path, the directory the blend file is in - normally bmain->name */
Main *bmain;
@@ -116,7 +111,7 @@
BPATH_SEQ,
BPATH_CDATA,
- BPATH_DONE
+ BPATH_DONE
};
void BLI_bpathIterator_init(struct BPathIterator **bpi_pt, Main *bmain, const char *basedir, const int flag)
@@ -128,10 +123,10 @@
bpi->type= BPATH_IMAGE;
bpi->data= NULL;
-
+
bpi->getpath_callback= NULL;
bpi->setpath_callback= NULL;
-
+
/* Sequencer specific */
bpi->seqdata.totseq= 0;
bpi->seqdata.seq= 0;
@@ -147,62 +142,75 @@
}
#if 0
-static void BLI_bpathIterator_alloc(struct BPathIterator **bpi) {
+static void BLI_bpathIterator_alloc(struct BPathIterator **bpi)
+{
*bpi= MEM_mallocN(sizeof(BPathIterator), "BLI_bpathIterator_alloc");
}
#endif
-void BLI_bpathIterator_free(struct BPathIterator *bpi) {
+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;
-
+
MEM_freeN(bpi);
}
-void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path) {
+void BLI_bpathIterator_getPath(struct BPathIterator *bpi, char *path)
+{
if (bpi->getpath_callback) {
bpi->getpath_callback(bpi, path);
- } else {
+ }
+ else {
strcpy(path, bpi->_path); /* warning, we assume 'path' are long enough */
}
}
-void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path) {
+void BLI_bpathIterator_setPath(struct BPathIterator *bpi, const char *path)
+{
if (bpi->setpath_callback) {
bpi->setpath_callback(bpi, path);
- } else {
+ }
+ else {
strcpy(bpi->_path, path); /* warning, we assume 'path' are long enough */
}
}
-void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded) {
+void BLI_bpathIterator_getPathExpanded(struct BPathIterator *bpi, char *path_expanded)
+{
const char *libpath;
-
+
BLI_bpathIterator_getPath(bpi, path_expanded);
libpath= BLI_bpathIterator_getLib(bpi);
-
+
if (libpath) { /* check the files location relative to its library path */
BLI_path_abs(path_expanded, libpath);
- } else { /* local data, use the blend files path */
+ }
+ else { /* local data, use the blend files path */
BLI_path_abs(path_expanded, bpi->base_path);
}
BLI_cleanup_file(NULL, path_expanded);
}
-const char* BLI_bpathIterator_getLib(struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getLib(struct BPathIterator *bpi)
+{
return bpi->_lib;
}
-const char* BLI_bpathIterator_getName(struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getName(struct BPathIterator *bpi)
+{
return bpi->_name;
}
-int BLI_bpathIterator_getType(struct BPathIterator *bpi) {
+int BLI_bpathIterator_getType(struct BPathIterator *bpi)
+{
return bpi->type;
}
-unsigned int BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi) {
+unsigned int BLI_bpathIterator_getPathMaxLen(struct BPathIterator *bpi)
+{
return bpi->len;
}
-const char* BLI_bpathIterator_getBasePath(struct BPathIterator *bpi) {
+const char* BLI_bpathIterator_getBasePath(struct BPathIterator *bpi)
+{
return bpi->base_path;
}
@@ -211,10 +219,10 @@
{
if (ima==NULL)
return NULL;
-
+
if (step_next)
ima= ima->id.next;
-
+
while (ima) {
if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
if(ima->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
@@ -223,7 +231,7 @@
}
/* image is not a image with a path, skip it */
ima= ima->id.next;
- }
+ }
return ima;
}
@@ -240,7 +248,7 @@
break;
/* image is not a image with a path, skip it */
tex= tex->id.next;
- }
+ }
return tex;
}
@@ -257,7 +265,7 @@
break;
/* image is not a image with a path, skip it */
text= text->id.next;
- }
+ }
return text;
}
@@ -265,20 +273,20 @@
{
if (vf==NULL)
return NULL;
-
+
if (step_next)
vf= vf->id.next;
-
+
while (vf) {
if (strcmp(vf->name, FO_BUILTIN_NAME)!=0) {
if(vf->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
break;
}
}
-
+
/* font with no path, skip it */
vf= vf->id.next;
- }
+ }
return vf;
}
@@ -286,10 +294,10 @@
{
if (snd==NULL)
return NULL;
-
+
if (step_next)
snd= snd->id.next;
-
+
while (snd) {
if(snd->packedfile==NULL || (flag & BPATH_USE_PACKED)) {
break;
@@ -297,7 +305,7 @@
/* font with no path, skip it */
snd= snd->id.next;
- }
+ }
return snd;
}
@@ -305,16 +313,16 @@
{
Editing *ed;
Sequence *seq;
-
+
/* Initializing */
if (bpi->seqdata.scene==NULL) {
bpi->seqdata.scene= bpi->bmain->scene.first;
}
-
+
if (step_next) {
bpi->seqdata.seq++;
}
-
+
while (bpi->seqdata.scene) {
ed= seq_give_editing(bpi->seqdata.scene, 0);
if (ed) {
@@ -323,10 +331,11 @@
seq_array(ed, &bpi->seqdata.seqar, &bpi->seqdata.totseq, 0);
bpi->seqdata.seq= 0;
}
-
+
if (bpi->seqdata.seq >= bpi->seqdata.totseq) {
seq= NULL;
- } else {
+ }
+ else {
seq= bpi->seqdata.seqar[bpi->seqdata.seq];
while (!SEQ_HAS_PATH(seq) && seq->plugin==NULL) {
bpi->seqdata.seq++;
@@ -339,7 +348,8 @@
}
if (seq) {
return seq;
- } else {
+ }
+ else {
/* keep looking through the next scene, reallocate seq array */
if (bpi->seqdata.seqar) {
MEM_freeN((void *)bpi->seqdata.seqar);
@@ -347,19 +357,21 @@
}
bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
- } else {
+ }
+ else {
/* no seq data in this scene, next */
bpi->seqdata.scene= bpi->seqdata.scene->id.next;
}
}
-
+
return NULL;
}
-static void seq_getpath(struct BPathIterator *bpi, char *path) {
+static void seq_getpath(struct BPathIterator *bpi, char *path)
+{
Sequence *seq= (Sequence *)bpi->data;
-
+
path[0]= '\0'; /* incase we cant get the path */
if (seq==NULL) return;
if (SEQ_HAS_PATH(seq)) {
@@ -369,7 +381,7 @@
if (seq->strip->stripdata) { /* should always be true! */
/* Using the first image is weak for image sequences */
strcat(path, seq->strip->stripdata->name);
- }
+ }
}
else {
/* simple case */
@@ -381,10 +393,11 @@
}
}
-static void seq_setpath(struct BPathIterator *bpi, const char *path) {
+static void seq_setpath(struct BPathIterator *bpi, const char *path)
+{
Sequence *seq= (Sequence *)bpi->data;
- if (seq==NULL) return;
-
+ 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);
@@ -399,7 +412,8 @@
}
}
-static void text_getpath(struct BPathIterator *bpi, char *path) {
+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) {
@@ -407,9 +421,10 @@
}
}
-static void text_setpath(struct BPathIterator *bpi, const char *path) {
+static void text_setpath(struct BPathIterator *bpi, const char *path)
+{
Text *text= (Text *)bpi->data;
- if (text==NULL) return;
+ if (text==NULL) return;
if(text->name) {
MEM_freeN(text->name);
@@ -418,27 +433,29 @@
text->name= BLI_strdup(path);
}
-static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next) {
+static struct Mesh *cdata_stepdata__internal(struct Mesh *me, int step_next)
+{
if (me==NULL)
return NULL;
-
+
if (step_next)
me= me->id.next;
-
+
while (me) {
if (me->fdata.external) {
break;
}
-
+
me= me->id.next;
- }
+ }
return me;
}
-static void bpi_type_step__internal(struct BPathIterator *bpi) {
+static void bpi_type_step__internal(struct BPathIterator *bpi)
+{
bpi->type++; /* advance to the next type */
bpi->data= NULL;
-
+
switch (bpi->type) {
case BPATH_SEQ:
bpi->getpath_callback= seq_getpath;
@@ -455,27 +472,29 @@
}
}
-void BLI_bpathIterator_step(struct BPathIterator *bpi) {
+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, bpi->flag); /* must skip images that have no path */
else bpi->data= ima_stepdata__internal(bpi->bmain->image.first, 0, bpi->flag);
-
+
if (bpi->data) {
/* get the path info from this datatype */
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);
-
+
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
}
@@ -502,7 +521,8 @@
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
}
@@ -524,11 +544,11 @@
/* we are done, advancing to the next item, this type worked fine */
break;
- } else {
+ }
+ else {
bpi_type_step__internal(bpi);
}
}
-
else if ((bpi->type) == BPATH_SOUND) {
if (bpi->data) bpi->data= snd_stepdata__internal((bSound *)bpi->data, 1, bpi->flag); /* must skip images that have no path */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list