fix for PLY import using directory only select, operators which define 'files' but...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 21 Jun 2011 04:03:26 +0000 (04:03 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 21 Jun 2011 04:03:26 +0000 (04:03 +0000)
also made code less confusing.

source/blender/editors/space_file/filesel.c
source/blender/editors/space_sequencer/sequencer_add.c

index 3dbfdc9f7d003178c30cd5a67df43f6e610e919e..6773dfb6b2db1f899f8fb79e6c09b057648e49e3 100644 (file)
@@ -121,8 +121,10 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 
        /* 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 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                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 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                        }
                }
                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 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                        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 {
index e4c3555eac18ff0caeecf88bba0aeec5dab63b3c..067d63b3b6cedd13ceccaf0541b8ae575dfe4c6a 100644 (file)
@@ -551,7 +551,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
        /* 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);
 }