diff options
author | Julian Eisel <julian@blender.org> | 2022-05-07 00:03:36 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-05-07 00:05:38 +0300 |
commit | aee8e49031464215998a71b05dd4b20fb57959d8 (patch) | |
tree | bde83d921e6075843df260d5345531dc34223809 /source/blender | |
parent | a7417ba84527d57391599d26a1872c035c5e2c48 (diff) |
Fix T97751: New OBJ IO - File Browser doesn't filter by .obj/.mtl
Makes the File Browser filter by .obj and .mtl files by default again. Note
that this commit focuses on fixing this specific bug, further
refactors/tweaks/fixes are planned (see D14863).
Differential Revision: https://developer.blender.org/D14862
Reviewed by: Aras Pranckevicius
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/io/io_obj.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 3 |
2 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index 3345d422bd1..9156ff15ded 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -231,6 +231,8 @@ static bool wm_obj_export_check(bContext *C, wmOperator *op) void WM_OT_obj_export(struct wmOperatorType *ot) { + PropertyRNA *prop; + ot->name = "Export Wavefront OBJ"; ot->description = "Save the scene to a Wavefront OBJ file"; ot->idname = "WM_OT_obj_export"; @@ -244,7 +246,7 @@ void WM_OT_obj_export(struct wmOperatorType *ot) ot->flag |= OPTYPE_PRESET; WM_operator_properties_filesel(ot, - FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, + FILE_TYPE_FOLDER, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, @@ -358,6 +360,10 @@ void WM_OT_obj_export(struct wmOperatorType *ot) "Every smooth-shaded face is assigned group \"1\" and every flat-shaded face \"off\""); RNA_def_boolean( ot->srna, "smooth_group_bitflags", false, "Generate Bitflags for Smooth Groups", ""); + + /* Only show .obj or .mtl files by default. */ + prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); + RNA_def_property_flag(prop, PROP_HIDDEN); } static int wm_obj_import_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -415,6 +421,8 @@ static void wm_obj_import_draw(bContext *C, wmOperator *op) void WM_OT_obj_import(struct wmOperatorType *ot) { + PropertyRNA *prop; + ot->name = "Import Wavefront OBJ"; ot->description = "Load a Wavefront OBJ scene"; ot->idname = "WM_OT_obj_import"; @@ -425,7 +433,7 @@ void WM_OT_obj_import(struct wmOperatorType *ot) ot->ui = wm_obj_import_draw; WM_operator_properties_filesel(ot, - FILE_TYPE_FOLDER | FILE_TYPE_OBJECT_IO, + FILE_TYPE_FOLDER, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_SHOW_PROPS, @@ -453,4 +461,8 @@ void WM_OT_obj_import(struct wmOperatorType *ot) false, "Validate Meshes", "Check imported mesh objects for invalid data (slow)"); + + /* Only show .obj or .mtl files by default. */ + prop = RNA_def_string(ot->srna, "filter_glob", "*.obj;*.mtl", 0, "Extension Filter", ""); + RNA_def_property_flag(prop, PROP_HIDDEN); } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 9f71d6f77c7..59ecef7d4c6 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -2802,7 +2802,8 @@ int ED_path_extension_type(const char *path) if (BLI_path_extension_check(path, ".zip")) { return FILE_TYPE_ARCHIVE; } - if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", ".svg", NULL)) { + if (BLI_path_extension_check_n( + path, ".obj", ".mtl", ".3ds", ".fbx", ".glb", ".gltf", ".svg", NULL)) { return FILE_TYPE_OBJECT_IO; } if (BLI_path_extension_check_array(path, imb_ext_image)) { |