USD¶
49 tools for USD stages, prims, attributes, variants, references, payloads and layers, and USD stage actors.
Back to the index.
add_usd_internal_reference¶
Additive
Add an internal reference composition arc (references another prim inside the SAME stage; no asset_path needed). The call fails when USD rejects the arc (added=false, its messages in errors) or the prim then lists no authored references (has_arcs=false).
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under. |
prim_path |
string | yes | Prim that owns the reference (the consumer). |
target_prim_path |
string | yes | Prim inside the same stage to reference. |
position |
string | no | List position (same vocabulary as add_usd_reference). Default "BackOfPrependList". |
Returns: { stage_name: string, prim_path: string, target_prim_path: string, added: bool, has_arcs: bool, position: string, errors: [string]? }
add_usd_payload¶
Additive
Add a payload composition arc to a prim (load-on-demand; payloads are NOT loaded by the stage unless an explicit Load rule says so), composing the prim prim_path_for_target of the layer at asset_path, or that layer's defaultPrim when prim_path_for_target is empty (uses_default_prim). The arc is authored on the stage's current edit target layer and stays in memory until save_usd_stage; no undo step. The call fails when USD rejects the arc (added=false, its messages in errors) or the prim then lists no authored payloads (has_arcs=false); an unregistered stage or a missing prim is an error. Read it back with get_usd_prim_metadata (key "payload"). Inverse: clear_usd_payloads (one payload with asset_path).
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under. |
prim_path |
string | yes | Prim that owns the payload. |
asset_path |
string | yes | Identifier of the layer containing the payload. |
prim_path_for_target |
string | no | Absolute path of the prim inside the payload layer to compose, e.g. "/Chair". Empty (default) authors an empty target path, which USD resolves to that layer's defaultPrim. |
position |
string | no | List position (same vocabulary as add_usd_reference). Default "BackOfPrependList". |
Returns: { stage_name: string, prim_path: string, asset_path: string, prim_path_for_target: string, uses_default_prim: bool, added: bool, has_arcs: bool, position: string, errors: [string]? }
add_usd_reference¶
Additive
Add an external reference arc to a prim of a registered USD stage, so prim_path composes the prim prim_path_for_target of the layer file at asset_path, or that layer's defaultPrim when prim_path_for_target is empty (uses_default_prim). For a prim of the same stage use add_usd_internal_reference, for a load-on-demand arc add_usd_payload; clear_usd_references is the inverse, and get_usd_prim_info or list_usd_prims shows the composed result. The arc is authored on the stage's current edit target layer (set_usd_edit_target; list_usd_stage_layers shows the stack) and stays in memory until save_usd_stage. No undo step. The call fails when USD rejects the arc (added=false, its messages in errors) or the prim then lists no authored references (has_arcs=false); an unregistered stage_name or a prim that does not exist is an error (success=false) and nothing is authored.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage or create_usd_stage (list_usd_stages shows it), e.g. "Shot010". |
prim_path |
string | yes | Absolute SdfPath of the existing prim that receives the reference, e.g. "/World/Chair"; define_usd_prim creates one. |
asset_path |
string | yes | Identifier of the layer to reference: an absolute file path such as "C:/Assets/chair.usda", or a path relative to the layer being edited such as "./chair.usda". |
prim_path_for_target |
string | no | Absolute path of the prim inside the referenced layer to compose, e.g. "/Chair". Empty (default) authors an empty target path, which USD resolves to the referenced layer's defaultPrim; a layer without one composes nothing there. |
position |
string | no | "FrontOfPrependList" | "BackOfPrependList" | "FrontOfAppendList" | "BackOfAppendList", case-insensitive; prepended arcs are stronger than appended ones. Default BackOfPrependList, which is also what any other string means (the reply then echoes the string sent). |
Returns: { stage_name: string, prim_path: string, asset_path: string, prim_path_for_target: string, uses_default_prim: bool, added: bool, has_arcs: bool, position: string, errors: [string]? }
add_usd_variant¶
Additive Idempotent
Add a new variant to an existing variant set at the requested list position; idempotent (returns already_existed:true when the variant is already present). Inverse: remove_usd_variant. added is the set re-read (HasAuthoredVariant); false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | SdfPath of the prim that authors the variant set |
variant_set_name |
string | yes | Variant set that will receive the new variant |
variant_name |
string | yes | Name of the variant to add |
stage_name |
string | no | Stage cache key |
position |
string | no | One of FrontOfPrependList / BackOfPrependList / FrontOfAppendList / BackOfAppendList (default BackOfPrependList) |
Returns: { prim_path: string, variant_set_name: string, variant_name: string, added: bool, already_existed: bool, position: string }
add_usd_variant_set¶
Additive Idempotent
Author a new (empty) variant set on a prim at the requested list position; idempotent (returns already_existed:true when the set is already present). Inverse: remove_usd_variant_set. created is the prim re-read (HasVariantSet); false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | SdfPath of the prim that will author the variant set |
variant_set_name |
string | yes | Name of the variant set to create |
stage_name |
string | no | Stage cache key |
position |
string | no | One of FrontOfPrependList / BackOfPrependList / FrontOfAppendList / BackOfAppendList (default BackOfPrependList, matching the USD wrapper default) |
Returns: { prim_path: string, variant_set_name: string, created: bool, already_existed: bool, position: string }
apply_usd_prim_schema¶
Destructive
Apply a USD API schema (e.g. "MaterialBindingAPI") to an existing prim of a registered USD stage, on the current edit target. Checks CanApplyAPI first: a schema that cannot apply returns applied=false with the USD reason in why_not instead of an error. Not saved to disk. When ApplyAPI fails, or the prim does not then report the schema (HasAPI), applied=false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of an existing prim, e.g. "/World/Cube". |
schema_name |
string | yes | Schema identifier (not the C++ class name), e.g. "MaterialBindingAPI", "GeomModelAPI" |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
Returns: { applied: bool, schema_name: string, why_not?: string }
clear_usd_attribute¶
Destructive Idempotent
Clear authored values of a USD attribute on a prim of an open stage: with time, only the sample at that time code; without it, the default value and every time sample. Edits the stage in memory; save_usd_stage writes it. Returns present and cleared, present false when the attribute is missing.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage (default the file basename) or create_usd_stage (default "Untitled"). |
prim_path |
string | yes | Absolute SdfPath of an existing prim on that stage, e.g. "/World/Cube". |
attr_name |
string | yes | Name of the attribute to clear, e.g. "size". |
time |
number | no | Time code of the single sample to clear (ClearAtTime); omit it to clear the default value and all samples (Clear). |
Returns: { prim_path: string, attr_name: string, cleared: bool, present: bool, time: number? }
clear_usd_payloads¶
Destructive Idempotent
Remove the payload arcs of a prim: every payload (UsdPayloads::ClearPayloads), or with asset_path the one payload to that layer and target prim (RemovePayload). Inverse of add_usd_payload, which clear_usd_references does not touch; the edit lands on the stage's current edit target layer, as the add did. Irreversible, like every USD composition edit here (no undo). had_payloads and has_payloads are the prim read before and after (UsdPrim::HasAuthoredPayloads). A stage or prim that does not resolve is an error; a prim with no payload is an honest no-op (cleared=false). Save the layer with save_usd_stage. A prim that had payloads and that the edit did not clear fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under. |
prim_path |
string | yes | Prim whose payloads should be removed. |
asset_path |
string | no | Optional identifier of the payload's layer: only the payload to that layer (and prim_path_for_target) goes. |
prim_path_for_target |
string | no | With asset_path, the prim inside that layer the payload targets, as given to add_usd_payload. Empty (default) means the default-prim payload add_usd_payload authors when it is given none. |
Returns: { stage_name: string, prim_path: string, asset_path?: string, had_payloads: bool, cleared: bool, has_payloads: bool, errors: [string]? }
clear_usd_references¶
Destructive Idempotent
Remove every reference arc of a prim of a registered USD stage, external and internal alike (UsdReferences::ClearReferences); payloads stay (clear_usd_payloads removes those). The inverse of add_usd_reference and add_usd_internal_reference; no tool removes a single reference. Only the edits on the stage's current edit target layer go, so references authored on other layers still compose (switch layers with set_usd_edit_target; list_usd_stage_layers shows the stack); check the result with get_usd_prim_info. Irreversible: no undo step. The change stays in memory until save_usd_stage. A repeat call leaves the list empty again. An unregistered stage_name or a prim that does not exist is an error (success=false); USD complaints come back in errors. cleared=false fails the call; has_references is the prim re-read, true while another layer still authors references.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage or create_usd_stage (list_usd_stages shows it), e.g. "Shot010". |
prim_path |
string | yes | Absolute SdfPath of the existing prim whose references are cleared, e.g. "/World/Chair"; list_usd_prims lists prim paths. |
Returns: { stage_name: string, prim_path: string, cleared: bool, has_references: bool, errors: [string]? }
clear_usd_variant_selection¶
Destructive Idempotent
Clear the selected variant of one variant set on a prim of a cached USD stage, so no variant of that set is selected there; the set and its variants stay. It first moves the stage's edit target to the strongest layer that defines the prim and clears the selection on that layer, so a selection authored on another layer can still apply: check with list_usd_variant_sets. The edit stays in memory until save_usd_stage and has no undo step. A repeat call changes nothing more; cleared is the engine's answer, and false fails the call; selection is the composed selection re-read. An unknown stage, an invalid or missing prim, or a variant set the prim does not have is an error and nothing is written. To pick another variant instead use set_usd_variant_selection; to delete the set itself, remove_usd_variant_set.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of the existing prim that has the variant set, e.g. "/World/Car" |
variant_set_name |
string | yes | Variant set whose selection is cleared, as list_usd_variant_sets reports it, e.g. "color" |
stage_name |
string | no | Name the stage was registered under by open_usd_stage or create_usd_stage (list_usd_stages shows it), or the end of a cached stage's root layer identifier, case-insensitive, e.g. "Shot010" |
Returns: { prim_path: string, variant_set_name: string, cleared: bool, selection: string }
close_usd_stage¶
Destructive Idempotent
Close a USD stage by its LLM-facing stage_name. Removes the stage from the LLM-facing UEAgent::UsdRegistry::GStageNameCache AND calls UnrealUSDWrapper::EraseStageFromCache on it — this is the ONLY way to release a memory stage (memory stages are never closed automatically, even on editor shutdown). If stage_name is not in the cache the call returns success with a note rather than an error (idempotent — closing an already-closed stage is a no-op). The 'removed_from_cache' field reports whether the stage was actually present in the UnrealUSDWrapper stage cache at close time.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under via open_usd_stage or create_usd_stage. |
Returns: { stage_name: string, closed: bool, was_in_cache: bool, removed_from_cache: bool, note: string? }
create_usd_attribute¶
Additive
Create an attribute of a given USD type on a prim of an open stage, or return the existing one with created false. Edits the stage in memory; save_usd_stage writes it. Returns name, type_name, cpp_type and created; author its value with set_usd_attribute_value. present is the prim re-read; false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage (default the file basename) or create_usd_stage (default "Untitled"). |
prim_path |
string | yes | Absolute SdfPath of an existing prim on that stage, e.g. "/World/Cube". |
attr_name |
string | yes | Attribute name (e.g. "size", "displayColor") |
type_name |
string | yes | USD type name (e.g. "float", "float3", "token", "asset") |
Returns: { prim_path: string, name: string, type_name: string, cpp_type: string, created: bool, present: bool }
create_usd_stage¶
Additive
Create a new USD stage (either on-disk or in-memory). When file_path is provided, UnrealUSDWrapper::NewStage(FilePath) creates a root layer file at that path and opens it as a stage. When file_path is omitted or empty, NewStage() (no args) creates a memory-only stage — this is the only way to author a USD stage that is NOT persisted to disk; the only way to clean it up is close_usd_stage. The new stage is always added to the LLM-facing UEAgent::UsdRegistry::GStageNameCache under stage_name (default "Untitled"), so subsequent calls can refer to it by name. The returned identifier is the root layer's USD identifier (real path for on-disk; an anonymous "anon:0x..." handle for memory stages). registered says stage_name now resolves to the stage; false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path |
string | no | Absolute path for the new USD root layer file (.usd/.usda/.usdc/.usdz). Omit or empty for a memory-only stage (optional). |
stage_name |
string | no | LLM-facing name to register the new stage under (optional, default "Untitled"). |
Returns: { stage_name: string, file_path: string, memory: bool, identifier: string, real_path: string, dirty: bool, is_valid: bool, registered: bool, errors: [string]? }
create_usd_stage_actor¶
Destructive
Spawn an AUsdStageActor, the actor that displays a USD file live in the level, into the editor world (not a PIE world), or return the one already there: the tool keeps one stage actor per world, so when any exists it changes nothing and returns already_existed true with that actor's actor_path, whatever name you pass. The level is not saved (save_level). The new actor shows nothing until set_usd_stage_actor_root_layer gives it a USD file; then inspect it with get_usd_stage_actor_info, get_usd_generated_component and get_usd_generated_assets. To author a USD file without an actor use create_usd_stage or open_usd_stage instead; remove the actor with delete_actor. A new actor gets scale [1, 1, 1]; scale is the actor's scale read back after the call (change it with set_actor_transform). No editor world is an error (the editor must be running with a level open). A spawned actor the USD stage module does not then find in the world fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | no | Object name for a new actor, e.g. "UsdStageActor" (the default); a numeric suffix is added when taken, so read the real name from the reply. Ignored when a stage actor already exists. |
location |
array | no | World [x, y, z] location in cm for a new actor, e.g. [0, 0, 100] (default [0, 0, 0]); missing trailing numbers stay 0. |
rotation |
array | no | World [pitch, yaw, roll] in degrees for a new actor, e.g. [0, 90, 0] (default [0, 0, 0]). |
Returns: { actor_path: string, already_existed: bool, name: string, scale: [x, y, z] }
define_usd_prim¶
Destructive
Define a prim (specifier def) of type_name at prim_path on a registered USD stage, at its current edit target, defining missing ancestors as typeless prims. On an existing prim of another type it replaces the type, so leaving type_name out retypes it to Xform. The requested specifier is then authored at the edit target (specifier_set_ok); specifier reports it only when that write succeeded, and a failed write fails the call. An unknown specifier is refused before anything is authored. In memory only: save_usd_stage writes it. override_usd_prim authors an over instead; set_usd_prim_metadata with key "typeName" changes only the type.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath, e.g. /World/Cube |
stage_name |
string | no | Name the stage was registered under |
type_name |
string | no | USD type name (Xform, Mesh, Cube, Scope, Camera, DistantLight...). Default: Xform |
specifier |
string | no | "Def" | "Over" | "Class", case-insensitive; anything else is refused. Default: Def |
Returns: { prim_path: string, type_name: string, specifier?: string, is_valid: bool, specifier_set_ok: bool, requested?: object }
flatten_usd_stage¶
Destructive
Export a flattened copy of the stage to a .usd/.usda/.usdc/.usdz file (the file writer is chosen by the extension). Wraps UE::FUsdStage::Export(OutputPath, bAddSourceFileComment, FileFormatArguments) — does NOT alter the in-memory stage. When add_source_file_comment is true (default) the flattened file includes a comment header noting the source file (useful for provenance). The returned 'exported' field reports pxr::'s bool return — false means the file writer could not write the requested path (e.g. invalid extension, permission denied). The call fails when exported is false or no file exists at output_path afterwards (file_exists). Realistic gotcha: stage.Export() requires the stage NOT be in a restricted-edit state — under headless cov this is not an issue, but in-editor it can be during PIE.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under, OR an absolute file path to auto-open. |
output_path |
string | yes | Absolute path of the flattened file to write. The file extension picks the writer (.usda=text, .usdc=binary, .usdz=archive). |
add_source_file_comment |
boolean | no | Include the source-file comment header in the flattened file (default true). |
Returns: { stage_name: string, resolution: string, output_path: string, exported: bool, file_exists: bool, add_source_file_comment: bool, errors: [string]? }
get_usd_attribute_time_samples¶
Read-only
List the time codes, in ascending order, at which one attribute of a prim on a USD stage this server has open has authored time samples; the values themselves are not returned (read one with get_usd_attribute_value at that time). Read-only: the stage is not changed. Returns time_samples, count and present; an attribute the prim does not have is not an error but present false with an empty list, while a stage that is not open or a missing prim is an error. Use list_usd_prim_attributes first to see which attributes have samples (time_sample_count); set_usd_attribute_value writes a sample and clear_usd_attribute removes one.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage (default the file basename) or create_usd_stage (default "Untitled"). |
prim_path |
string | yes | Absolute SdfPath of an existing prim on that stage, e.g. "/World/Cube", as list_usd_prims returns it. |
attr_name |
string | yes | Full attribute name including any namespace, as list_usd_prim_attributes returns it, e.g. "xformOp:translate". |
Returns: { prim_path: string, attr_name: string, time_samples: [number], count: int }
get_usd_attribute_value¶
Read-only
Read the composed value of one attribute on a prim of a registered USD stage, at the time code in time, else at the default time (the static default, not a sample), possibly a schema fallback (has_value true, has_authored_value false). value is {type, value}: a scalar as a boolean, number or string; a pathExpression as its text; a vector, color or point as an array of numbers; a quaternion as [x, y, z, w], real part last; a matrix as an array of rows; an array attribute as a JSON array of those plus length and truncated, cut at 600 numbers or strings (fewer long strings). Another type, or no value, gives null with a note. A missing attribute is present=false; a missing stage or prim is an error. Read-only. Every attribute: list_usd_prim_attributes; sampled times: get_usd_attribute_time_samples; author a value: set_usd_attribute_value.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage (default the file basename) or create_usd_stage (default "Untitled"). |
prim_path |
string | yes | Absolute SdfPath of an existing prim on that stage, e.g. "/World/Cube". |
attr_name |
string | yes | Attribute name to read, e.g. "size" |
time |
number | no | Optional USD time code to read at, e.g. 24; when omitted the default time is read (the static default value, not a sample) |
Returns: { prim_path: string, attr_name: string, present: bool, has_value?: bool, has_authored_value?: bool, type?: string, type_name?: string, time?: number, value?: { type: string, value: any, length?: number, truncated?: bool, note?: string } | null, note?: string }
get_usd_generated_assets¶
Read-only
Resolve the transient assets (UStaticMesh, USkeletalMesh, UMaterial, etc.) generated by the stage actor for a given prim path. Wraps AUsdStageActor::GetGeneratedAssets(prim_path). Returns an empty assets array (count:0) when the prim has no generated assets — NOT an error. A prim may produce multiple assets (e.g. a skinned mesh produces USkeletalMesh + USkeleton + UPhysicsAsset).
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_path |
string | yes | Full actor path (or short name) of the AUsdStageActor. |
prim_path |
string | yes | Full prim path, e.g. "/root_prim/my_mesh". |
Returns: { actor_path: string, prim_path: string, assets: [string], count: int }
get_usd_generated_component¶
Read-only
Find the scene component an AUsdStageActor generated in the level for one prim of its open USD stage (AUsdStageActor::GetGeneratedComponent), without changing anything: its component_path and component_class when present. Use it to reach the Unreal component behind a prim, for example to read its transform with the component tools; for the meshes, materials and other assets a prim produced use get_usd_generated_assets; for the actor's stage and load state get_usd_stage_actor_info. The components are transient: they exist only while the stage is loaded (set_usd_stage_actor_root_layer with OpenedAndLoaded) and are rebuilt when it reloads. present false is not an error: the prim path does not exist, has no component of its own (it was collapsed into a parent prim, so query the parent), or the stage is not loaded. An actor_path that matches no stage actor in the editor world, or a missing prim_path, is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_path |
string | yes | The stage actor: its full path as create_usd_stage_actor returns it (actor_path), or its object name or editor label, e.g. "UsdStageActor". |
prim_path |
string | yes | Absolute USD prim path in the actor's stage, starting with "/", e.g. "/Root/Geom/Chair". |
Returns: { actor_path: string, prim_path: string, present: bool, component_path?: string, component_class?: string }
get_usd_prim_info¶
Read-only
Read one prim of a registered USD stage: name, type_name, active, parent_path, direct children_count, applied_schemas, variant_sets and an is_a map for nine common types (Xform, Mesh, Cube, Scope, Camera, four lights). A missing prim returns is_valid=false with a note, not an error. Read-only.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of the prim to read, e.g. "/World/Cube". |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
Returns: { name: string, prim_path: string, type_name: string, active: bool, is_valid: bool, is_pseudo_root: bool, parent_path: string, children_count: number, applied_schemas: [string], variant_sets: [string], is_a: { Xform, Mesh, Cube, Scope, Camera, DistantLight, SphereLight, RectLight, MeshLight: bool } }, or { prim_path, is_valid: false, note } when the prim does not exist
get_usd_prim_metadata¶
Read-only
Read the metadata of a prim on a registered USD stage as USD resolves it: one key (present plus value as {type, value}) or, with no key, all entries (authored and fallback) plus count; composition arcs such as references are read by key only, as their strongest opinion. Values read as get_usd_attribute_value reads them, an Sdf enum such as specifier as its number; a dictionary (customData, with the schema's fallback entries) as an object of {type, value} entries; a list op as {explicit} or {prepended, appended, deleted, ordered?, added?} arrays of item texts (numbers for an integer list op), apiSchemas, inactiveIds and other non-arc list ops composed into one explicit list; both with length and truncated. One reply holds about 30000 characters of values: past that, values are cut and further entries listed in omitted_keys. Above 100 entries only count and a note return. Read-only. Author with set_usd_prim_metadata; prim summary: get_usd_prim_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of an existing prim, e.g. "/World/Cube". |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
key |
string | no | Metadata field to read, e.g. "documentation"; empty or omitted (default) returns all entries. |
Returns: { present: bool, key: string, value: { type: string, value: any, length?: number, truncated?: bool, note?: string }, metadata: object, count: number, truncated?: bool, omitted_keys?: [string], note?: string }
get_usd_stage_actor_info¶
Read-only
Reads the live state of a USD stage actor (AUsdStageActor) in the editor world: the root layer identifier and file path of the stage it displays (the isolated stage while isolate_usd_layer is active), its load state (stage_state 0 = Closed, 1 = Opened, 2 = OpenedAndLoaded, with its name), whether it has generated a Level Sequence for animated prims, how many scene components the stage generated under it, and whether a layer is isolated. Read-only: changes, loads and saves nothing; with no stage open, root_layer and real_path are empty. An actor_path that matches no stage actor is an error. Use it after create_usd_stage_actor and set_usd_stage_actor_root_layer to check the stage loaded; for one prim's component or assets use get_usd_generated_component or get_usd_generated_assets. Stages opened by the stage tools, not by an actor, are read with get_usd_stage_info and list_usd_stages.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_path |
string | yes | The stage actor: its full path as create_usd_stage_actor returns it (actor_path), or its object name or editor label, e.g. "UsdStageActor". |
Returns: { actor_path: string, root_layer: string, real_path: string, stage_state: int, stage_state_name: string, has_level_sequence: bool, generated_component_count: int, has_isolated_stage: bool } -- actor_path is the resolved full path; generated_component_count counts the scene components the loaded stage generated, not the actor's own root (0 with no stage loaded)
get_usd_stage_info¶
Read-only
Read metadata about a USD stage: root layer identifier, real path, dirty flag, timecode range (start/end), frames-per-second, total prim count (recursive) and layer-stack depth (includes session layers when include_session_layers is true). Resolves stage_name via the LLM-facing UEAgent::UsdRegistry::GStageNameCache first, then falls back to treating stage_name as a file path and auto-opening it (LoadAll, use cache). Returns 'resolution' as one of "cache_hit" / "auto_opened" so the caller knows which path served the stage.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under, OR an absolute file path to auto-open. |
include_session_layers |
boolean | no | Include session layers when computing the layer-stack depth (default true). |
Returns: { stage_name: string, resolution: string, identifier: string, real_path: string, dirty: bool, start_time: number, end_time: number, frames_per_second: number, prim_count: int, layer_stack_count: int, has_start_time: bool, has_end_time: bool, has_fps: bool, errors: [string]? }
insert_usd_sublayer¶
Additive Idempotent
Add a sublayer path to the root layer of a registered USD stage, so that layer's opinions compose into the stage, then save the root layer to disk (Save without force: the whole root layer, including any other unsaved edits on it). Read the stack and its indices with list_usd_stage_layers, take a sublayer out by index with remove_usd_sublayer, and to author into the new layer point set_usd_edit_target at it. The path is not checked to exist; USD complaints come back in errors. No undo step. inserted is read back from the root layer's list. A path already in the list is a success that changes nothing (already_present=true, saved=false). On an in-memory stage (anonymous root layer, in_memory=true) the insert is a success with saved=false, since there is no file to save to. On a file-backed stage success requires the save: a failed save answers success=false with saved=false. Idempotent in effect: a repeat adds nothing. An unregistered stage_name is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Exact name the stage was registered under by create_usd_stage or open_usd_stage (a stage only in the USD cache is not found here). |
sublayer_path |
string | yes | Path or USD identifier of the layer to insert, e.g. "D:/USD/props.usda" or "./props.usda" (resolved relative to the root layer); compared with the existing entries as text, case ignored. |
index |
integer | no | 0-based position in the root layer's sublayer list, where 0 is the strongest; -1 (default) appends as the weakest. The reply's index echoes this value, not the resulting position. |
Returns: { stage_name: string, sublayer_path: string, index: int, inserted: bool, already_present: bool, in_memory: bool, new_count: int, saved: bool, note?: string, errors: [string]? }
isolate_usd_layer¶
Destructive
Enter isolated mode by replacing the actor's displayed stage with a new stage rooted at one of the sublayers of the current layer stack. Wraps AUsdStageActor::IsolateLayer(Layer, b_load_usd_stage). The layer_index selects into Stage.GetLayerStack(true) — index 0 is the root layer, >0 are sublayers. When b_load_usd_stage is true (default) assets, actors and components are regenerated from the isolated stage; when false the isolation is structural only. isolated_root_layer is the actor re-read: it must be the isolated layer, or empty when that layer is the base stage's root (which leaves isolated mode); otherwise the call fails.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_path |
string | yes | Full actor path (or short name) of the AUsdStageActor. |
layer_index |
integer | no | Index into the actor's stage layer stack (default 0 = root layer). |
b_load_usd_stage |
boolean | no | Load assets/components from the isolated stage (default true). |
Returns: { actor_path: string, layer_index: int, isolated_layer: string, isolated_root_layer: string, b_load_usd_stage: bool, errors: [string]? }
list_usd_file_formats¶
Read-only
List the USD file format extensions the engine supports, with optional human-readable descriptions -- also the probe of whether the USDCore plugin loaded: native_present / supported_present false (a zero count) means it did not. Always returns the native set ("usd"/"usda"/"usdc"/"usdz", UnrealUSDWrapper::GetNativeFileFormats) and the full supported set (native + third-party USD plugin extensions like "abc" from usdAbc, GetAllSupportedFileFormats). When include_descriptions is true, also calls AddUsdImportFileFormatDescriptions to populate the human-readable per-extension description strings (e.g. "usdc; Universal Scene Description binary files").
| Parameter | Type | Required | Description |
|---|---|---|---|
include_descriptions |
boolean | no | Also return the per-extension import description strings from UnrealUSDWrapper::AddUsdImportFileFormatDescriptions (optional, default false). |
Returns: { native_formats: [string], supported_formats: [string], native_count: int, supported_count: int, native_present: bool, supported_present: bool, descriptions: [{format: string, description: string}]? }
list_usd_prim_attributes¶
Read-only
List every attribute of one prim on a USD stage this server has open, with each one's name, USD type, C++ type, whether it has a value (fallback values count) or an authored opinion, and how many time samples it has. Read-only: the stage is not changed. Use it to find an attribute name; then read one value with get_usd_attribute_value, its sample times with get_usd_attribute_time_samples, or write it with set_usd_attribute_value. For the prim's own type, specifier and schemas use get_usd_prim_info; to find prim paths use list_usd_prims. A stage that is not open (open_usd_stage or create_usd_stage first) or a prim that does not exist is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage (default the file basename) or create_usd_stage (default "Untitled"). |
prim_path |
string | yes | Absolute SdfPath of an existing prim on that stage, e.g. "/World/Cube", as list_usd_prims returns it. |
offset |
integer | no | Index of the first entry returned, counted from 0 (default 0). Read the next page at the reply's next_offset. |
limit |
integer | no | Most entries returned per call, 1..1000 (default 100). |
Returns: { prim_path: string, attributes: [{name, type_name, cpp_type, has_value, has_authored_value, time_sample_count}], count: int (entries in this page), total: int, offset: int, limit: int, returned: int, truncated: bool, next_offset: int|null }
list_usd_prims¶
Read-only
List the prims under one prim (default the pseudo root "/") of a registered USD stage without changing anything, each with prim_path and type_name, plus count: its direct children, or with recursive=true its whole subtree in depth-first order (each parent before its children, siblings in stage order). Only active, loaded, defined, non-abstract prims appear (so active is always true here), and instance proxies are not traversed: a deactivated prim, an over-only prim or a Class prim needs get_usd_prim_info by path. Use it to discover prim paths before get_usd_prim_info (one prim's schemas and variant sets), list_usd_prim_attributes or the authoring tools; list_usd_stages shows which stages are open and get_usd_stage_info the total prim count. An unregistered stage_name, a malformed prim_path_prefix or a prim that does not exist is an error; a prim without children is a success with count 0.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
prim_path_prefix |
string | no | Absolute SdfPath of the prim whose children are listed, e.g. "/World"; it must exist (it is a parent path, not a text prefix). Default "/" (the pseudo root). |
recursive |
boolean | no | false (default) lists the direct children only; true lists every descendant, each parent before its children. |
offset |
integer | no | Index of the first prim returned, in the order above, counted from 0 (default 0). Read the next page at the reply's next_offset. |
limit |
integer | no | Most entries returned per call, 1..1000 (default 100). |
Returns: { prims: [{ prim_path, type_name, active }], count: number (entries in this page), total: int, offset: int, limit: int, returned: int, truncated: bool, next_offset: int|null }
list_usd_stage_layers¶
Read-only
List the layer stack of a USD stage opened with open_usd_stage or create_usd_stage, read-only: each layer's index, identifier, real_path, is_root, is_session, is_edit_target, is_muted, dirty and sublayer paths, plus root_layer_index, session_layer_count, edit_target_index, count and any captured USD errors; with layer_index only that layer. The indices are the ones set_usd_edit_target takes: the full stack, the stage's session layer and its sublayers first (every stage these tools open or create has an anonymous session layer), then the root layer and its sublayers, so the root is usually index 1. An unregistered stage_name, a layer_index outside the stack or an invalid layer at it is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under via open_usd_stage or create_usd_stage. |
include_session_layers |
boolean | no | When true (default) the session layers are listed too; false leaves them out of layers without renumbering the rest, so the root keeps its index. layer_index ignores it. |
layer_index |
integer | no | Optional 0-based index into the full stack, as set_usd_edit_target counts it (root_layer_index gives the root); report only that layer |
Returns: { stage_name: string, include_session_layers: bool, root_layer_index: int, session_layer_count: int, edit_target_index: int (-1 when the edit target is outside the stack), count: int, layers: [{ index: int, identifier: string, real_path: string, is_root: bool, is_session: bool, is_edit_target: bool, is_muted: bool, dirty: bool, sub_layer_paths: [string], sub_layer_count: int }], layer_index?: int, errors: [string]? }
list_usd_stages¶
Read-only
Enumerate every stage currently in the UnrealUSDWrapper stage cache (shared across C++ + Python). Returns one entry per cached stage with the root layer identifier, real path and dirty flag. It reads the engine's stage cache directly, so it also lists the stages opened outside these tools (Python USD scripts, the editor's USD importer). Each entry's 'stage_name' is the name the stage was opened under through these tools; it is empty for a stage they did not open.
No parameters.
Returns: { stages: [{stage_name: string, identifier: string, real_path: string, dirty: bool}], count: int }
list_usd_variant_sets¶
Read-only
List the variant sets a prim of a cached USD stage has, without changing anything: their names, each set's variant names (variants) and the selected variant of each set that has one (selections, empty when none is authored). With variant_set_name only that set is reported, also as variant_set_name, current_selection (empty when none) and variant_count, and a set the prim does not have is an error. Use it before set_usd_variant_selection or clear_usd_variant_selection, which take these names; author sets and variants with add_usd_variant_set and add_usd_variant, delete them with remove_usd_variant_set and remove_usd_variant. An unknown stage, an invalid prim path or a prim that does not exist is an error; open a stage first with open_usd_stage.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of the existing prim to inspect, e.g. "/World/Car" |
stage_name |
string | no | Name the stage was registered under by open_usd_stage or create_usd_stage (list_usd_stages shows it), or the end of a cached stage's root layer identifier, case-insensitive, e.g. "Shot010" |
variant_set_name |
string | no | Optional name of the one variant set to report, e.g. "color"; omitted or empty reports every set |
Returns: { prim_path: string, names: [string], selections: object, variants: object (set name -> [variant name]), count: int, variant_set_name?: string, current_selection?: string, variant_count?: int }
mute_usd_layer¶
Destructive
Mute and unmute layers of a registered USD stage in one atomic call (UsdStage::MuteAndUnmuteLayers): a muted layer's opinions drop out of composition until it is unmuted. Muting is stage state held in memory: no layer file changes and save_usd_stage does not record it. Read layer identifiers, and confirm is_muted afterwards, with list_usd_stage_layers; to send edits to a layer use set_usd_edit_target instead, and to show one layer alone on a stage actor isolate_usd_layer. muted and unmuted echo the identifiers sent; mismatched lists the ones the stage does not read in the requested state (IsLayerMuted), and any fails the call. Muting a layer already muted changes nothing, so a repeat call is harmless. An unregistered stage_name is an error (success=false); USD complaints come back in errors. No undo step.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage or create_usd_stage (list_usd_stages shows it), e.g. "Shot010". |
mute_paths |
array | no | Layer identifiers to mute, as list_usd_stage_layers reports them, e.g. ["C:/Shots/lighting.usda"]; non-string or empty entries are skipped. Empty/missing is allowed (no-op on the mute side). |
unmute_paths |
array | no | Layer identifiers to unmute, same form as mute_paths. Empty/missing is allowed (no-op on the unmute side). |
Returns: { stage_name: string, muted: [string], unmuted: [string], mismatched: [string], errors: [string]? }
open_usd_stage¶
Destructive
Open an existing USD stage from a file path. Wraps UnrealUSDWrapper::OpenStage with caching and force-reload controls. When use_stage_cache is true (default) and the file is already open in the UnrealUSDWrapper stage cache, the existing stage is returned. When force_reload is true, all local layers are forced-reloaded from disk (useful when the file was modified by another tool since the last open). The opened stage is added to the LLM-facing UEAgent::UsdRegistry::GStageNameCache under either the explicit stage_name or a derived one (basename without extension). The stage_id returned is the root layer's USD identifier — a stable string handle useful as a unique reference across follow-up commands. registered says stage_name now resolves to the stage; false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path |
string | yes | Absolute path to the .usd/.usda/.usdc/.usdz file (or a USD layer identifier). |
stage_name |
string | no | LLM-facing name to register the opened stage under. Defaults to the file basename without extension (optional). |
initial_load_set |
string | no | "LoadAll" (default; loads payloads) or "LoadNone" (faster; inspect without loading payloads). |
use_stage_cache |
boolean | no | Use UnrealUSDWrapper's stage cache (default true). When false the stage is re-read and not added to the cache. |
force_reload |
boolean | no | Force-reload all local layers from disk, bypassing the layer registry (default false). |
Returns: { stage_name: string, stage_id: string, identifier: string, real_path: string, from_cache: bool, file_path: string, registered: bool, errors: [string]? }
override_usd_prim¶
Additive Idempotent
Author an over (specifier over, no type) at prim_path on a registered USD stage, at its current edit target, with overs for missing ancestors, to add opinions to a prim without defining it. A prim that already exists there is returned untouched (already_existed true, no specifier reported, since nothing was authored); specifier Over comes back only for an over this call authored. is_valid or present (the prim re-read afterwards) false means USD refused, and the call fails; a missing stage or a bad path is an error. In memory only: save_usd_stage writes it. define_usd_prim creates a typed def; set_usd_prim_specifier changes the specifier of an existing prim.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath to author the over at, e.g. "/World/Cube" |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
Returns: { prim_path: string, is_valid: bool, already_existed: bool, specifier?: string, present: bool }
remove_usd_attribute¶
Destructive Idempotent
Remove one attribute from a prim on a registered USD stage by deleting its scene description in the current edit target layer only, so opinions from other layers or references can keep it composed. Idempotent: an absent attribute gives present=false and removed=false, not an error, and a relationship of that name counts as absent. A stage not registered under stage_name or a missing prim is an error. In memory only: save_usd_stage writes it. To keep the attribute and drop its values use clear_usd_attribute. A present attribute that RemoveProperty does not remove fails the call; still_composed says whether another layer keeps it.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage (default the file basename) or create_usd_stage (default "Untitled"). |
prim_path |
string | yes | Absolute SdfPath of an existing prim on that stage, e.g. "/World/Cube". |
attr_name |
string | yes | Name of the attribute to remove, e.g. "size" |
Returns: { prim_path: string, attr_name: string, removed: bool, present: bool, still_composed: bool }
remove_usd_prim¶
Destructive
Remove a prim and its subtree from the current edit target layer of a registered USD stage, returning removed. A prim that was not there is a no-op (was_present false); one RemovePrim did not remove fails the call, and still_composed says whether opinions elsewhere keep it. Opinions in other layers or references can keep it composed; set_usd_prim_metadata with key "active" and value false is the reversible way to hide a prim. Not saved to disk.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of the prim to remove, e.g. "/World/Cube"; its descendants go with it. |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
Returns: { removed: bool, prim_path: string, was_present: bool, still_composed: bool }
remove_usd_prim_schema¶
Destructive
Remove an applied API schema (e.g. "MaterialBindingAPI") from an existing prim of a registered USD stage, on the current edit target. A schema the prim does not have returns removed=false and was_applied=false instead of an error. Not saved to disk; inverse of apply_usd_prim_schema. An applied schema the prim still reports afterwards (still_applied) fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of an existing prim, e.g. "/World/Cube". |
schema_name |
string | yes | Schema identifier as listed in applied_schemas by get_usd_prim_info, e.g. "MaterialBindingAPI". |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
Returns: { removed: bool, schema_name: string, was_applied: bool, still_applied: bool }
remove_usd_sublayer¶
Destructive
Remove a sublayer by index from the stage's root layer's composition stack.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under. |
sublayer_index |
integer | yes | 0-based index into GetSubLayerPaths() of the root layer. |
Returns: { stage_name: string, sublayer_index: int, removed: bool, new_count: int, errors: [string]? }
remove_usd_variant¶
Destructive
Delete one variant from a variant set of a prim of a cached USD stage: on every spec of the prim in the stage's local layer stack the variant spec goes (with the opinions authored inside it), and a selection of that variant is cleared. Inverse of add_usd_variant. Opinions on a layer outside the local stack (a reference or payload) are left as they are and counted in specs_skipped. A set the prim does not have is an error; a variant the set does not have is an honest no-op (removed=false). Irreversible, like every USD composition edit here (no undo); save with save_usd_stage. Read: list_usd_variant_sets; the whole set: remove_usd_variant_set.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | SdfPath of the prim that authors the variant set |
variant_set_name |
string | yes | Variant set that holds the variant |
variant_name |
string | yes | Name of the variant to delete |
stage_name |
string | no | Stage cache key |
Returns: { prim_path: string, variant_set_name: string, variant_name: string, removed: bool, specs_edited: int, specs_skipped: int, still_present: bool, variant_names: [string] }
remove_usd_variant_set¶
Destructive
Delete a variant set from a prim of a cached USD stage, as the variant set editor does: on every spec of the prim in the stage's local layer stack (root, sublayers, session layer) the variant set with all its variants goes, with its name in the variant set list and its selection. Inverse of add_usd_variant_set; clear_usd_variant_selection only clears the selection. Opinions authored on a layer outside the local stack (one brought in by a reference or payload) are left as they are and counted in specs_skipped, so the set can still show (still_present). A prim that does not author the set is an honest no-op (removed=false); a missing stage or prim is an error. Irreversible, like every USD composition edit here (no undo); save with save_usd_stage. Read: list_usd_variant_sets.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | SdfPath of the prim that authors the variant set |
variant_set_name |
string | yes | Name of the variant set to delete |
stage_name |
string | no | Stage cache key |
Returns: { prim_path: string, variant_set_name: string, removed: bool, specs_edited: int, specs_skipped: int, still_present: bool }
save_usd_stage¶
Destructive
Save a USD stage's file layers to disk: the root layer and every sublayer of its stack (UE::FSdfLayer::Save on each), each one only when it is dirty unless force is set. layers reports every layer with was_dirty, saved, dirty after and, for one left alone, skipped ("clean", or "anonymous" for an in-memory layer, which has no file); layers_saved counts the writes. Session layers are never saved (they are in-memory by design); a memory-only stage is exported with flatten_usd_stage instead. When nothing needs saving (every layer clean) nothing is written and the call succeeds with layers_saved 0, saved false and a note. saved is true when at least one layer was written and every dirty layer was; a dirty layer left unsaved -- its Save returned false, or it is anonymous, with no file to write -- fails the call with saved false and a save_error naming it. Use force=true to re-write clean file layers (rare — typically only when a downstream tool requires a specific mtime). list_usd_stage_layers shows which layers are dirty first.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under, OR an absolute file path to auto-open. |
force |
boolean | no | Re-save every file layer of the stack even when it is clean (default false: only dirty layers are written). |
Returns: { stage_name: string, resolution: string, saved: bool, layers_saved: int, layers: [{ identifier: string, real_path: string, is_root: bool, was_dirty: bool, saved: bool, dirty: bool, skipped?: string }], dirty: bool (the root layer after the save), force: bool, real_path: string (the root layer's), note?: string (nothing needed saving), save_error?: string (the dirty layers left unsaved), errors: [string]? }
set_usd_attribute_value¶
Destructive Idempotent
Author one attribute value on a prim of a registered USD stage, at the current edit target: a time sample at time, else the default; a missing attribute is created with type_name. The JSON value converts to the declared type: bool takes a boolean; integer types a whole number in range; half, float, double and timecode a number; string, token and asset a string; pathExpression the text of the expression; vectors, colors, points and texCoords an array of numbers; a quaternion [x, y, z, w]; a matrix an array of rows; an array type a JSON array of those. Another shape or range, a text that does not parse as a path expression (the error gives USD's parse message), opaque or group (valueless by design) or a new attribute without type_name fails, writing nothing. If USD refuses it, success is false and a created attribute is removed. In memory: save_usd_stage writes it; get_usd_attribute_value reads it back.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage (default the file basename) or create_usd_stage (default "Untitled"). |
prim_path |
string | yes | Absolute SdfPath of an existing prim on that stage, e.g. "/World/Cube". |
attr_name |
string | yes | Attribute name to set, e.g. "size" |
type_name |
string | no | USD type name of the attribute to create when it does not exist yet, e.g. "float" or "token"; required in that case, and ignored (with a note when it differs) for an existing attribute, whose declared type decides. |
value |
object | no | The value: a JSON scalar, e.g. 2.5, "inherited" or true, a JSON array, e.g. [1, 0.5, 0] for a color3f or [[0, 0, 1]] for a float3[], or an object {"value": <value>} whose "type" key, if any, is not used; it is converted to the declared type of the attribute. On UE 5.7 a pathExpression value cannot be written (needs UE 5.8); reading one works. |
time |
number | no | Optional USD time code to author a time sample at, e.g. 24; when omitted the default value is authored |
Returns: { prim_path: string, attr_name: string, set: bool, type_name: string, type: string, created: bool, time?: number, note?: string }
set_usd_edit_target¶
Destructive Idempotent
Choose the layer of a registered USD stage that later authoring writes to (its edit target): define_usd_prim, set_usd_attribute_value, add_usd_reference and the other USD edit tools then land on that layer. Without layer_index it targets the stage's root layer. Indices are the ones list_usd_stage_layers reports (its root_layer_index, is_root and is_session say which is which): the session layer and its sublayers come first, so the root is usually 1, and a session layer is in-memory only. edit_target is read back from the stage and the call fails if it is not the chosen layer. The choice is stage state held in memory, written to no file; save_usd_stage writes the root layer and its dirty sublayers but never a session layer, so edits aimed at a session layer are lost with the stage. Idempotent; no undo step. An unregistered stage_name, a layer_index that is not an integer or is outside the stack is an error (success=false) and the target stays as it was.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under by open_usd_stage or create_usd_stage (list_usd_stages shows it), e.g. "Shot010". |
layer_index |
integer | no | Optional 0-based index into the stage's full layer stack, as list_usd_stage_layers lists it: the session layer and its sublayers first, then the root layer and its sublayers. Omitted: the root layer (root_layer_index), usually 1. |
Returns: { stage_name: string, layer_index: int, layer_index_defaulted: bool, edit_target: string, edit_target_real_path: string, is_root: bool, is_session: bool, errors: [string]? } -- edit_target is read back from the stage
set_usd_prim_metadata¶
Destructive Idempotent
Author one metadata field (e.g. "comment", "kind", "customData", "apiSchemas", or the well-known "active" (bool; false deactivates the prim and its subtree, the reversible alternative to remove_usd_prim), "instanceable" (bool, USD native instancing), "displayName" (string UI label; the prim name does not change) and "typeName" (token, written as given, not checked against the schema registry)) on an existing prim of a registered USD stage, at the current edit target. The value is converted to the field's type, read from its resolved value or, for a standard field resolving to nothing (kind, comment, hidden, customData, apiSchemas, references...), the type Sdf registers: scalars, vectors, matrices and arrays as set_usd_attribute_value converts them; a dictionary from an object of entries; a list op from {explicit} or {prepended, appended, deleted, ordered, added} arrays of item texts, or of whole numbers for an integer list op such as inactiveIds. Any other field takes the type value names, else its JSON type. A value that does not fit writes nothing; if USD refuses the write, success is false with set=false and its errors. In memory: save_usd_stage writes it; get_usd_prim_metadata reads it back as USD resolves it.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of an existing prim, e.g. "/World/Cube". |
key |
string | yes | Registered USD prim metadata field, e.g. "comment", "kind", "customData" or "apiSchemas"; a key USD does not register as prim metadata fails with success false and set=false. |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
value |
object | no | The value itself (a scalar, an array, or an object of dictionary entries) or {type?, value}. It is converted to the field's type when that is known, and type is then not used; else type, or the JSON type, decides (bool, number as double, string, object as dictionary). A list op is {"explicit": [...]} or {"prepended": [...], "appended", "deleted", "ordered", "added"}, a reference item "@a.usda@</Prim>", an integer list op item a whole number. On UE 5.7 an integer list op (int, uint, int64 or uint64) cannot be written (needs UE 5.8); reading one works. |
Returns: { set: bool, prim_path: string, key: string, value: object, declared_type?: string, errors?: [string] }
set_usd_prim_specifier¶
Destructive Idempotent
Change the specifier of an existing prim on a registered USD stage to Def (a concrete prim), Over (opinions that define nothing on their own) or Class (an abstract template that does not render), authored on the stage's current edit target layer (pick it with set_usd_edit_target). Use it to convert a prim in place; to create one use define_usd_prim, and to add an over where nothing is defined yet override_usd_prim. The edit stays in memory until save_usd_stage, with no undo step. An unknown specifier, an unregistered stage_name or a prim that does not exist is an error and nothing is authored; a write USD refuses fails the call with set=false. specifier is reported only after a successful write (there is no getter to read it back); inspect the prim with get_usd_prim_info. Setting the same specifier again writes it again (idempotent). A prim made Class, or Over with no def on any layer, no longer appears in list_usd_prims, which lists defined, non-abstract prims only.
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of an existing prim, e.g. "/World/Cube", as list_usd_prims returns it. |
specifier |
string | yes | "Def", "Over" or "Class", case-insensitive; anything else is refused. |
stage_name |
string | no | Name the stage was registered under by create_usd_stage or open_usd_stage; a stage already in the USD cache also matches by the end of its root layer identifier. |
Returns: { set: bool, specifier?: string, requested?: object }
set_usd_stage_actor_root_layer¶
Destructive Idempotent
Assign a USD file as the actor's root layer and transition the stage state. Wraps AUsdStageActor::SetRootLayer(path) followed by AUsdStageActor::SetStageState(state). SetStageState(OpenedAndLoaded) triggers level-sequence regeneration — this can take a noticeable amount of time on large stages, so the cov harness may observe a transient 'rebuilding' state via follow-up get_usd_stage_actor_info calls. stage_state, root_layer, stage_open and stage_real_path are read back from the actor: the call fails when the state is not the one asked, or, for Opened and OpenedAndLoaded, when no stage opened or (for an absolute root_layer_path) its root layer is another file. When root_layer_path is empty, the existing root layer is preserved.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_path |
string | yes | Full actor path (or short name) of the AUsdStageActor. |
root_layer_path |
string | yes | Absolute file path of the USD file (.usd/.usda/.usdc/.usdz). |
stage_state |
string | no | "OpenedAndLoaded" (default), "Opened", or "Closed". |
Returns: { actor_path: string, root_layer_path: string, root_layer: string, stage_state: string, stage_open: bool, stage_real_path: string, errors: [string]? }
set_usd_stage_time_range¶
Destructive Idempotent
Set a USD stage's start/end time codes and optionally its frames-per-second, then save the root layer (idempotent — no-op when !dirty). Both start_time and end_time are required and are written via UE::FUsdStage::SetStartTimeCode / SetEndTimeCode (which write to the stage's root layer metadata). When frames_per_second > 0, also calls SetFramesPerSecond. The Save() at the end is force=false so a layer that wasn't actually mutated by the Set* calls will not produce an unnecessary write.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_name |
string | yes | Name the stage was registered under, OR an absolute file path to auto-open. |
start_time |
number | yes | New start time code (e.g. 0.0). |
end_time |
number | yes | New end time code (e.g. 24.0). |
frames_per_second |
number | no | Optional frames-per-second override; values <= 0 are ignored (use get_usd_stage_info / set_usd_stage_time_range to leave fps untouched). |
Returns: { stage_name: string, resolution: string, start_time: number, end_time: number, frames_per_second: number, applied: bool, saved: bool, dirty: bool, errors: [string]? }
set_usd_variant_selection¶
Destructive Idempotent
Select the active variant of one variant set on a prim of a cached USD stage, so the prim composes that variant's opinions; set is the engine's answer and selection the composed selection re-read: the call fails when set is false or a stronger layer's selection wins. Read the sets, their variants and current selections with list_usd_variant_sets first; create them with add_usd_variant_set and add_usd_variant; clear_usd_variant_selection removes the selection instead. The selection is authored on the stage's current edit target layer (set_usd_edit_target) and stays in memory until save_usd_stage; no undo step. Idempotent: selecting the selected variant again changes nothing. The variant name is not checked against the set's variants, so name one list_usd_variant_sets reports. An unknown stage, a prim that does not exist, or a variant set the prim does not author is an error, checked before anything is written (the guard also keeps the engine's variant-set handle from going invalid).
| Parameter | Type | Required | Description |
|---|---|---|---|
prim_path |
string | yes | Absolute SdfPath of the existing prim that authors the variant set, e.g. "/World/Car" |
variant_set_name |
string | yes | Variant set to select a variant from, as list_usd_variant_sets reports it, e.g. "color" |
variant_name |
string | yes | Variant to activate, e.g. "red" (must already be present — use add_usd_variant first) |
stage_name |
string | no | Name the stage was registered under by open_usd_stage or create_usd_stage (list_usd_stages shows it), or the end of a cached stage's root layer identifier, case-insensitive, e.g. "Shot010" |
Returns: { prim_path: string, variant_set_name: string, variant_name: string, set: bool, selection: string }