UsdStage Hierarchy#

Utility functions to avoid common mistakes when manipulating the prim hierarchy of a UsdStage.

Functions#

bool usdex::core::isEditablePrimLocation(const pxr::UsdPrim &prim, const std::string &name, std::string *reason)

Validate that prim opinions could be authored for a child prim with the given name.

bool usdex::core::isEditablePrimLocation(const pxr::UsdStagePtr stage, const pxr::SdfPath &path, std::string *reason)

Validate that prim opinions could be authored at this path on the stage.

Functions#

bool usdex::core::isEditablePrimLocation(
const pxr::UsdPrim &prim,
const std::string &name,
std::string *reason,
)#

Validate that prim opinions could be authored for a child prim with the given name.

This validates that the prim is valid, and that the name is a valid identifier. If a prim already exists at the given path it must not be an instance proxy.

If the location is invalid and reason is non-null, an error message describing the validation error will be set.

Parameters:
  • prim – The UsdPrim which would be the parent of the proposed location.

  • name – The name which would be used for the UsdPrim at the proposed location.

  • reason – The output message for failed validation.

Returns:

True if the location is valid, or false otherwise.

bool usdex::core::isEditablePrimLocation(
const pxr::UsdStagePtr stage,
const pxr::SdfPath &path,
std::string *reason,
)#

Validate that prim opinions could be authored at this path on the stage.

This validates that the stage and path are valid, and that the path is absolute. If a prim already exists at the given path it must not be an instance proxy.

If the location is invalid and reason is non-null, an error message describing the validation error will be set.

Parameters:
  • stage – The Stage to consider.

  • path – The Path to consider.

  • reason – The output message for failed validation.

Returns:

True if the location is valid, or false otherwise.