diff options
author | Julian Eisel <julian@blender.org> | 2021-11-23 20:40:31 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-23 20:57:25 +0300 |
commit | ea93e5df6c4cd42dc19073fd61e11ccd1a01c395 (patch) | |
tree | 226fc592d68effbacb2a8e68a5b6110e3fe497e5 /release | |
parent | 60befc8f0284e70fda2ef1d704cb3f81ec406170 (diff) |
Asset: Merge asset library/list refresh operators
In rBdcdbaf89bd11, I introduced a new operator
(`file.asset_library_refresh()`) to handle Asset Browser refreshing more
separate from File Browser refreshing. However, there already was
`asset.asset_list_refresh()`, which at this point only works for asset
view templates, but was intended to cover the Asset Browser case in
future too. This would happen once the Asset Browser uses the asset list
design of the asset view template.
So rather than having two operators for refreshing asset library data,
have one that just handles both cases, until they converge into one.
This avoids changes to the Python API in future (deprecating/changing
operators).
Differential Revision: https://developer.blender.org/D13239
Diffstat (limited to 'release')
4 files changed, 6 insertions, 12 deletions
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index dbc93cb6caa..c7942ca4135 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -2147,7 +2147,7 @@ def km_file_browser(params): ("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, None), # The two refresh operators have polls excluding each other (so only one is available depending on context). ("file.refresh", {"type": 'R', "value": 'PRESS'}, None), - ("file.asset_library_refresh", {"type": 'R', "value": 'PRESS'}, None), + ("asset.library_refresh", {"type": 'R', "value": 'PRESS'}, None), ("file.parent", {"type": 'P', "value": 'PRESS'}, None), ("file.previous", {"type": 'BACK_SPACE', "value": 'PRESS'}, None), ("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, None), diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py index 37cd554e872..3019322d340 100644 --- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py +++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py @@ -1229,7 +1229,7 @@ def km_file_browser(params): ("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "ctrl": True}, None), # The two refresh operators have polls excluding each other (so only one is available depending on context). ("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), - ("file.asset_library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), + ("asset.library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), ("file.previous", {"type": 'BACK_SPACE', "value": 'PRESS'}, None), ("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, None), ("wm.context_toggle", {"type": 'H', "value": 'PRESS'}, @@ -1276,7 +1276,7 @@ def km_file_browser_main(params): ("file.mouse_execute", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), # The two refresh operators have polls excluding each other (so only one is available depending on context). ("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), - ("file.asset_library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), + ("asset.library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None), ("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'}, {"properties": [("open", False), ("deselect_all", True)]}), diff --git a/release/scripts/startup/bl_operators/assets.py b/release/scripts/startup/bl_operators/assets.py index 58f02201905..32e63f77b23 100644 --- a/release/scripts/startup/bl_operators/assets.py +++ b/release/scripts/startup/bl_operators/assets.py @@ -142,14 +142,8 @@ class ASSET_OT_open_containing_blend_file(Operator): if returncode: self.report({'WARNING'}, "Blender sub-process exited with error code %d" % returncode) - # TODO(Sybren): Replace this with a generic "reload assets" operator - # that can run outside of the Asset Browser context. - if bpy.ops.file.refresh.poll(): - bpy.ops.file.refresh() - if bpy.ops.asset.list_refresh.poll(): - bpy.ops.asset.list_refresh() - if bpy.ops.file.asset_library_refresh.poll(): - bpy.ops.file.asset_library_refresh() + if bpy.ops.asset.library_refresh.poll(): + bpy.ops.asset.library_refresh() self.cancel(context) return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index f601c795660..4ae9a33785f 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -793,7 +793,7 @@ class ASSETBROWSER_MT_context_menu(AssetBrowserMenu, Menu): st = context.space_data params = st.params - layout.operator("file.asset_library_refresh") + layout.operator("asset.library_refresh") layout.separator() |