unreal.UsdConversionLibrary
¶
- class unreal.UsdConversionLibrary(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
BlueprintFunctionLibrary
Wrapped static conversion functions from the UsdUtilities module, so that they can be used via scripting
C++ Source:
Plugin: USDImporter
Module: USDExporter
File: USDConversionBlueprintLibrary.h
- classmethod add_payload(referencing_stage_path, referencing_prim_path, target_stage_path) None ¶
Add Payload
- classmethod add_reference(referencing_stage_path, referencing_prim_path, target_stage_path) None ¶
Add Reference
- classmethod can_export_to_layer(target_file_path) bool ¶
Checks whether we can create a USD Layer with “TargetFilePath” as identifier and export to it
- classmethod can_paste_prims() bool ¶
Returns true if we have prims that we can paste within our clipboard stage
- Return type:
- classmethod clear_metadata_field(asset_user_data, key, stage_identifier='', prim_path='', trigger_property_change_events=True) bool ¶
Clear Metadata Field
- classmethod copy_prims(stage_root_layer, prim_paths) bool ¶
Copies flattened versions of the input prims onto the clipboard stage. These copied prims can then be pasted with PastePrims.
- classmethod cut_prims(stage_root_layer, prim_paths) bool ¶
Copies flattened versions of the input prims onto the clipboard stage and removes all the prim specs for Prims from their stages. These cut prims can then be pasted with PastePrims.
- classmethod duplicate_prims(stage_root_layer, prim_paths, duplicate_type, target_layer) Array[str] ¶
Duplicates all provided Prims one-by-one, performing the requested DuplicateType. See the documentation on EUsdDuplicateType for the different operation types.
The duplicated prims may be renamed in order to have valid names for the target location, which is why this function returns the pasted prim paths. This function returns just paths instead of actual prims because USD needs to respond to the notices about the created prim specs before the prims are fully created, which means we wouldn’t be able to return the created prims yet, in case this function was called from within an SdfChangeBlock.
- Parameters:
stage_root_layer (str) – Path to the root layer of the stage from which we should fetch the Prims
duplicate_type (UsdDuplicateType) – Type of prim duplication to perform
target_layer (str) – Target layer to use when duplicating, if relevant for that duplication type
- Returns:
Paths to the duplicated prim specs, after they were added as children of ParentPrim.
- Return type:
- classmethod generate_object_version_string(object_to_export, export_options) str ¶
Generates a unique identifier string that involves ObjectToExport’s package’s persistent guid, the corresponding file save date and time, and the number of times the package has been dirtied since last being saved. Optionally it can also combine that hash with a hash of the export options being used for the export, if available. This can be used to track the version of exported assets and levels, to prevent reexporting of actors and components.
- classmethod get_analytics_attributes(options) Array[AnalyticsEventAttr] ¶
Retrieves the analytics attributes to send for the provided options object
- Parameters:
options (LevelExporterUSDOptions) –
- Return type:
- classmethod get_instance_transforms(actor, foliage_type, instances_level=None) Array[Transform] ¶
Returns the transforms of all instances of a particular UFoliageType on a given level. If no level is provided all instances will be returned. Use GetUsedFoliageTypes() to retrieve all foliage types managed by a particular actor.
- Parameters:
actor (InstancedFoliageActor) –
foliage_type (FoliageType) –
instances_level (Level) –
- Return type:
- classmethod get_instanced_foliage_actor_for_level(create_if_none=False, level=None) InstancedFoliageActor ¶
Wraps AInstancedFoliageActor::GetInstancedFoliageActorForLevel, and allows retrieving the current AInstancedFoliageActor for a level. Will default to the current editor level if Level is left nullptr. This function is useful because it’s difficult to retrieve this actor otherwise, as it will be filtered from the results of functions like EditorLevelLibrary.get_all_level_actors()
- Parameters:
- Return type:
- classmethod get_loaded_level_names(world) Array[str] ¶
Returns the path name (e.g. “/Game/Maps/MyLevel”) of levels that are loaded on World. We use these to revert the World to its initial state after we force-stream levels in for exporting
- classmethod get_metadata_field(asset_user_data, key, stage_identifier='', prim_path='') UsdMetadataValue ¶
Get Metadata Field
- Parameters:
asset_user_data (UsdAssetUserData) –
key (str) –
stage_identifier (str) –
prim_path (str) –
- Return type:
- classmethod get_num_levels_to_export(world, levels_to_ignore) int32 ¶
Returns how many total Unreal levels (persistent + all sublevels) will be exported if we consider LevelsToIgnore
- classmethod get_prim_path_for_object(actor_or_component, parent_prim_path='', use_actor_folders=False) str ¶
Get Prim Path for Object
- classmethod get_schema_name_for_component(component) str ¶
Get Schema Name for Component
- Parameters:
component (SceneComponent) –
- Return type:
- classmethod get_source(foliage_type) Object ¶
Returns the source asset for a UFoliageType. It can be a UStaticMesh in case we’re dealing with a UFoliageType_InstancedStaticMesh, but it can be other types of objects.
- Parameters:
foliage_type (FoliageType) –
- Return type:
- classmethod get_usd_asset_user_data(object) UsdAssetUserData ¶
Retrieve the first instance of UUsdAssetUserData contained on the Object, if any
- Parameters:
object (Object) –
- Return type:
- classmethod get_used_foliage_types(actor) Array[FoliageType] ¶
Returns all the different types of UFoliageType assets that a particular AInstancedFoliageActor uses. This function exists because we want to retrieve all instances of all foliage types on an actor, but we can’t return nested containers from UFUNCTIONs, so users of this API should call this, and then GetInstanceTransforms.
- Parameters:
actor (InstancedFoliageActor) –
- Return type:
- classmethod get_visible_in_editor_level_names(world) Array[str] ¶
Returns the path name (e.g. “/Game/Maps/MyLevel”) of levels that checked to be visible in the editor within World. We use these to revert the World to its initial state after we force-stream levels in for exporting
- classmethod has_metadata_field(asset_user_data, key, stage_identifier='', prim_path='') bool ¶
Has Metadata Field
- Parameters:
asset_user_data (UsdAssetUserData) –
key (str) –
stage_identifier (str) –
prim_path (str) –
- Return type:
- classmethod make_path_relative_to_layer(anchor_layer_path, path_to_make_relative) str ¶
Make Path Relative to Layer
- classmethod paste_prims(stage_root_layer, parent_prim_path) Array[str] ¶
Pastes the prims from the clipboard stage as children of ParentPrim.
The pasted prims may be renamed in order to have valid names for the target location, which is why this function returns the pasted prim paths. This function returns just paths instead of actual prims because USD needs to respond to the notices about the created prim specs before the prims are fully created, which means we wouldn’t be able to return the created prims yet, in case this function was called from within an SdfChangeBlock.
- classmethod reapply_sequencer_animations() None ¶
If we used ReverseSequencerAnimations to undo the effect of an opened sequencer before export, this function can be used to re-apply the sequencer state back to the level after the export is complete
- classmethod remove_all_prim_specs(stage_root_layer, prim_path, target_layer) None ¶
Removes all the prim specs for Prim on the given Layer.
This function is useful in case the prim is inside a variant set: In that case, just calling FUsdStage::RemovePrim() will attempt to remove the “/Root/Example/Child”, which wouldn’t remove the “/Root{Varset=Var}Example/Child” spec, meaning the prim may still be left on the stage. Note that it’s even possible to have both of those specs at the same time: for example when we have a prim inside a variant set, but outside of it we have overrides to the same prim. This function will remove both.
- classmethod revert_sequencer_animations() None ¶
If we have the Sequencer open with a level sequence animating the level before export, this function can revert any actor or component to its unanimated state
- classmethod send_analytics(attrs, event_name, automated, elapsed_seconds, number_of_frames, extension) None ¶
Defer to the USDClasses module to actually send analytics information
- Parameters:
attrs (Array[AnalyticsEventAttr]) –
event_name (str) –
automated (bool) –
elapsed_seconds (double) –
number_of_frames (double) –
extension (str) –
- classmethod set_metadata_field(asset_user_data, key, value, value_type_name, stage_identifier='', prim_path='', trigger_property_change_events=True) bool ¶
Utilities that make it easier to get/set metadata fields without having to manipulate the nested struct instances directly.
It will create the struct entries automatically if needed, and overwrite existing entries with the same key if needed.
If the AssetUserData contains exactly one entry for StageIdentifier and one entry for PrimPath, you can omit those arguments
and that single entry will be used. If there are more or less than exactly one entry for StageIdentifier or for PrimPath however,
you must specify which one to use, and failing to do so will cause the functions to return false and emit a warning.
It is possible to get these functions to automatically trigger pre/post property changed events by providing “true” for
bTriggerPropertyChangeEvents, which is useful as it is not trivial to trigger those from Python/Blueprint given how the
metadata is stored inside nested structs and maps. If these AssetUserData belong to generated transient assets when opening
stages, emitting property change events causes those edits to be immediately written out to the opened USD Stage.
Returns true if it managed to set the new key-value pair.
- classmethod set_usd_asset_user_data(object, asset_user_data) bool ¶
Sets AssetUserData as the single UUsdAssetUserData on the Object, overwriting an existing one if encountered.
Returns true if it managed to add AssetUserData to Object.
- Parameters:
object (Object) –
asset_user_data (UsdAssetUserData) –
- Return type:
- classmethod stream_in_required_levels(world, levels_to_ignore) None ¶
Fully streams in and displays all levels whose names are not in LevelsToIgnore
- classmethod stream_out_levels(owning_world, level_names_to_stream_out, level_names_to_hide) None ¶
Streams out/hides sublevels that were streamed in before export
- classmethod stringify_as_double(value) str ¶
Stringify as Double
- Parameters:
value (double) –
- Return type:
- classmethod stringify_as_int4(value) str ¶
Stringify as Int 4
- Parameters:
value (IntVector4) –
- Return type:
- classmethod stringify_as_int4_array(value) str ¶
Stringify as Int 4Array
- Parameters:
value (Array[IntVector4]) –
- Return type:
- classmethod stringify_as_int64(value) str ¶
Stringify as Int 64
- Parameters:
value (int64) –
- Return type:
- classmethod stringify_as_timecode(value) str ¶
Stringify as Time Code
- Parameters:
value (double) –
- Return type:
- classmethod stringify_as_uchar(value) str ¶
Stringify as UChar
- Parameters:
value (uint8) –
- Return type:
- classmethod stringify_as_uint(value) str ¶
Stringify as UInt
- Parameters:
value (int32) –
- Return type:
- classmethod stringify_as_uint64(value) str ¶
Stringify as UInt 64
- Parameters:
value (int64) –
- Return type:
- classmethod unstringify_as_double(string) double ¶
Unstringify as Double
- Parameters:
string (str) –
- Return type:
double
- classmethod unstringify_as_int(string) int32 ¶
Unstringify as Int
- Parameters:
string (str) –
- Return type:
int32
- classmethod unstringify_as_int4(string) IntVector4 ¶
Unstringify as Int 4
- Parameters:
string (str) –
- Return type:
- classmethod unstringify_as_int4_array(string) Array[IntVector4] ¶
Unstringify as Int 4Array
- Parameters:
string (str) –
- Return type:
- classmethod unstringify_as_int64(string) int64 ¶
Unstringify as Int 64
- Parameters:
string (str) –
- Return type:
int64
- classmethod unstringify_as_timecode(string) double ¶
Unstringify as Time Code
- Parameters:
string (str) –
- Return type:
double
- classmethod unstringify_as_uchar(string) uint8 ¶
Unstringify as UChar
- Parameters:
string (str) –
- Return type:
uint8
- classmethod unstringify_as_uint(string) int32 ¶
Unstringify as UInt
- Parameters:
string (str) –
- Return type:
int32
- classmethod unstringify_as_uint64(string) int64 ¶
Unstringify as UInt 64
- Parameters:
string (str) –
- Return type:
int64