diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-21 08:03:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-21 08:03:26 +0400 |
commit | a48a4270dceb3f739a18dc3eaf64f6bc95407ea1 (patch) | |
tree | d62ce756fcb0f790a29b764625f4f5f550a3368e /source/blender/editors | |
parent | 6a039f1a5cdeab92c0203ab9ae91eed7b6d34051 (diff) |
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 15 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 3dbfdc9f7d0..6773dfb6b2d 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -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 { diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index e4c3555eac1..067d63b3b6c 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -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); } |