Cleanup: move eFileSel_Action from DNA to WM_api.h

This isn't stored in blend files so it can be moved out of DNA.

Also use an enum for `WM_FILESEL_*` members.
This commit is contained in:
Campbell Barton 2022-03-26 18:39:42 +11:00
parent 4d5e8e5477
commit 9c41767d57
3 changed files with 27 additions and 24 deletions

View File

@ -989,12 +989,6 @@ typedef enum eFileSelectType {
FILE_SPECIAL = 9,
} eFileSelectType;
/** File-selector op property -> action. */
typedef enum eFileSel_Action {
FILE_OPENFILE = 0,
FILE_SAVE = 1,
} eFileSel_Action;
/**
* #FileSelectParams.flag / `sfile->params->flag`.
* \note short flag, also used as 16 lower bits of flags in link/append code

View File

@ -740,14 +740,33 @@ bool WM_operator_last_properties_store(struct wmOperator *op);
/* wm_operator_props.c */
void WM_operator_properties_confirm_or_exec(struct wmOperatorType *ot);
/** Flags for #WM_operator_properties_filesel. */
typedef enum eFileSel_Flag {
WM_FILESEL_RELPATH = 1 << 0,
WM_FILESEL_DIRECTORY = 1 << 1,
WM_FILESEL_FILENAME = 1 << 2,
WM_FILESEL_FILEPATH = 1 << 3,
WM_FILESEL_FILES = 1 << 4,
/** Show the properties sidebar by default. */
WM_FILESEL_SHOW_PROPS = 1 << 5,
} eFileSel_Flag;
ENUM_OPERATORS(eFileSel_Flag, WM_FILESEL_SHOW_PROPS)
/** Action for #WM_operator_properties_filesel. */
typedef enum eFileSel_Action {
FILE_OPENFILE = 0,
FILE_SAVE = 1,
} eFileSel_Action;
/**
* Default properties for file-select.
*/
void WM_operator_properties_filesel(struct wmOperatorType *ot,
int filter,
short type,
short action,
short flag,
eFileSel_Action action,
eFileSel_Flag flag,
short display,
short sort);
/**
@ -841,16 +860,6 @@ void WM_operator_properties_checker_interval_from_op(struct wmOperator *op,
bool WM_operator_properties_checker_interval_test(const struct CheckerIntervalParams *op_params,
int depth);
/* flags for WM_operator_properties_filesel */
#define WM_FILESEL_RELPATH (1 << 0)
#define WM_FILESEL_DIRECTORY (1 << 1)
#define WM_FILESEL_FILENAME (1 << 2)
#define WM_FILESEL_FILEPATH (1 << 3)
#define WM_FILESEL_FILES (1 << 4)
/* Show the properties sidebar by default. */
#define WM_FILESEL_SHOW_PROPS (1 << 5)
/**
* Operator as a Python command (resulting string must be freed).
*

View File

@ -58,12 +58,12 @@ static const EnumPropertyItem *wm_operator_properties_filesel_sort_items_itemf(
}
void WM_operator_properties_filesel(wmOperatorType *ot,
int filter,
short type,
short action,
short flag,
short display,
short sort)
const int filter,
const short type,
const eFileSel_Action action,
const eFileSel_Flag flag,
const short display,
const short sort)
{
PropertyRNA *prop;