[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39703] trunk/blender/source/blender: file-selector: when converting operator arguments to the file selector, wasnt making paths absolute ( abs paths are made relative when converting the other way).

Campbell Barton ideasman42 at gmail.com
Fri Aug 26 03:32:10 CEST 2011


Revision: 39703
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39703
Author:   campbellbarton
Date:     2011-08-26 01:32:07 +0000 (Fri, 26 Aug 2011)
Log Message:
-----------
file-selector: when converting operator arguments to the file selector, wasnt making paths absolute (abs paths are made relative when converting the other way).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_file/file_ops.c
    trunk/blender/source/blender/editors/space_image/image_ops.c
    trunk/blender/source/blender/python/intern/bpy_operator.c

Modified: trunk/blender/source/blender/editors/space_file/file_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/file_ops.c	2011-08-25 20:47:41 UTC (rev 39702)
+++ trunk/blender/source/blender/editors/space_file/file_ops.c	2011-08-26 01:32:07 UTC (rev 39703)
@@ -657,25 +657,27 @@
 
 void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
 {
-	int change= FALSE;
-	if(RNA_struct_find_property(op->ptr, "filename")) {
-		RNA_string_get(op->ptr, "filename", sfile->params->file);
-		change= TRUE;
+	PropertyRNA *prop;
+
+	/* If neither of the above are set, split the filepath back */
+	if((prop= RNA_struct_find_property(op->ptr, "filepath"))) {
+		char filepath[FILE_MAX];
+		RNA_property_string_get(op->ptr, prop, filepath);
+		BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file);
 	}
-	if(RNA_struct_find_property(op->ptr, "directory")) {
-		RNA_string_get(op->ptr, "directory", sfile->params->dir);
-		change= TRUE;
-	}
-	
-	/* If neither of the above are set, split the filepath back */
-	if(RNA_struct_find_property(op->ptr, "filepath")) {
-		if(change==FALSE) {
-			char filepath[FILE_MAX];
-			RNA_string_get(op->ptr, "filepath", filepath);
-			BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file);
+	else {
+		if((prop= RNA_struct_find_property(op->ptr, "filename"))) {
+			RNA_property_string_get(op->ptr, prop, sfile->params->file);
 		}
+		if((prop= RNA_struct_find_property(op->ptr, "directory"))) {
+			RNA_property_string_get(op->ptr, prop, sfile->params->dir);
+		}
 	}
 	
+	/* we could check for relative_path property which is used when converting
+	 * in the other direction but doesnt hurt to do this every time */
+	BLI_path_abs(sfile->params->dir, G.main->name);
+
 	/* XXX, files and dirs updates missing, not really so important though */
 }
 

Modified: trunk/blender/source/blender/editors/space_image/image_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_ops.c	2011-08-25 20:47:41 UTC (rev 39702)
+++ trunk/blender/source/blender/editors/space_image/image_ops.c	2011-08-26 01:32:07 UTC (rev 39703)
@@ -983,7 +983,7 @@
 
 		/* unlikely but just incase */
 		if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) {
-			simopts->planes= 32;
+			simopts->planes= R_PLANES32;
 		}
 
 		/* some formats dont use quality so fallback to scenes quality */
@@ -1000,7 +1000,6 @@
 			}
 			BLI_path_abs(simopts->filepath, G.main->name);
 		}
-
 		/* cleanup */
 		BKE_image_release_renderresult(scene, ima);
 	}
@@ -1026,6 +1025,7 @@
 	RNA_enum_set(op->ptr, "file_format", simopts->imtype);
 	// RNA_enum_set(op->ptr, "subimtype", simopts->subimtype);
 	RNA_int_set(op->ptr, "file_quality", simopts->quality);
+
 	RNA_string_set(op->ptr, "filepath", simopts->filepath);
 }
 
@@ -1050,10 +1050,10 @@
 
 		if(ima->type == IMA_TYPE_R_RESULT) {
 			/* enforce user setting for RGB or RGBA, but skip BW */
-			if(simopts->planes==32) {
+			if(simopts->planes==R_PLANES32) {
 				ibuf->depth= 32;
 			}
-			else if(simopts->planes==24) {
+			else if(simopts->planes==R_PLANES24) {
 				ibuf->depth= 24;
 			}
 		}

Modified: trunk/blender/source/blender/python/intern/bpy_operator.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_operator.c	2011-08-25 20:47:41 UTC (rev 39702)
+++ trunk/blender/source/blender/python/intern/bpy_operator.c	2011-08-26 01:32:07 UTC (rev 39703)
@@ -117,7 +117,6 @@
 	}
 
 	context_dict_back= CTX_py_dict_get(C);
-
 	CTX_py_dict_set(C, (void *)context_dict);
 	Py_XINCREF(context_dict); /* so we done loose it */
 	




More information about the Bf-blender-cvs mailing list