UsdStage Algorithms
Utility functions to manipulate UsdStage
Functions
- bool omni::connect::core::configureStage(pxr::UsdStagePtr stage, const std::string &defaultPrimName, const pxr::TfToken &upAxis, const double linearUnits)
Configure a stage so that the defining metadata is explicitly authored.
- pxr::UsdStageRefPtr omni::connect::core::createStage(const std::string &identifier, const std::string &defaultPrimName, const pxr::TfToken &upAxis, const double linearUnits, const pxr::SdfLayer::FileFormatArguments &fileFormatArgs=pxr::SdfLayer::FileFormatArguments())
Create and configure a
UsdStage
- void omni::connect::core::saveStage(pxr::UsdStagePtr stage, const char *comment=nullptr)
Save the given
UsdStage
with an optional checkpoint comment.
Functions
-
bool omni::connect::core::configureStage(pxr::UsdStagePtr stage, const std::string &defaultPrimName, const pxr::TfToken &upAxis, const double linearUnits)
Configure a stage so that the defining metadata is explicitly authored.
The default prim will be used as the target of a reference or payload to this layer that doesn’t specify a prim path. A root prim with the given
defaultPrimName
will be defined on the stage if one is not already specified. If a new prim is defined then the type name will be set to “Scope”.The stage metrics of Up Axis and Linear Units will be authored.
- Parameters
stage – The stage to be configured.
defaultPrimName – Name of the default root prim.
upAxis – The up axis for all the geometry contained in the stage.
linearUnits – The meters per unit for all linear measurements in the stage.
- Returns
A bool indicating if the metadata was successfully authored.
-
pxr::UsdStageRefPtr omni::connect::core::createStage(const std::string &identifier, const std::string &defaultPrimName, const pxr::TfToken &upAxis, const double linearUnits, const pxr::SdfLayer::FileFormatArguments &fileFormatArgs = pxr::SdfLayer::FileFormatArguments())
Create and configure a
UsdStage
See
configureStage
for more details.Important: The extension of the
identifier
must be associated with a file format that supports editing.- Parameters
identifier – The identifier to be used for the root layer of this stage.
defaultPrimName – Name of the default root prim.
upAxis – The up axis for all the geometry contained in the stage.
linearUnits – The meters per unit for all linear measurements in the stage.
fileFormatArgs – Additional file format-specific arguments to be supplied during Stage creation.
- Returns
The newly created stage or a null pointer.
-
void omni::connect::core::saveStage(pxr::UsdStagePtr stage, const char *comment = nullptr)
Save the given
UsdStage
with an optional checkpoint comment.Save all dirty session layers and sublayers of session layers contributing to this stage.
All dirty layers will be annotated with authoring metadata, unless previously annotated. This is to preserve authoring metadata on referenced layers that came from other applications. See SdfLayer Algorithms for more details on
setLayerAuthoringMetadata
.The comment will be authored in all layers as the SdfLayer comment.
If the layers are being exported to an Omniverse Nucleus server with checkpoints enabled, then the comment will be added to the checkpoints.
- Parameters
stage – The stage to be saved.
comment – The checkpoints comment.