unreal.UsdConversionContext
¶
- class unreal.UsdConversionContext(outer=None, name='None')¶
Bases:
unreal.Object
Wraps the UnrealToUsd component conversion functions from the USDUtilities module so that they can be used by scripting languages.
This is an instanceable object instead of just static functions so that the USDStage to use for the conversions can be provided and cached between function calls, which is helpful because we’re forced to provide at most prim and layer file paths (as opposed to direct pxr::UsdPrim objects).
We can’t provide the pxr::UsdPrim object directly because USD types can’t be part of C++ function signatures that are automatically exposed to scripting languages. Lucikly we can use UsdUtils’ stage cache to make sure that C++ and e.g. Python are still referencing the same USD Stage in memory, so that we can e.g. use these functions to convert data within stages created via Python.
C++ Source:
Plugin: USDImporter
Module: USDExporter
File: USDConversionBlueprintContext.h
- cleanup() → None¶
Discards the currently opened stage. This is critical when using this class via scripting: The C++ destructor will not be called when the python object runs out of scope, so we would otherwise keep a strong reference to the stage
- convert_cine_camera_component(component, prim_path) → bool¶
Convert Cine Camera Component
- Parameters
component (CineCameraComponent) –
prim_path (str) –
- Returns
- Return type
- convert_directional_light_component(component, prim_path, time_code=3.4028234663852886e+38) → bool¶
Convert Directional Light Component
- Parameters
component (DirectionalLightComponent) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- convert_hism_component(component, prim_path, time_code=3.4028234663852886e+38) → bool¶
Convert Hism Component
- Parameters
component (HierarchicalInstancedStaticMeshComponent) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- convert_instanced_foliage_actor(actor, prim_path, time_code=3.4028234663852886e+38) → bool¶
Convert Instanced Foliage Actor
- Parameters
actor (InstancedFoliageActor) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- convert_landscape_proxy_actor_material(actor, prim_path, properties_to_bake, default_texture_size, textures_dir, time_code=3.4028234663852886e+38) → bool¶
Convert Landscape Proxy Actor Material
- Parameters
actor (LandscapeProxy) –
prim_path (str) –
properties_to_bake (Array(PropertyEntry)) –
default_texture_size (IntPoint) –
textures_dir (DirectoryPath) –
time_code (float) –
- Returns
- Return type
- convert_landscape_proxy_actor_mesh(actor, prim_path, lowest_lod, highest_lod, time_code=3.4028234663852886e+38) → bool¶
Convert Landscape Proxy Actor Mesh
- Parameters
actor (LandscapeProxy) –
prim_path (str) –
lowest_lod (int32) –
highest_lod (int32) –
time_code (float) –
- Returns
- Return type
- convert_light_component(component, prim_path, time_code=3.4028234663852886e+38) → bool¶
Note: We use FLT_MAX on these functions because Usd.TimeCode.Default().GetValue() is actually a nan, and nan arguments are automatically sanitized to 0.0f. We manually convert the FLT_MAX value into Usd.TimeCode.Default().GetValue() within the functions though, so if you want the Default timecode just omit the argument We are also forced to copypaste the FLT_MAX value (3.402823466e+38F) in here as the default arguments are parsed before the preprocessor replaces the defines
- Parameters
component (LightComponentBase) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- convert_mesh_component(component, prim_path) → bool¶
Convert Mesh Component
- Parameters
component (MeshComponent) –
prim_path (str) –
- Returns
- Return type
- convert_point_light_component(component, prim_path, time_code=3.4028234663852886e+38) → bool¶
Convert Point Light Component
- Parameters
component (PointLightComponent) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- convert_rect_light_component(component, prim_path, time_code=3.4028234663852886e+38) → bool¶
Convert Rect Light Component
- Parameters
component (RectLightComponent) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- convert_scene_component(component, prim_path) → bool¶
Convert Scene Component
- Parameters
component (SceneComponent) –
prim_path (str) –
- Returns
- Return type
- convert_sky_light_component(component, prim_path, time_code=3.4028234663852886e+38) → bool¶
Convert Sky Light Component
- Parameters
component (SkyLightComponent) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- convert_spot_light_component(component, prim_path, time_code=3.4028234663852886e+38) → bool¶
Convert Spot Light Component
- Parameters
component (SpotLightComponent) –
prim_path (str) –
time_code (float) –
- Returns
- Return type
- get_edit_target() → FilePath¶
Gets the filepath of the current edit target layer of our internal stage
- Returns
- Return type
- get_stage_root_layer() → FilePath¶
Gets the file path of the root layer of our current stage
- Returns
- Return type
- set_edit_target(edit_target_layer_path) → None¶
Sets the current edit target of our internal stage. When calling the conversion functions, prims and attributes will be authored on this edit target only
- Parameters
edit_target_layer_path (FilePath) –
- set_stage_root_layer(stage_root_layer_path) → None¶
Opens or creates a USD stage using StageRootLayerPath as root layer, creating the root layer if needed. All future conversions will fetch prims and get/set USD data to/from this stage. Note: You must remember to call Cleanup() when done, or else this object will permanently hold a reference to the opened stage!
- Parameters
stage_root_layer_path (FilePath) –