diff options
author | Julian Eisel <julian@blender.org> | 2021-10-29 17:45:08 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-01 14:12:28 +0300 |
commit | 2a4dfaa0e962d69345398833ea2f1b831fc6c202 (patch) | |
tree | ffb3bfcc430ff160b246cea8967002898062f786 /source/blender/editors/space_file/file_ops.c | |
parent | 81bd49d4fea41f6e569f3778724b33f15e95f853 (diff) |
Asset Browser: Correct name & tooltip for asset list refresh operator
The name and tooltip were talking about file-lists, which exposes the
fact that the Asset Browser uses the File Browser code in the UI, which
we shouldn't do. This can confuse users.
Instead have a dedicated operator for the Asset Browser with a proper
name and tooltip.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index a83e1974baf..844514759f3 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1950,8 +1950,36 @@ void FILE_OT_refresh(struct wmOperatorType *ot) /* api callbacks */ ot->exec = file_refresh_exec; - /* Operator works for file or asset browsing */ - ot->poll = ED_operator_file_active; /* <- important, handler is on window level */ + ot->poll = ED_operator_file_browsing_active; /* <- important, handler is on window level */ +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Refresh Asset Library Operator + * \{ */ + +static int file_asset_library_refresh_exec(bContext *C, wmOperator *UNUSED(unused)) +{ + wmWindowManager *wm = CTX_wm_manager(C); + SpaceFile *sfile = CTX_wm_space_file(C); + + ED_fileselect_clear(wm, sfile); + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); + + return OPERATOR_FINISHED; +} + +void FILE_OT_asset_library_refresh(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Refresh Asset Library"; + ot->description = "Reread assets and asset catalogs from the asset library on disk"; + ot->idname = "FILE_OT_asset_library_refresh"; + + /* api callbacks */ + ot->exec = file_asset_library_refresh_exec; + ot->poll = ED_operator_asset_browsing_active; } /** \} */ |