[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15146] trunk/blender/source/blender: bugfix - Blender.GetPaths() was returning relative paths from libraries, but with no way to access the library path the the file is relative too.

Campbell Barton ideasman42 at gmail.com
Fri Jun 6 10:58:09 CEST 2008


Revision: 15146
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15146
Author:   campbellbarton
Date:     2008-06-06 10:58:08 +0200 (Fri, 06 Jun 2008)

Log Message:
-----------
bugfix - Blender.GetPaths() was returning relative paths from libraries, but with no way to access the library path the the file is relative too. Check for these cases and make them absolute.
bpath also assigned one var it didnt need to.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/bpath.c
    trunk/blender/source/blender/python/api2_2x/Blender.c

Modified: trunk/blender/source/blender/blenlib/intern/bpath.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/bpath.c	2008-06-06 02:21:17 UTC (rev 15145)
+++ trunk/blender/source/blender/blenlib/intern/bpath.c	2008-06-06 08:58:08 UTC (rev 15146)
@@ -456,13 +456,10 @@
 	
 	/* 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)) {

Modified: trunk/blender/source/blender/python/api2_2x/Blender.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Blender.c	2008-06-06 02:21:17 UTC (rev 15145)
+++ trunk/blender/source/blender/python/api2_2x/Blender.c	2008-06-06 08:58:08 UTC (rev 15146)
@@ -936,6 +936,7 @@
 	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 @@
 		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);
 		





More information about the Bf-blender-cvs mailing list