unreal.AssetRegistry

class unreal.AssetRegistry(outer=None, name='None')

Bases: unreal.Interface

Asset Registry

C++ Source:

  • Module: AssetRegistry

  • File: IAssetRegistry.h

get_all_assets(include_only_on_disk_assets=False)Array(AssetData) or None

Gets asset data for all assets in the registry. This method may be slow, use a filter if possible to avoid iterating over the entire registry.

Parameters

include_only_on_disk_assets (bool) –

Returns

out_asset_data (Array(AssetData)): the list of assets in this path

Return type

Array(AssetData) or None

get_all_cached_paths()

Gets a list of all paths that are currently cached

Returns

out_path_list (Array(str)):

Return type

Array(str)

get_asset_by_object_path(object_path, include_only_on_disk_assets=False)AssetData

Gets the asset data for the specified object path

Parameters
  • object_path (Name) – the path of the object to be looked up

  • include_only_on_disk_assets (bool) – if true, in-memory objects will be ignored. The call will be faster.

Returns

the assets data;Will be invalid if object could not be found

Return type

AssetData

get_assets(filter)Array(AssetData) or None

Gets asset data for all assets that match the filter. Assets returned must satisfy every filter component if there is at least one element in the component’s array. Assets will satisfy a component if they match any of the elements in it.

Parameters

filter (ARFilter) – filter to apply to the assets in the AssetRegistry

Returns

out_asset_data (Array(AssetData)): the list of assets in this path

Return type

Array(AssetData) or None

get_assets_by_class(class_name, search_sub_classes=False)Array(AssetData) or None

Gets asset data for all assets with the supplied class

Parameters
  • class_name (Name) – the class name of the assets requested

  • search_sub_classes (bool) – if true, all subclasses of the passed in class will be searched as well

Returns

out_asset_data (Array(AssetData)): the list of assets in this path

Return type

Array(AssetData) or None

get_assets_by_package_name(package_name, include_only_on_disk_assets=False)Array(AssetData) or None

Gets asset data for the assets in the package with the specified package name

Parameters
  • package_name (Name) – the package name for the requested assets (eg, /Game/MyFolder/MyAsset)

  • include_only_on_disk_assets (bool) –

Returns

out_asset_data (Array(AssetData)): the list of assets in this path

Return type

Array(AssetData) or None

get_assets_by_path(package_path, recursive=False, include_only_on_disk_assets=False)Array(AssetData) or None

Gets asset data for all assets in the supplied folder path

Parameters
  • package_path (Name) – the path to query asset data in (eg, /Game/MyFolder)

  • recursive (bool) – if true, all supplied paths will be searched recursively

  • include_only_on_disk_assets (bool) –

Returns

out_asset_data (Array(AssetData)): the list of assets in this path

Return type

Array(AssetData) or None

get_dependencies(package_name, dependency_options)Array(Name) or None

Gets a list of paths to objects that are referenced by the supplied package. (On disk references ONLY)

Parameters
  • package_name (Name) – the name of the package for which to gather dependencies (eg, /Game/MyFolder/MyAsset)

  • dependency_options (AssetRegistryDependencyOptions) – which kinds of dependencies to include in the output list

Returns

out_dependencies (Array(Name)): a list of packages that are referenced by the package whose path is PackageName

Return type

Array(Name) or None

get_referencers(package_name, reference_options)Array(Name) or None

Gets a list of packages that reference the supplied package. (On disk references ONLY)

Parameters
  • package_name (Name) – the name of the package for which to gather dependencies (eg, /Game/MyFolder/MyAsset)

  • reference_options (AssetRegistryDependencyOptions) – which kinds of references to include in the output list

Returns

out_referencers (Array(Name)): a list of packages that reference the package whose path is PackageName

Return type

Array(Name) or None

get_sub_paths(base_path, recurse)

Gets a list of all paths that are currently cached below the passed-in base path

Parameters
  • base_path (str) –

  • recurse (bool) –

Returns

out_path_list (Array(str)):

Return type

Array(str)

has_assets(package_path, recursive=False)bool

Does the given path contain assets, optionally also testing sub-paths?

Parameters
  • package_path (Name) – the path to query asset data in (eg, /Game/MyFolder)

  • recursive (bool) – if true, the supplied path will be tested recursively

Returns

Return type

bool

is_loading_assets()bool

Returns true if the asset registry is currently loading files and does not yet know about all assets

Returns

Return type

bool

prioritize_search_path(path_to_prioritize)None

If assets are currently being asynchronously scanned in the specified path, this will cause them to be scanned before other assets.

Parameters

path_to_prioritize (str) –

run_assets_through_filter(asset_data_list, filter)

Trims items out of the asset data list that do not pass the supplied filter

Parameters
Returns

asset_data_list (Array(AssetData)):

Return type

Array(AssetData)

scan_files_synchronous(file_paths, force_rescan=False)None

Scan the specified individual files right now and populate the asset registry. If bForceRescan is true, the paths will be scanned again, even if they were previously scanned

Parameters
scan_modified_asset_files(file_paths)None

Forces a rescan of specific filenames, call this when you need to refresh from disk

Parameters

file_paths (Array(str)) –

scan_paths_synchronous(paths, force_rescan=False)None

Scan the supplied paths recursively right now and populate the asset registry. If bForceRescan is true, the paths will be scanned again, even if they were previously scanned

Parameters
search_all_assets(synchronous_search)None

Look for all assets on disk (can be async or synchronous)

Parameters

synchronous_search (bool) –

use_filter_to_exclude_assets(asset_data_list, filter)

Trims items out of the asset data list that pass the supplied filter

Parameters
Returns

asset_data_list (Array(AssetData)):

Return type

Array(AssetData)

wait_for_completion()None

Wait for scan to be complete