From 13a7516f436597e7f60d0696afa16e8e6d6735fb Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Wed, 7 Sep 2022 13:27:27 +0300 Subject: Cleanup: factor out "set default filepath" into a ED_fileselect_ensure_default_filepath Follow up to D15904, a bunch of places had exact same logic for "is filepath set? if not, set some default one", so factor all that out into a separate ED_fileselect_ensure_default_filepath function. --- source/blender/editors/include/ED_fileselect.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/editors/include') diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index e9fcd2bd5fe..9d5d8dd54cb 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -175,6 +175,14 @@ struct ScrArea *ED_fileselect_handler_area_find(const struct wmWindow *win, */ struct ScrArea *ED_fileselect_handler_area_find_any_with_op(const struct wmWindow *win); +/** + * If filepath property is not set on the operator, sets it to + * the blend file path (or untitled if file is not saved yet) with the given extension. + */ +void ED_fileselect_ensure_default_filepath(struct bContext *C, + struct wmOperator *op, + const char *extension); + /* TODO: Maybe we should move this to BLI? * On the other hand, it's using defines from space-file area, so not sure... */ int ED_path_extension_type(const char *path); -- cgit v1.2.3