Assets: Get asset path via new identifier (not via file browser hacks)

With the asset identifier introduced in the previous commit, we can now
locate an asset just from its `AssetRepresentation`, without requiring
information from the asset library and the file browser storage. With
this we can remove some hacks and function parameters. A RNA/BPY
function is also affected, but I didn't remove the paramter to keep
compatibility. It's simply ignored and not required anymore, noted this
in the parameter description (noted for T102877).
This commit is contained in:
Julian Eisel
2022-11-30 19:24:24 +01:00
parent f68da703a5
commit ccc9eef1b9
17 changed files with 47 additions and 148 deletions

View File

@@ -97,13 +97,12 @@ class ASSET_OT_open_containing_blend_file(Operator):
def execute(self, context):
asset_file_handle = context.asset_file_handle
asset_library_ref = context.asset_library_ref
if asset_file_handle.local_id:
self.report({'WARNING'}, "This asset is stored in the current blend file")
return {'CANCELLED'}
asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref)
asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle)
self.open_in_new_blender(asset_lib_path)
wm = context.window_manager

View File

@@ -862,8 +862,7 @@ def asset_path_str_get(_self):
if asset_file_handle.local_id:
return "Current File"
asset_library_ref = bpy.context.asset_library_ref
return bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref)
return bpy.types.AssetHandle.get_full_library_path(asset_file_handle)
def register_props():