unreal.EditorAssetSubsystem
¶
- class unreal.EditorAssetSubsystem(outer: Optional[Object] = None, name: Union[Name, str] = 'None')¶
Bases:
EditorSubsystem
UEditorAssetSubsystem Subsystem for exposing asset related utilities to scripts. Asset Paths can be represented in the following ways:
(Reference/Text Path) StaticMesh’/Game/MyFolder/MyAsset.MyAsset’ (Full Name) StaticMesh /Game/MyFolder/MyAsset.MyAsset (Path Name) /Game/MyFolder/MyAsset.MyAsset (Package Name) /Game/MyFolder/MyAsset
- Directory Paths can be represented in the following ways:
/Game/MyNewFolder/ /Game/MyNewFolder
C++ Source:
Module: UnrealEd
File: EditorAssetSubsystem.h
- add_on_extract_asset_from_file(delegate) None ¶
Call this to add a callback to extract an asset from a file, for example from a drag and drop operation.
- Parameters:
delegate (OnExtractAssetFromFileDynamic) –
- checkout_directory(directory_path, recursive=True) bool ¶
Checkout all assets in a directory. It will load the assets if needed. All objects that are in the directory will be checked out. Assets will be loaded before being checked out.
- consolidate_assets(asset_to_consolidate_to, assets_to_consolidate) bool ¶
Consolidates assets by replacing all references/uses of the provided AssetsToConsolidate with references to AssetToConsolidateTo. This is useful when you want all references of assets to be replaced by a single asset. The function first attempts to directly replace all relevant references located within objects that are already loaded and in memory. Next, it deletes the AssetsToConsolidate, leaving behind object redirectors to AssetToConsolidateTo. note: The AssetsToConsolidate are DELETED by this function. note: Modified objects will be saved if the operation succeeds.
- Parameters:
- Returns:
True if the operation succeeds.
- Return type:
- delete_asset(asset_path_to_delete) bool ¶
Delete the package an asset is in. All objects in the package will be deleted. This is a Force Delete. It does not check if the asset has references in other Levels or by Actors. It will close all the asset editors and may clear the Transaction buffer (Undo History). Will try to mark the file as deleted. The Asset will be loaded before being deleted.
- delete_directory(directory_path) bool ¶
Delete the packages inside a directory. If the directory is then empty, delete the directory. This is a Force Delete. It does not check if the assets have references in other Levels or by Actors. It will close all the asset editors and may clear the Transaction buffer (Undo History). Will try to mark the file as deleted. Assets will be loaded before being deleted. The search is always recursive. It will try to delete the sub folders.
- delete_loaded_asset(asset_to_delete) bool ¶
Delete an asset that is already loaded. This is a Force Delete. It does not check if the asset has references in other Levels or by Actors. It will close all the asset editors and may clear the Transaction buffer (Undo History). Will try to mark the file as deleted.
- delete_loaded_assets(assets_to_delete) bool ¶
Delete assets that are already loaded. This is a Force Delete. It does not check if the assets have references in other Levels or by Actors. It will close all the asset editors and may clear the Transaction buffer (Undo History). Will try to mark the files as deleted.
- does_directory_contain_assets(directory_path, recursive=True) bool ¶
Check if a directory contains any assets.
- duplicate_asset(source_asset_path, destination_asset_path) Object ¶
Duplicate an asset. Will try to checkout the file. The Asset will be loaded before being duplicated.
- duplicate_directory(source_directory_path, destination_directory_path) bool ¶
Duplicate a directory and the assets in it. Will try to checkout the files. The Assets will be loaded before being duplicated.
- duplicate_loaded_asset(source_asset, destination_asset_path) Object ¶
Duplicate an asset that is already loaded. Will try to checkout the file.
- find_asset_data(asset_path) AssetData ¶
Return the AssetData for the Asset that can then be used with AssetRegistryHelpers.
- find_package_referencers_for_asset(asset_path, load_assets_to_confirm=False) Array[str] ¶
Find Package Referencers for an asset. Only Soft and Hard dependencies will be looked for. Soft are dependencies which don’t need to be loaded for the object to be used. Hard are dependencies which are required for correct usage of the source asset and must be loaded at the same time. Other references may exist. The asset may be currently used in memory by another asset, by the editor or by code. Package dependencies are cached with the asset. False positives can happen until all the assets are loaded and re-saved.
- get_metadata_tag(object, tag) str ¶
Get the value associated with the given tag of a loaded asset’s metadata.
- get_path_name_for_loaded_asset(loaded_asset) str ¶
Return a valid AssetPath for a loaded asset. Similar to GetPathName(). The format will be: /Game/MyFolder/MyAsset.MyAsset
- get_tag_values(asset_path) Map[Name, str] ¶
Gets all TagValues (from Asset Registry) associated with an (unloaded) asset as strings value.
- list_assets(directory_path, recursive=True, include_folder=False) Array[str] ¶
Return the list of all the assets found in the DirectoryPath.
- list_assets_by_tag_value(tag_name, tag_value) Array[str] ¶
Return the list of all the assets that have the pair of Tag/Value.
- load_asset(asset_path) Object ¶
Load an asset. It will verify if the object is already loaded and only load it if it’s necessary.
- load_blueprint_class(asset_path)¶
Load a Blueprint asset and return its generated class. It will verify if the object is already loaded and only load it if it’s necessary.
- remove_on_extract_asset_from_file(delegate) None ¶
Call this to remove a callback added with AddOnExtractAssetFromFile.
- Parameters:
delegate (OnExtractAssetFromFileDynamic) –
- rename_asset(source_asset_path, destination_asset_path) bool ¶
Rename an asset. Equivalent to a Move operation. Will try to checkout the file. The Asset will be loaded before being renamed.
- rename_directory(source_directory_path, destination_directory_path) bool ¶
Rename a directory. Equivalent to a Move operation moving all contained assets. Will try to checkout the files. The Assets will be loaded before being renamed.
- rename_loaded_asset(source_asset, destination_asset_path) bool ¶
Rename an asset that is already loaded. Equivalent to a Move operation. Will try to checkout the file.
- save_asset(asset_to_save, only_if_is_dirty=True) bool ¶
Save the packages the assets live in. All objects that live in the package will be saved. Will try to checkout the file first. The Asset will be loaded before being saved.
- save_directory(directory_path, only_if_is_dirty=True, recursive=True) bool ¶
Save the packages the assets live in inside the directory. All objects that are in the directory will be saved. Will try to checkout the file first. Assets will be loaded before being saved.
- save_loaded_asset(asset_to_save, only_if_is_dirty=True) bool ¶
Save the package the asset lives in. All objects that live in the package will be saved. Will try to checkout the file.