One Logo Pool Ball
USDKit · IOS API REFERENCE

USDStage

struct · iOS 27.0+ · SDK 27.1

struct USDStage

A 3D scene composed from one or more Universal Scene Description (USD) documents. Stages support authoring, animating, and composing 3D data from various 3D file formats. A stage can contain meshes, materials, cameras, lights, or arbitrary custom data, as well as references to textures or additional scene data stored in separate files. A stage is a scene graph formed by opening a single document (the "root layer") and then recursively following the composition rules described by that document in order to assemble a scene graph. Because of this composition process, a `USDStage` object presents a unified view that may incorporate data from more than one source file. A `USDStage` object is a mutable view onto the composed scene graph. It consists of a tree-structured hierarchy of ``USDPrim`` objects representing nodes in the scene graph. Each prim has schemas that give it a kind (is-a) and capabilities (has-a), attributes that contain possibly-animated values, and relationships that connect the prim to other objects in the stage. The ``USDPrim``, ``USDPrim.Attribute``, and ``USDPrim.Relationship`` objects in a stage are owned by the `USDStage` object. Values of these types act as views or handles into the composed content of the stage. Modifying any value in a stage authors a modification to an ``USDLayer`` that represents a file or file-like storage. Values of these types refer to and act on the current state of a particular stage, and become invalid if the stage is closed. > Note: A stage may also possess a "session layer" that may contain temporary modifications that will not be written to any file.

Members (45)

method · iOS 27.0+

definePrim

TypeScript
definePrim(path: USDLayer_Path, type: USDToken): USDPrim
Swift declaration
@discardableResult func definePrim(at path: USDLayer.Path, type: USDToken) -> USDPrim

Defines a prim at a given path, if none already exists. If a prim already exists at the given path, and that prim's type is empty or equal to `type`, this function returns that prim. Otherwise, the prim authored by this function will be an ``USDPrim/Specifier/def`` prim with the given type. - Parameters: - path: An absolute path in this stage. - type: The type name of the prim to define. > Note: This function will also author any missing parent prims along the given `path`. Prims authored this way will have an empty type.

get · iOS 27.0+

editTarget

TypeScript
get editTarget(): USDStage_EditTarget
Swift declaration
var editTarget: USDStage.EditTarget { get nonmutating set }

The destination for authoring operations on this stage.

set · iOS 27.0+

editTarget

TypeScript
set editTarget(value: USDStage_EditTarget)
Swift declaration
var editTarget: USDStage.EditTarget { get nonmutating set }

The destination for authoring operations on this stage.

get · iOS 27.0+

pseudoRoot

TypeScript
get pseudoRoot(): USDPrim
Swift declaration
var pseudoRoot: USDPrim { get }

The prim at the top of the stage's namespace, whose path is `/`.

method · iOS 27.0+

removePrim

TypeScript
removePrim(path: USDLayer_Path): boolean
Swift declaration
@discardableResult func removePrim(at path: USDLayer.Path) -> Bool

Removes all authored data at the given path in the current edit target.

get · iOS 27.0+

defaultPrim

TypeScript
get defaultPrim(): (USDPrim) | null
Swift declaration
var defaultPrim: USDPrim? { get nonmutating set }

The prim designated as this stage's default entry point when the stage is referenced. > Note: This property can be `nil` even if ``hasDefaultPrim`` is true. This indicates that there is an authored reference to a default prim, but it is invalid.

set · iOS 27.0+

defaultPrim

TypeScript
set defaultPrim(value: (USDPrim) | null)
Swift declaration
var defaultPrim: USDPrim? { get nonmutating set }

The prim designated as this stage's default entry point when the stage is referenced. > Note: This property can be `nil` even if ``hasDefaultPrim`` is true. This indicates that there is an authored reference to a default prim, but it is invalid.

method · iOS 27.0+

descendants

TypeScript
descendantsWhere(predicate: USDPrim_Predicate): Array<USDPrim>
Swift declaration
func descendants(where predicate: USDPrim.Predicate) -> [USDPrim]

Returns the descendant prims of this stage that satisfy the given predicate.

get · iOS 27.0+

descendants

TypeScript
get descendants(): Array<USDPrim>
Swift declaration
var descendants: [USDPrim] { get }

The active, loaded, defined, non-abstract descendant prims of this stage's pseudo-root.

init · iOS 27.0+

init

TypeScript
static initDisplayNameLoadingPayloads(displayName?: (string) | null, loadingPayloads?: USDStage_InitialLoadRule): USDStage
Swift declaration
init(displayName: String? = nil, loadingPayloads: USDStage.InitialLoadRule = .all)

Creates a new memory-backed stage. This is analogous to creating an anonymous ``USDLayer``.

method · iOS 27.0+

unmuteLayer

TypeScript
unmuteLayer(identifier: string): void
Swift declaration
func unmuteLayer(_ identifier: String)

Unmutes the layer with the given identifier, restoring its opinions to composition. - Parameter identifier: The identifier of the layer to unmute.

method · iOS 27.0+

isLayerMuted

TypeScript
isLayerMuted(identifier: string): boolean
Swift declaration
func isLayerMuted(_ identifier: String) -> Bool

Returns a Boolean value that indicates whether the layer with the given identifier is muted. - Parameter identifier: The identifier of the layer to query. - Returns: `true` if the layer is muted; otherwise, `false`.

method · iOS 27.0+

overridePrim

TypeScript
overridePrim(path: USDLayer_Path): USDPrim
Swift declaration
@discardableResult func overridePrim(at path: USDLayer.Path) -> USDPrim

Authors an override prim at a given path, if no prim exists at that path. If a prim already exists at the given path, this function returns that prim. If no prim exists at that path, the prim authored by this function will be an ``USDPrim/Specifier/over`` prim with no authored type. > Note: Attributes on override prims change the values of attributes on regular `def` prims underneath them in the layer stack.

method · iOS 27.0+

relationship

TypeScript
relationship(path: USDLayer_Path): USDPrim_Relationship
Swift declaration
func relationship(at path: USDLayer.Path) -> USDPrim.Relationship

Returns the relationship at a given path, if it exists. If no relationship exists at the resolved path, returns an invalid relationship handle.

method · iOS 27.0+

exportPackage

TypeScript
exportPackageToOptions(url: string, options?: USDStage_ExportOptions): void
Swift declaration
func exportPackage(to url: URL, options: USDStage.ExportOptions = []) throws

Packages the stage into a USDZ archive. The stage and its referenced assets are bundled into a USDZ file. Layer structure is preserved — this operation does not flatten. Throws an error if the extension is not `.usdz`.

method · iOS 27.0+

exportPackage

TypeScript
exportPackageToOptions63733(path: _System_FilePath, options?: USDStage_ExportOptions): void
Swift declaration
func exportPackage(to path: FilePath, options: USDStage.ExportOptions = []) throws

Packages the stage into a USDZ archive.

method · iOS 27.0+

exportPackage

TypeScript
exportPackageOptions(options?: USDStage_ExportOptions): ArrayBuffer
Swift declaration
func exportPackage(options: USDStage.ExportOptions = []) throws -> Data

Packages the stage into a USDZ archive and returns it as in-memory data. The stage and its referenced assets are bundled into a USDZ archive in memory. Layer structure is preserved - this operation does not flatten.

get · iOS 27.0+

metersPerUnit

TypeScript
get metersPerUnit(): number
Swift declaration
var metersPerUnit: Double { get nonmutating set }

The number of meters represented by one unit in this stage's coordinate system.

set · iOS 27.0+

metersPerUnit

TypeScript
set metersPerUnit(value: number)
Swift declaration
var metersPerUnit: Double { get nonmutating set }

The number of meters represented by one unit in this stage's coordinate system.

get · iOS 27.0+

timeCodeRange

TypeScript
get timeCodeRange(): SDKHandle
Swift declaration
var timeCodeRange: ClosedRange<USDStage.TimeCode> { get nonmutating set }

The range of time codes over which this stage has authored animation.

set · iOS 27.0+

timeCodeRange

TypeScript
set timeCodeRange(value: SDKHandle)
Swift declaration
var timeCodeRange: ClosedRange<USDStage.TimeCode> { get nonmutating set }

The range of time codes over which this stage has authored animation.

get · iOS 27.0+

allDescendants

TypeScript
get allDescendants(): Array<USDPrim>
Swift declaration
var allDescendants: [USDPrim] { get }

All descendant prims of this stage's pseudo-root.

get · iOS 27.0+

fallbackUpAxis

TypeScript
static get fallbackUpAxis(): USDToken
Swift declaration
static var fallbackUpAxis: USDToken { get }

The up axis used when a stage has no authored opinion.

get · iOS 27.0+

hasDefaultPrim

TypeScript
get hasDefaultPrim(): boolean
Swift declaration
var hasDefaultPrim: Bool { get }

Return true if this stage's root layer has an authored opinion for the default prim layer metadata. > Note: This function only consults the stage's root layer. To consult a different layer, use ``USDLayer/defaultPrim``.

method · iOS 27.0+

exportFlattened

TypeScript
exportFlattenedTo(url: string): void
Swift declaration
func exportFlattened(to url: URL) throws

Exports the stage as a flattened USD file. Composes all layers into a single layer and writes it to the specified location. The output format is determined by the file extension. > Important: Flattening is destructive. Layer structure, composition arcs, and variant selections are resolved into the output. To preserve layer structure, use ``exportPackage(to:options:)`` instead. Throws an error if the extension is not `.usda`, `.usdc`, or `.usd`.

method · iOS 27.0+

exportFlattened

TypeScript
exportFlattenedTo38657(path: _System_FilePath): void
Swift declaration
func exportFlattened(to path: FilePath) throws

Exports the stage as a flattened USD file.

method · iOS 27.0+

saveSessionLayers

TypeScript
saveSessionLayers(): void
Swift declaration
func saveSessionLayers() throws

Saves the stage's changed session layers to their sources. - Throws: An error if a layer cannot be saved. Some session layers may already have been saved when the failure occurs.

get · iOS 27.0+

timeCodesPerSecond

TypeScript
get timeCodesPerSecond(): number
Swift declaration
var timeCodesPerSecond: Double { get nonmutating set }

The number of time codes per second of playback for this stage.

set · iOS 27.0+

timeCodesPerSecond

TypeScript
set timeCodesPerSecond(value: number)
Swift declaration
var timeCodesPerSecond: Double { get nonmutating set }

The number of time codes per second of playback for this stage.

get · iOS 27.0+

hasAuthoredMetersPerUnit

TypeScript
get hasAuthoredMetersPerUnit(): boolean
Swift declaration
var hasAuthoredMetersPerUnit: Bool { get }

A Boolean value that indicates whether this stage has an authored ``metersPerUnit`` opinion.

static · iOS 27.0+

open

TypeScript
static openRootLayerSessionLayerOptions(rootLayer: USDLayer, sessionLayer?: (USDLayer) | null, options?: USDStage_OpenOptions): USDStage
Swift declaration
static func open(rootLayer: USDLayer, sessionLayer: USDLayer? = nil, options: USDStage.OpenOptions = []) throws -> USDStage

Opens a stage rooted at a given layer. Recursively follows the composition rules described by `rootLayer`, opening any files referenced by the layer and assembling a hierarchy of ``USDPrim``s from the combined contents of all layers. This function creates a new, independent stage object even if there is already a stage opened with `rootLayer` as its root layer. Parameters: - rootLayer: The root layer of the new stage. - sessionLayer: A layer to use as a session layer. If `nil`, an anonymous layer will be created. - options: Options that specify behavior related to opening a stage.

static · iOS 27.0+

open

TypeScript
static openSessionLayerOptions(path: _System_FilePath, sessionLayer?: (USDLayer) | null, options?: USDStage_OpenOptions): USDStage
Swift declaration
static func open(_ path: FilePath, sessionLayer: USDLayer? = nil, options: USDStage.OpenOptions = []) throws -> USDStage

Opens a stage using a file as the root layer. Recursively follows the composition rules described by the root layer, opening any files referenced by that layer and assembling a hierarchy of ``USDPrim``s from the combined contents of all layers. This function will not create a file if no file exists at `path`, unless ``OpenOptions.createNew`` is passed as an option. This function creates a new, independent stage object even if there is already a stage opened with `path` as its root layer. Parameters: - path: A file to use as the root layer of the new stage. - sessionLayer: A layer to use as a session layer. If `nil`, an anonymous layer will be created. - options: Options that specify behavior related to opening a stage. Throws: An error if `path` does not exist or could not be read.

static · iOS 27.0+

open

TypeScript
static openLoadingPayloads(url: string, loadingPayloads?: USDStage_InitialLoadRule): USDStage
Swift declaration
static func open(_ url: URL, loadingPayloads: USDStage.InitialLoadRule = .all) throws -> USDStage

Opens a stage using the file at a URL as its root layer. - Parameters: - url: A file URL to use as the root layer of the new stage. - loadingPayloads: The rule that determines which payloads are loaded when opening the stage. - Returns: A new stage rooted at the layer loaded from `url`. - Throws: An error if the URL does not refer to a readable file.

method · iOS 27.0+

prim

TypeScript
prim(path: USDLayer_Path): USDPrim
Swift declaration
func prim(at path: USDLayer.Path) -> USDPrim

Returns the prim at a given path, if it exists. If `path` resolves to a prim beneath an instance, returns an instance proxy prim if a prim exists at the corresponding path in that instance's prototype. If no prim exists at the resolved path, returns an invalid prim handle.

method · iOS 27.0+

save

TypeScript
save(): void
Swift declaration
func save() throws

Saves the stage's changed layers to their sources. - Throws: An error if a layer cannot be saved. Some layers may already have been saved when the failure occurs.

method · iOS 27.0+

object

TypeScript
object(path: USDLayer_Path): USDStage_Object
Swift declaration
func object(at path: USDLayer.Path) -> USDStage.Object

Returns the object at a given path, if it exists. If no object exists at the resolved path, returns an invalid object handle.

method · iOS 27.0+

reload

TypeScript
reload(): void
Swift declaration
func reload() throws

Reloads the stage's layers from their sources, discarding any unsaved changes.

init · iOS 27.0+

init

TypeScript
static initStringLoadingPayloads(string: string, loadingPayloads?: USDStage_InitialLoadRule): USDStage
Swift declaration
init(string: String, loadingPayloads: USDStage.InitialLoadRule = .all) throws

Creates a stage from a string containing a `.usda` document. - Parameters: - string: The text of a `.usda` document to open as the root layer. - loadingPayloads: The rule that determines which payloads are loaded when opening the stage. - Throws: An error if the string cannot be read as a `.usda` layer.

get · iOS 27.0+

upAxis

TypeScript
get upAxis(): USDToken
Swift declaration
var upAxis: USDToken { get nonmutating set }

The axis that points upward in this stage's coordinate system.

set · iOS 27.0+

upAxis

TypeScript
set upAxis(value: USDToken)
Swift declaration
var upAxis: USDToken { get nonmutating set }

The axis that points upward in this stage's coordinate system.

method · iOS 27.0+

property

TypeScript
property(path: USDLayer_Path): USDPrim_Property
Swift declaration
func property(at path: USDLayer.Path) -> USDPrim.Property

Returns the property at a given path, if it exists. If no property exists at the resolved path, returns an invalid property handle.

method · iOS 27.0+

attribute

TypeScript
attribute(path: USDLayer_Path): USDPrim_Attribute
Swift declaration
func attribute(at path: USDLayer.Path) -> USDPrim.Attribute

Returns the attribute at a given path, if it exists. If no attribute exists at the resolved path, returns an invalid attribute handle.

method · iOS 27.0+

muteLayer

TypeScript
muteLayer(identifier: string): void
Swift declaration
func muteLayer(_ identifier: String)

Mutes the layer with the given identifier, excluding its opinions from composition. - Parameter identifier: The identifier of the layer to mute.

get · iOS 27.0+

rootLayer

TypeScript
get rootLayer(): USDLayer
Swift declaration
var rootLayer: USDLayer { get }

The root layer of this stage.

init · iOS 27.0+

init

TypeScript
static initTypeLoadingPayloads(buffer: ArrayBuffer, type: _UniformTypeIdentifiers_UTType, loadingPayloads?: USDStage_InitialLoadRule): USDStage
Swift declaration
init(_ buffer: Data, type: UTType, loadingPayloads: USDStage.InitialLoadRule = .all) throws

Creates a stage from in-memory data in a given format. - Parameters: - buffer: The serialized USD data to open as the root layer. - type: The content type that identifies the format of `buffer`. - loadingPayloads: The rule that determines which payloads are loaded when opening the stage. - Throws: An error if the data cannot be read as a layer of the given type.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

USDStage.addObserver(for:using:)

Passing a Swift type itself is not supported.

All USDKit types →