diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-03-05 17:00:56 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-03-05 17:11:40 +0300 |
commit | fe35551df2d874d51073b1dc4a582a1962255949 (patch) | |
tree | 7926ab181119dc64510e99695d4ab3ab634a6fde /source/blender/editors/include/ED_fileselect.h | |
parent | 0dd9a4a576452007da9d3f02a03499e50a8ddfae (diff) |
Asset Browser Space API: add `activate_asset_by_id()` function
Add an RNA function `activate_asset_by_id(asset_id: ID, deferred: bool)`
to the File Browser space type, which intended to be used to activate an
asset's entry as identified by its `ID *`. Calling it changes the active
asset, but only if the given ID can actually be found.
The activation can be deferred (by passing `deferred=True`) until the
next refresh operation has finished. This is necessary when an asset has
just been added, as it will be loaded by the filebrowser in a background
job.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D10549
Diffstat (limited to 'source/blender/editors/include/ED_fileselect.h')
-rw-r--r-- | source/blender/editors/include/ED_fileselect.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 7538dac1354..983ae94b637 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -145,6 +145,13 @@ void ED_fileselect_exit(struct wmWindowManager *wm, struct SpaceFile *sfile); bool ED_fileselect_is_asset_browser(const struct SpaceFile *sfile); +struct ID *ED_fileselect_active_asset_get(const struct SpaceFile *sfile); + +/* Activate the file that corresponds to the given ID. + * Pass deferred=true to wait for the next refresh before activating. */ +void ED_fileselect_activate_by_id(struct SpaceFile *sfile, + struct ID *asset_id, + const bool deferred); void ED_fileselect_window_params_get(const struct wmWindow *win, int win_size[2], |