branches/blender-2.47
Merge from trunk: Revision: 15133 Revision: 15135 Revision: 15146 Revision: 15220 Revision: 15362
This commit is contained in:
parent
ba3be905d3
commit
382872a9dd
|
@ -942,7 +942,8 @@ char *txt_to_buf (Text *text)
|
|||
if (!text) return NULL;
|
||||
if (!text->curl) return NULL;
|
||||
if (!text->sell) return NULL;
|
||||
|
||||
if (!text->lines.first) return NULL;
|
||||
|
||||
linef= text->lines.first;
|
||||
charf= 0;
|
||||
|
||||
|
|
|
@ -456,13 +456,10 @@ void checkMissingFiles( char *txtname ) {
|
|||
|
||||
/* be sure there is low chance of the path being too short */
|
||||
char filepath_expanded[FILE_MAXDIR*2];
|
||||
char *libpath;
|
||||
int files_missing = 0;
|
||||
|
||||
BLI_bpathIterator_init(&bpi);
|
||||
while (!BLI_bpathIterator_isDone(&bpi)) {
|
||||
libpath = BLI_bpathIterator_getLib(&bpi);
|
||||
|
||||
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
|
||||
|
||||
if (!BLI_exists(filepath_expanded)) {
|
||||
|
|
|
@ -865,11 +865,8 @@ int BLI_strcaseeq(char *a, char *b) {
|
|||
void BLI_cleanup_dir(const char *relabase, char *dir)
|
||||
{
|
||||
BLI_cleanup_file(relabase, dir);
|
||||
#ifdef WIN32
|
||||
strcat(dir, "\\");
|
||||
#else
|
||||
strcat(dir, "/");
|
||||
#endif
|
||||
BLI_add_slash(dir);
|
||||
|
||||
}
|
||||
|
||||
void BLI_cleanup_file(const char *relabase, char *dir)
|
||||
|
@ -878,6 +875,13 @@ void BLI_cleanup_file(const char *relabase, char *dir)
|
|||
char *start, *eind;
|
||||
if (relabase) {
|
||||
BLI_convertstringcode(dir, relabase);
|
||||
} else {
|
||||
if (dir[0]=='/' && dir[1]=='/') {
|
||||
if (dir[2]== '\0') {
|
||||
return; /* path is "//" - cant clean it */
|
||||
}
|
||||
dir = dir+2; /* skip the first // */
|
||||
}
|
||||
}
|
||||
|
||||
/* Note
|
||||
|
@ -901,8 +905,11 @@ void BLI_cleanup_file(const char *relabase, char *dir)
|
|||
if (dir[a] == '\\') break;
|
||||
a--;
|
||||
}
|
||||
memmove( dir+a, eind, strlen(eind)+1 );
|
||||
|
||||
if (a<0) {
|
||||
break;
|
||||
} else {
|
||||
memmove( dir+a, eind, strlen(eind)+1 );
|
||||
}
|
||||
}
|
||||
|
||||
while ( (start = strstr(dir,"\\.\\")) ){
|
||||
|
@ -935,7 +942,11 @@ void BLI_cleanup_file(const char *relabase, char *dir)
|
|||
if (dir[a] == '/') break;
|
||||
a--;
|
||||
}
|
||||
memmove( dir+a, eind, strlen(eind)+1 );
|
||||
if (a<0) {
|
||||
break;
|
||||
} else {
|
||||
memmove( dir+a, eind, strlen(eind)+1 );
|
||||
}
|
||||
}
|
||||
|
||||
while ( (start = strstr(dir,"/./")) ){
|
||||
|
@ -1124,8 +1135,8 @@ int BLI_convertstringcode(char *path, const char *basepath)
|
|||
char vol[3] = {'\0', '\0', '\0'};
|
||||
|
||||
BLI_strncpy(vol, path, 3);
|
||||
wasrelative= (strncmp(vol, "//", 2)==0);
|
||||
|
||||
wasrelative= (vol[0]=='/' && vol[1]=='/');
|
||||
|
||||
#ifdef WIN32
|
||||
/* we are checking here if we have an absolute path that is not in the current
|
||||
blend file as a lib main - we are basically checking for the case that a
|
||||
|
@ -1160,24 +1171,32 @@ int BLI_convertstringcode(char *path, const char *basepath)
|
|||
BLI_char_switch(tmp, '\\', '/');
|
||||
BLI_char_switch(base, '\\', '/');
|
||||
|
||||
if (tmp[0] == '/' && tmp[1] == '/') {
|
||||
char *filepart= BLI_strdup(tmp+2); /* skip code */
|
||||
/* Paths starting with // will get the blend file as their base,
|
||||
* this isnt standard in any os but is uesed in blender all over the place */
|
||||
if (wasrelative) {
|
||||
char *lslash= BLI_last_slash(base);
|
||||
|
||||
if (lslash) {
|
||||
int baselen= (int) (lslash-base) + 1;
|
||||
|
||||
/* use path for for temp storage here, we copy back over it right away */
|
||||
BLI_strncpy(path, tmp+2, FILE_MAX);
|
||||
|
||||
memcpy(tmp, base, baselen);
|
||||
strcpy(tmp+baselen, filepart);
|
||||
strcpy(tmp+baselen, path);
|
||||
strcpy(path, tmp);
|
||||
} else {
|
||||
strcpy(tmp, filepart);
|
||||
strcpy(path, tmp+2);
|
||||
}
|
||||
|
||||
MEM_freeN(filepart);
|
||||
} else {
|
||||
strcpy(path, tmp);
|
||||
}
|
||||
|
||||
BLI_cleanup_file(NULL, tmp);
|
||||
strcpy(path, tmp);
|
||||
if (path[0]!='\0') {
|
||||
if ( path[strlen(path)-1]=='/') {
|
||||
BLI_cleanup_dir(NULL, path);
|
||||
} else {
|
||||
BLI_cleanup_file(NULL, path);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/* skip first two chars, which in case of
|
||||
|
|
|
@ -57,7 +57,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
|
|||
break;
|
||||
case 3: /* Divide */
|
||||
{
|
||||
if(in[1]==0) /* We don't want to divide by zero. */
|
||||
if(in2[0]==0) /* We don't want to divide by zero. */
|
||||
out[0]= 0.0;
|
||||
else
|
||||
out[0]= in[0] / in2[0];
|
||||
|
|
|
@ -936,6 +936,7 @@ static PyObject *Blender_GetPaths( PyObject * self, PyObject *args, PyObject *ke
|
|||
PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */
|
||||
/* be sure there is low chance of the path being too short */
|
||||
char filepath_expanded[FILE_MAXDIR*2];
|
||||
char *lib;
|
||||
|
||||
int absolute = 0;
|
||||
static char *kwlist[] = {"absolute", NULL};
|
||||
|
@ -952,7 +953,12 @@ static PyObject *Blender_GetPaths( PyObject * self, PyObject *args, PyObject *ke
|
|||
if (absolute) {
|
||||
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
|
||||
} else {
|
||||
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
|
||||
lib = BLI_bpathIterator_getLib( &bpi );
|
||||
if ( lib && ( strcmp(lib, G.sce) ) ) { /* relative path to the library is NOT the same as our blendfile path, return an absolute path */
|
||||
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
|
||||
} else {
|
||||
BLI_bpathIterator_getPath( &bpi, filepath_expanded );
|
||||
}
|
||||
}
|
||||
st = PyString_FromString(filepath_expanded);
|
||||
|
||||
|
|
|
@ -406,11 +406,12 @@ static PyObject *M_sys_cleanpath( PyObject * self, PyObject * value )
|
|||
{
|
||||
char *path = PyString_AsString(value);
|
||||
char cleaned[FILE_MAXDIR + FILE_MAXFILE];
|
||||
int trailing_slash = 0;
|
||||
int trailing_slash = 0, last;
|
||||
if (!path)
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected string argument" );
|
||||
if (strstr(path, "/") || strstr(path, "\\")) {
|
||||
last = strlen(path)-1;
|
||||
if ((last >= 0) && ((path[last]=='/') || (path[last]=='\\'))) {
|
||||
trailing_slash = 1;
|
||||
}
|
||||
BLI_strncpy(cleaned, path, FILE_MAXDIR + FILE_MAXFILE);
|
||||
|
|
|
@ -636,7 +636,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
|
|||
else {
|
||||
/* got warning on this for 64 bits.... */
|
||||
/* but it's working code! in this case rz is not a pointer but zvalue (ton) */
|
||||
zsamp= (int) rz;
|
||||
zsamp= GET_INT_FROM_POINTER(rz);
|
||||
}
|
||||
|
||||
/* tricky stuff here; we use ints which can overflow easily with bias values */
|
||||
|
@ -816,7 +816,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
|
|||
else {
|
||||
/* same as before */
|
||||
/* still working code! (ton) */
|
||||
zsamp= (int) rz;
|
||||
zsamp= GET_INT_FROM_POINTER(rz);
|
||||
}
|
||||
|
||||
/* NO schadow when sampled at 'eternal' distance */
|
||||
|
|
|
@ -354,7 +354,7 @@ void txt_export_to_object(struct Text *text)
|
|||
// char sdir[FILE_MAXDIR];
|
||||
// char sfile[FILE_MAXFILE];
|
||||
|
||||
if(!text) return;
|
||||
if(!text || !text->lines.first) return;
|
||||
|
||||
id = (ID *)text;
|
||||
|
||||
|
@ -429,7 +429,7 @@ void txt_export_to_objects(struct Text *text)
|
|||
int linenum = 0;
|
||||
float offset[3] = {0.0,0.0,0.0};
|
||||
|
||||
if(!text) return;
|
||||
if(!text || !text->lines.first) return;
|
||||
|
||||
id = (ID *)text;
|
||||
|
||||
|
|
Loading…
Reference in New Issue