diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-07-27 23:06:33 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-07-27 23:06:33 +0400 |
commit | a869bdc44e8591b8e45c4aa3b0fac43f5ae55a26 (patch) | |
tree | 5099a76c4bb17aba0a384504c0b94e8ecc16ae87 /source/blender/editors/space_image | |
parent | eb40d8ef0f49873a7f262af367decb7e652e7618 (diff) |
2.5 file browser
New:
* added filter and display to some operator properties. Now file browser opens showing only .blend files and folders on file->open and on image->open changes to image display and only shows images and movies.
Fixes:
* fixed stupid removal of wrong prototype in last commit
* fixed a few warnings
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index fd37020c3b4..a429de65610 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -609,6 +609,10 @@ static const EnumPropertyItem image_file_type_items[] = { static void image_filesel(bContext *C, wmOperator *op, const char *path) { RNA_string_set(op->ptr, "filename", path); + RNA_boolean_set(op->ptr, "filter_image", 1); + RNA_boolean_set(op->ptr, "filter_movie", 1); + RNA_boolean_set(op->ptr, "filter_folder", 1); + RNA_enum_set(op->ptr, "display", FILE_IMGDISPLAY); WM_event_add_fileselect(C, op); } @@ -649,6 +653,14 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) void IMAGE_OT_open(wmOperatorType *ot) { + PropertyRNA *prop; + + static EnumPropertyItem file_display_items[] = { + {FILE_SHORTDISPLAY, "FILE_SHORTDISPLAY", ICON_SHORTDISPLAY, "Short List", "Display files as short list"}, + {FILE_LONGDISPLAY, "FILE_LONGDISPLAY", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"}, + {FILE_IMGDISPLAY, "FILE_IMGDISPLAY", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"}, + {0, NULL, 0, NULL, NULL}}; + /* identifiers */ ot->name= "Open"; ot->idname= "IMAGE_OT_open"; @@ -663,6 +675,19 @@ void IMAGE_OT_open(wmOperatorType *ot) /* properties */ RNA_def_string_file_path(ot->srna, "filename", "", FILE_MAX, "Filename", "File path of image to open."); + + prop= RNA_def_boolean(ot->srna, "filter_image", 0, "Show image files", ""); + RNA_def_property_boolean_sdna(prop, NULL, "filter", IMAGEFILE); + prop= RNA_def_boolean(ot->srna, "filter_movie", 0, "Show movie files", ""); + RNA_def_property_boolean_sdna(prop, NULL, "filter", MOVIEFILE); + prop= RNA_def_boolean(ot->srna, "filter_folder", 0, "Show folders", ""); + RNA_def_property_boolean_sdna(prop, NULL, "filter", FOLDERFILE); + + prop= RNA_def_property(ot->srna, "display", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "display"); + RNA_def_property_enum_items(prop, file_display_items); + RNA_def_property_ui_text(prop, "Display Mode", "Display mode for the file list"); + } /******************** replace image operator ********************/ |