Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-11-23 20:40:31 +0300
committerJulian Eisel <julian@blender.org>2021-11-23 20:40:31 +0300
commit9e5aae4215d0070c2af7da970a9fb1950ed7f4db (patch)
tree87f0125638896aa988e3cadd835c03495ae2b80f /release
parent792badcfefcb92aadc16346f0dc11299a8da0ced (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')
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/blender_default.py2
-rw-r--r--release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py4
-rw-r--r--release/scripts/startup/bl_operators/assets.py10
-rw-r--r--release/scripts/startup/bl_ui/space_filebrowser.py2
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 d6032a3ecce..9e0d23a04e2 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -2143,7 +2143,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()