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

Parameters:
  • referencing_stage_path (str) –

  • referencing_prim_path (str) –

  • target_stage_path (str) –

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

Parameters:

target_file_path (str) –

Return type:

bool

classmethod can_paste_prims() bool

Returns true if we have prims that we can paste within our clipboard stage

Return type:

bool

classmethod clear_prim_clipboard() None

Clears all prims from our clipboard stage

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.

Parameters:
  • stage_root_layer (str) – Path to the root layer of the stage from which we should fetch the Prims

  • prim_paths (Array[str]) – Prims to copy

Returns:

True if we managed to copy

Return type:

bool

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.

Parameters:
  • stage_root_layer (str) – Path to the root layer of the stage from which we should fetch the Prims

  • prim_paths (Array[str]) – Prims to cut

Returns:

True if we managed to cut

Return type:

bool

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

  • prim_paths (Array[str]) – Prims to duplicate

  • 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:

Array[str]

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.

Parameters:
Return type:

str

classmethod get_actors_to_convert(world) Set[Actor]

Get Actors to Convert

Parameters:

world (World) –

Return type:

Set[Actor]

classmethod get_analytics_attributes(options) Array[AnalyticsEventAttr]

Retrieves the analytics attributes to send for the provided options object

Parameters:

options (LevelExporterUSDOptions) –

Return type:

Array[AnalyticsEventAttr]

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:
Return type:

Array[Transform]

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:
  • create_if_none (bool) –

  • level (Level) –

Return type:

InstancedFoliageActor

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

Parameters:

world (World) –

Return type:

Array[str]

classmethod get_prim_path_for_object(actor_or_component, parent_prim_path='', use_actor_folders=False) str

Get Prim Path for Object

Parameters:
  • actor_or_component (Object) –

  • parent_prim_path (str) –

  • use_actor_folders (bool) –

Return type:

str

classmethod get_schema_name_for_component(component) str

Get Schema Name for Component

Parameters:

component (SceneComponent) –

Return type:

str

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:

Object

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:

Array[FoliageType]

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

Parameters:

world (World) –

Return type:

Array[str]

classmethod insert_sub_layer(parent_layer_path, sub_layer_path, index=-1) None

Insert Sub Layer

Parameters:
  • parent_layer_path (str) –

  • sub_layer_path (str) –

  • index (int32) –

classmethod make_path_relative_to_layer(anchor_layer_path, path_to_make_relative) str

Make Path Relative to Layer

Parameters:
  • anchor_layer_path (str) –

  • path_to_make_relative (str) –

Return type:

str

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.

Parameters:
  • stage_root_layer (str) – Path to the root layer of the stage from which we should fetch the Prims

  • parent_prim_path (str) – Prim that will become parent to the pasted prims

Returns:

Paths to the pasted prim specs, after they were added as children of ParentPrim

Return type:

Array[str]

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.

Parameters:
  • stage_root_layer (str) – Path to the root layer of the stage from which we should fetch the Prims

  • prim_path (str) – Prim to remove

  • target_layer (str) –

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:
classmethod stream_in_required_levels(world, levels_to_ignore) None

Fully streams in and displays all levels whose names are not in LevelsToIgnore

Parameters:
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

Parameters:
  • owning_world (World) –

  • level_names_to_stream_out (Array[str]) –

  • level_names_to_hide (Array[str]) –