unreal.AssetRegistry
¶
- class unreal.AssetRegistry(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
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.
- get_ancestor_class_names(class_path_name) Array[TopLevelAssetPath] or None ¶
Returns true if the specified ClassName’s ancestors could be found. If so, OutAncestorClassNames is a list of all its ancestors. This can be slow if temporary caching mode is not on
- Parameters:
class_path_name (TopLevelAssetPath) –
- Returns:
out_ancestor_class_names (Array[TopLevelAssetPath]):
- Return type:
Array[TopLevelAssetPath] or None
- get_asset_by_object_path(object_path, include_only_on_disk_assets=False) AssetData ¶
Get Asset by Object Path
- get_assets(filter, skip_ar_filtered_assets=True) 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:
- Returns:
out_asset_data (Array[AssetData]): the list of assets in this path
- Return type:
- get_assets_by_class(class_path_name, search_sub_classes=False) Array[AssetData] or None ¶
Gets asset data for all assets with the supplied class
- Parameters:
class_path_name (TopLevelAssetPath) – the full path of the class name of the assets requested, in a TopLevelAssetPath structure.
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:
- get_assets_by_package_name(package_name, include_only_on_disk_assets=False, skip_ar_filtered_assets=True) Array[AssetData] or None ¶
Gets asset data for the assets in the package with the specified package name see: IAssetRegistry class header for bIncludeOnlyOnDiskAssets.
- Parameters:
package_name (Name) – the package name for the requested assets (eg, /Game/MyFolder/MyAsset)
include_only_on_disk_assets (bool) – If true, use only DiskGatheredData, do not calculate from UObjects.
skip_ar_filtered_assets (bool) – If true, skips Objects that return true for IsAsset but are not assets in the current platform.
- Returns:
out_asset_data (Array[AssetData]): the list of assets in this path
- Return type:
- 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 see: IAssetRegistry class header for bIncludeOnlyOnDiskAssets.
- Parameters:
- Returns:
out_asset_data (Array[AssetData]): the list of assets in this path
- Return type:
- get_assets_by_paths(package_paths, recursive=False, include_only_on_disk_assets=False) Array[AssetData] or None ¶
Gets asset data for all assets in any of the supplied folder paths see: IAssetRegistry class header for bIncludeOnlyOnDiskAssets.
- Parameters:
- Returns:
out_asset_data (Array[AssetData]): the list of assets in this path
- Return type:
- 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:
- get_derived_class_names(class_names, excluded_class_names) Set[TopLevelAssetPath] ¶
Returns the names of all classes derived by the supplied class names, excluding any classes matching the excluded class names. This can be slow if temporary caching mode is not on
- Parameters:
class_names (Array[TopLevelAssetPath]) –
excluded_class_names (Set[TopLevelAssetPath]) –
- Returns:
out_derived_class_names (Set[TopLevelAssetPath]):
- Return type:
- 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:
- get_sub_paths(base_path, recurse) Array[str] ¶
Gets a list of all paths that are currently cached below the passed-in base path
- has_assets(package_path, recursive=False) bool ¶
Does the given path contain assets, optionally also testing sub-paths?
- is_loading_assets() bool ¶
Returns true if the asset registry is currently loading files and does not yet know about all assets
- Return type:
- is_search_all_assets() bool ¶
Whether SearchAllAssets has been called, or was auto-called at startup. When async (editor or cooking), if SearchAllAssets has ever been called, any newly-mounted directory will be automatically searched.
- Return type:
- is_search_async() bool ¶
Whether searching is done async (and was started at startup), or synchronously and on-demand, requiring ScanPathsSynchronous or SearchAllAssets.
- Return type:
- k2_get_asset_by_object_path(object_path, include_only_on_disk_assets=False, skip_ar_filtered_assets=True) AssetData ¶
Gets the asset data for the specified object path see: IAssetRegistry class header for bIncludeOnlyOnDiskAssets.
- Parameters:
object_path (SoftObjectPath) – the path of the object to be looked up
include_only_on_disk_assets (bool) – If true, use only DiskGatheredData, do not calculate from UObjects.
skip_ar_filtered_assets (bool) – If true, skips Objects that return true for IsAsset but are not assets in the current platform.
- Returns:
the assets data;Will be invalid if object could not be found
- Return type:
- 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) Array[AssetData] ¶
Trims items out of the asset data list that do not pass the supplied filter
- 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
- scan_modified_asset_files(file_paths) None ¶
Forces a rescan of specific filenames, call this when you need to refresh from disk
- scan_paths_synchronous(paths, force_rescan=False, ignore_deny_list_scan_filters=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
- 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) Array[AssetData] ¶
Trims items out of the asset data list that pass the supplied filter