diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-09-28 16:04:55 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-09-28 16:04:55 +0300 |
commit | 3674347849311b3722c27c67a61b1fac5528bd6b (patch) | |
tree | 1aa54d5f4b2e36952e15120ea89ce60aa823b082 /release | |
parent | 73b2ecb2975eb0438473e65c4c8f691e36524399 (diff) |
Assets: Clear Asset operator variants for clearing/setting Fake User
The Clear Asset operator (`ASSET_OT_clear`) now clears the Fake User.
This makes it symmetrical with the Mark Asset (`ASSET_OT_mark`)
operator, which sets Fake User to ensure assets are always saved to
disk.
Clear Asset now also has a `set_fake_user` boolean option, which allows
users to Clear Asset and set Fake User in one go.
The asset browser now shows these options in the context menu:
- Clear Asset: also clears Fake User. This makes it possible to actually
remove assets from the blend file without leaving the Asset Browser.
- Clear Asset (Set Fake User): keeps the Fake User bit set. This makes
it possible to "hide" the asset from the asset browser, without
loosing the actual data.
Internally, the `ED_asset_clear_id(id)` function now always clears the
Fake User bit. If it was intended that this bit was kept set, it's up to
the caller to explicitly call `id_fake_user_set(id)` afterwards.
Manifest Task: T90844
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12663
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_filebrowser.py | 5 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_outliner.py | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index ee9a8cc3346..b47404fd727 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -786,9 +786,10 @@ class ASSETBROWSER_MT_context_menu(AssetBrowserMenu, Menu): layout.separator() - sub = layout.row() + sub = layout.column() sub.operator_context = 'EXEC_DEFAULT' - sub.operator("asset.clear", text="Clear Asset") + sub.operator("asset.clear", text="Clear Asset").set_fake_user = False + sub.operator("asset.clear", text="Clear Asset (Set Fake User)").set_fake_user = True layout.separator() diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py index febd064147f..3d18160d90f 100644 --- a/release/scripts/startup/bl_ui/space_outliner.py +++ b/release/scripts/startup/bl_ui/space_outliner.py @@ -323,7 +323,8 @@ class OUTLINER_MT_asset(Menu): space = context.space_data layout.operator("asset.mark") - layout.operator("asset.clear") + layout.operator("asset.clear", text="Clear Asset").set_fake_user = False + layout.operator("asset.clear", text="Clear Asset (Set Fake User)").set_fake_user = True class OUTLINER_PT_filter(Panel): |