[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37688] trunk/blender/source/blender/ editors: fix for PLY import using directory only select, operators which define 'files' but not 'filename' or 'filepath' would use the directory selector.

Campbell Barton ideasman42 at gmail.com
Tue Jun 21 06:03:28 CEST 2011


Revision: 37688
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37688
Author:   campbellbarton
Date:     2011-06-21 04:03:26 +0000 (Tue, 21 Jun 2011)
Log Message:
-----------
fix for PLY import using directory only select, operators which define 'files' but not 'filename' or 'filepath' would use the directory selector.

also made code less confusing.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_file/filesel.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c

Modified: trunk/blender/source/blender/editors/space_file/filesel.c
===================================================================
--- trunk/blender/source/blender/editors/space_file/filesel.c	2011-06-21 04:01:51 UTC (rev 37687)
+++ trunk/blender/source/blender/editors/space_file/filesel.c	2011-06-21 04:03:26 UTC (rev 37688)
@@ -121,8 +121,10 @@
 
 	/* set the parameters from the operator, if it exists */
 	if (op) {
-		short is_filename= FALSE;
-		short is_dir= FALSE;
+		const short is_files= (RNA_struct_find_property(op->ptr, "files") != NULL);
+		const short is_filepath= (RNA_struct_find_property(op->ptr, "filepath") != NULL);
+		const short is_filename= (RNA_struct_find_property(op->ptr, "filename") != NULL);
+		const short is_directory= (RNA_struct_find_property(op->ptr, "directory") != NULL);
 
 		BLI_strncpy(params->title, op->type->name, sizeof(params->title));
 
@@ -131,7 +133,7 @@
 		else
 			params->type = FILE_SPECIAL;
 
-		if ((is_dir= is_filename= RNA_struct_find_property(op->ptr, "filepath")!=NULL) && RNA_property_is_set(op->ptr, "filepath")) {
+		if (is_filepath && RNA_property_is_set(op->ptr, "filepath")) {
 			char name[FILE_MAX];
 			RNA_string_get(op->ptr, "filepath", name);
 			if (params->type == FILE_LOADLIB) {
@@ -143,13 +145,12 @@
 			}
 		}
 		else {
-			if ((is_dir= RNA_struct_find_property(op->ptr, "directory")!=NULL) && RNA_property_is_set(op->ptr, "directory")) {
+			if (is_directory && RNA_property_is_set(op->ptr, "directory")) {
 				RNA_string_get(op->ptr, "directory", params->dir);
 				sfile->params->file[0]= '\0';
-				is_dir= TRUE;
 			}
 
-			if ((is_filename= RNA_struct_find_property(op->ptr, "filename")!=NULL) && RNA_property_is_set(op->ptr, "filename")) {
+			if (is_filename && RNA_property_is_set(op->ptr, "filename")) {
 				RNA_string_get(op->ptr, "filename", params->file);
 			}
 		}
@@ -159,7 +160,7 @@
 			BLI_path_abs(params->dir, G.main->name);
 		}
 
-		if(is_dir==TRUE && is_filename==FALSE) {
+		if(is_directory==TRUE && is_filename==FALSE && is_filepath==FALSE && is_files==FALSE) {
 			params->flag |= FILE_DIRSEL_ONLY;
 		}
 		else {

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c	2011-06-21 04:01:51 UTC (rev 37687)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c	2011-06-21 04:03:26 UTC (rev 37688)
@@ -551,7 +551,7 @@
 	/* flags */
 	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME|WM_FILESEL_RELPATH);
+	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH);
 	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME|SEQPROP_FILES);
 }
 




More information about the Bf-blender-cvs mailing list