unreal.EditorAssetLibrary
¶
- class unreal.EditorAssetLibrary(outer=None, name='None')¶
Bases:
unreal.BlueprintFunctionLibrary
Utility class to do most of the common functionalities with the ContentBrowser. The AssetRegistryHelpers class has more complex utilities. Use FindAssetData to get a FAssetData from an Asset Path. The Asset Path can be represented by
ie. (Reference/Text Path) StaticMesh’/Game/MyFolder/MyAsset.MyAsset’ ie. (Full Name) StaticMesh /Game/MyFolder/MyAsset.MyAsset ie. (Path Name) /Game/MyFolder/MyAsset.MyAsset ie. (Package Name) /Game/MyFolder/MyAsset
- The Directory Path can be represented by
ie. /Game/MyNewFolder/ ie. /Game/MyNewFolder
All operations can be slow. The editor should not be in play in editor mode. It will not work on assets of the type level.
C++ Source:
Plugin: EditorScriptingUtilities
Module: EditorScriptingUtilities
File: EditorAssetLibrary.h
- classmethod checkout_directory(directory_path, recursive=True) → bool¶
Checkout assets from the Content Browser. It will load the assets if needed. All objects that are in the directory will be checkout. Assets will be loaded before being checkout.
- classmethod checkout_loaded_asset(asset_to_checkout) → bool¶
Checkout the asset from the Content Browser.
- classmethod checkout_loaded_assets(assets_to_checkout) → bool¶
Checkout the assets from the Content Browser.
- classmethod consolidate_assets(asset_to_consolidate_to, assets_to_consolidate) → bool¶
Consolidates an asset 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
- classmethod delete_asset(asset_path_to_delete) → bool¶
Delete the package the assets live in. All objects that live in the package will be deleted. This is a Force Delete. It doesn’t 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.
- classmethod 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 doesn’t 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.
- classmethod delete_loaded_asset(asset_to_delete) → bool¶
Delete an asset from the Content Browser that is already loaded. This is a Force Delete. It doesn’t 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.
- classmethod delete_loaded_assets(assets_to_delete) → bool¶
Delete assets from the Content Browser that are already loaded. This is a Force Delete. It doesn’t 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.
- classmethod does_directory_exist(directory_path) → bool¶
Check is the directory exist in the Content Browser.
- classmethod does_directory_have_assets(directory_path, recursive=True) → bool¶
Check if there any asset that exist in the directory.
- classmethod duplicate_asset(source_asset_path, destination_asset_path) → Object¶
Duplicate an asset from the Content Browser. Will try to checkout the file. The Asset will be loaded before being duplicated.
- classmethod duplicate_directory(source_directory_path, destination_directory_path) → bool¶
Duplicate asset from the Content Browser that are in the folder. Will try to checkout the files. The Assets will be loaded before being duplicated.
- classmethod duplicate_loaded_asset(source_asset, destination_asset_path) → Object¶
Duplicate an asset from the Content Browser that is already loaded. Will try to checkout the file.
- classmethod find_asset_data(asset_path) → AssetData¶
Return the AssetData for the Asset that can then be used with the more complex lib AssetRegistryHelpers.
- classmethod find_package_referencers_for_asset(asset_path, load_assets_to_confirm=False)¶
Find Package Referencers for an asset. Only Soft and Hard dependencies would be looked for. Soft are dependencies which don’t need to be loaded for the object to be used. Had 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 positive can happen until all the assets are loaded and re-saved.
- classmethod get_metadata_tag(object, tag) → str¶
Get the value associated with the given tag of a loaded asset’s metadata.
- classmethod get_metadata_tag_values(object)¶
Get all tags/values of a loaded asset’s metadata.
- classmethod get_path_name_for_loaded_asset(loaded_asset) → str¶
Return a valid AssetPath for a loaded asset. The asset need to be a valid asset in the Content Browser. Similar to GetPathName(). The format will be: /Game/MyFolder/MyAsset.MyAsset
- classmethod get_tag_values(asset_path)¶
Gets all TagValues (from Asset Registry) associated with an (unloaded) asset as strings value.
- classmethod list_asset_by_tag_value(tag_name, tag_value)¶
Return the list of all the assets that have the pair of Tag/Value.
- classmethod list_assets(directory_path, recursive=True, include_folder=False)¶
Return the list of all the assets found in the DirectoryPath.
- classmethod load_asset(asset_path) → Object¶
Load an asset from the Content Browser. It will verify if the object is already loaded and only load it if it’s necessary.
- classmethod load_blueprint_class(asset_path)¶
Load a Blueprint asset from the Content Browser and return its generated class. It will verify if the object is already loaded and only load it if it’s necessary.
- classmethod make_directory(directory_path) → bool¶
Create the directory on disk and in the Content Browser.
- classmethod remove_metadata_tag(object, tag) → None¶
Remove the given tag from a loaded asset’s metadata.
- classmethod rename_asset(source_asset_path, destination_asset_path) → bool¶
Rename an asset from the Content Browser. Equivalent to a Move operation. Will try to checkout the file. The Asset will be loaded before being renamed.
- classmethod rename_directory(source_directory_path, destination_directory_path) → bool¶
Rename assets from the Content Browser that are in the folder. Equivalent to a Move operation. Will try to checkout the files. The Assets will be loaded before being renamed.
- classmethod rename_loaded_asset(source_asset, destination_asset_path) → bool¶
Rename an asset from the Content Browser that is already loaded. Equivalent to a Move operation. Will try to checkout the files.
- classmethod 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.
- classmethod 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.
- classmethod save_loaded_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.
- classmethod save_loaded_assets(assets_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 files.