[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53890] trunk/blender/source/blender/ editors/space_buttons/buttons_ops.c: Fix #33913: Unable to set sequencer proxy custom directory as relative path

Sergey Sharybin sergey.vfx at gmail.com
Fri Jan 18 09:44:56 CET 2013


Revision: 53890
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53890
Author:   nazgul
Date:     2013-01-18 08:44:55 +0000 (Fri, 18 Jan 2013)
Log Message:
-----------
Fix #33913: Unable to set sequencer proxy custom directory as relative path

Added absolute->relative conversion for directory in file_browse_exec.
This is how other places deals with this, but perhaps we'd better change
file selection so both filepath and directory are affected by relative
option.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_buttons/buttons_ops.c

Modified: trunk/blender/source/blender/editors/space_buttons/buttons_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_buttons/buttons_ops.c	2013-01-18 06:26:06 UTC (rev 53889)
+++ trunk/blender/source/blender/editors/space_buttons/buttons_ops.c	2013-01-18 08:44:55 UTC (rev 53890)
@@ -112,14 +112,22 @@
 	/* add slash for directories, important for some properties */
 	if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
 		char name[FILE_MAX];
-		
+		int is_relative = RNA_boolean_get(op->ptr, "relative_path");
 		id = fbo->ptr.id.data;
 
 		BLI_strncpy(path, str, FILE_MAX);
 		BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name);
 		
 		if (BLI_is_dir(path)) {
-			str = MEM_reallocN(str, strlen(str) + 2);
+			if (is_relative) {
+				BLI_strncpy(path, str, FILE_MAX);
+				BLI_path_rel(path, G.main->name);
+				str = MEM_reallocN(str, strlen(path) + 2);
+				BLI_strncpy(str, path, FILE_MAX);
+			}
+			else {
+				str = MEM_reallocN(str, strlen(str) + 2);
+			}
 			BLI_add_slash(str);
 		}
 		else




More information about the Bf-blender-cvs mailing list