bugfix - Blender.GetPaths() was returning relative paths from libraries, but with...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 6 Jun 2008 08:58:08 +0000 (08:58 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 6 Jun 2008 08:58:08 +0000 (08:58 +0000)
bpath also assigned one var it didnt need to.

source/blender/blenlib/intern/bpath.c
source/blender/python/api2_2x/Blender.c

index 79d3e4877128397682c270ab00569a6d2b898a5a..898ad6ddd67b78ba2ff161536b1fb69c549ce1bd 100644 (file)
@@ -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)) {
index 6b2e00f27dee6edb7fbf11b63ec6987e94bc743c..d8385c1d6609d61f75783b04cb1aa5d809f9ad98 100644 (file)
@@ -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_getPath( &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);