usdrt::UsdPrim

Defined in usdrt/scenegraph/usd/usd/impl/usd_decl.h

Functions

class UsdPrim

A UsdPrim is the principal container of other types of scene description. It provides API for accessing and creating all of the contained kinds of scene description.

Public Functions

bool HasAttribute(const TfToken &name) const

Check if this prim has an attribute named name in Fabric. Does not check for attribute existence in the underlying USD stage.

Parameters

name – The attribute name.

Returns

Return true if the attribute exists on this prim, and false otherwise.

UsdAttribute GetAttribute(const TfToken &name) const

Get the attribute named name if it exists in fabric. Does not check for attribute existence in the underlying USD stage.

Parameters

name – The attribute name.

Returns

Return the attribute on this prim with name name, or an invalid attribute object if not found.

std::vector<UsdAttribute> GetAttributes() const

Get all attributes on this prim.

Note

Current implementation only returns attributes that exist in Fabric

Returns

Return a vector of attributes that are on the prim.

std::vector<UsdAttribute> GetAuthoredAttributes() const

Get all authored attributes on this prim.

Returns

Return a vector of attributes that are authored on the prim.

UsdAttribute CreateAttribute(const TfToken &name, const SdfValueTypeName &typeName, bool custom = true) const

Create a new attribute on this prim in fabric.

TODO: SdfVariability parameter

Parameters
  • name – The attribute name.

  • typeName – The type of the attribute.

  • custom – Indicate if the attribute is custom. Default is true. This currently does nothing as it is not represented in fabric.

Returns

Return the new attribute.

bool HasRelationship(const TfToken &name) const

Check if this prim has a relationship named name. Fabric is the ground truth for existence, so there is no USD fallback.

Parameters

name – The relationship name.

Returns

Return true if the relationship exists on this prim, and false otherwise.

UsdRelationship GetRelationship(const TfToken &name) const

Get the relationship named name if it exists.

Note

Fabric does not yet support lists of targets for relationships.

Parameters

name – The relationship name.

Returns

Return the relationship on this prim with name name, or an invalid relationship object if not found.

std::vector<UsdRelationship> GetRelationships() const

Get all relationships on this prim.

Note

Fabric does not yet support lists of targets for relationships.

Returns

Return a vector of relationship that are on the prim.

std::vector<UsdRelationship> GetAuthoredRelationships() const

Get all authored relationships on this prim.

Note

Fabric does not yet support lists of targets for relationships.

Returns

Return a vector of relationships that are authored on the prim.

UsdRelationship CreateRelationship(const TfToken &relName, bool custom = true) const

Create a new relationship on this prim in fabric.

Parameters
  • relName – The relationship name.

  • custom – Indicate if the relationship is custom. Default is true. This currently does nothing as it is not represented in fabric.

Returns

Return the new relationship.

bool RemoveProperty(const TfToken &name) const

Remove property from this prim in fabric.

Parameters

name – Name of the property to remove.

Returns

Return true if the property was removed, and false otherwise.

bool IsValid() const

Check if this is a valid prim. A prim is valid if it exists in fabric. This includes minimally populated prims.

Returns

Return true if this prim is valid, and false otherwise.

UsdStageRefPtr GetStage() const

Get the fabric stage holding this UsdPrim.

Returns

Return a pointer to the fabric stage that contains this prim.

UsdPrim GetPrim() const

UsdObject method required for UsdPrim to be a complete type.

Returns

Return this prim.

const TfToken GetName() const

Get the name of this prim.

Returns

Return the name of this prim.

SdfPath GetPath() const

Get the path to this prim.

Returns

Returns the path to this prim.

const SdfPath GetPrimPath() const

Get the path to this prim.

Returns

Returns the path to this prim.

UsdPrim GetChild(const TfToken &name) const

Get child prim name from this prim’s children.

Parameters

name – The name of the child to look for.

Returns

Return the child prim, or an invalid prim if not found.

std::vector<UsdPrim> GetChildren() const

Get all child prims of this prim. If fabric population / hierarchy is active, get child prims using the fabric Connectivity API. Otherwise, fall back to USD and load the prims into fabric.

Returns

Return a vector containing all child prims of this prim.

UsdPrim GetParent() const

Get this prim’s parent prim.

Returns

Return this prim’s parent prim.

UsdPrim GetNextSibling() const

Get this prim’s next sibling in the scene hierarchy. If population is active, get next sibling using Connectivity. Otherwise fall back to USD.

Returns

Return this prim’s next sibling if it has one. Otherwise return an invalid prim.

TfToken GetTypeName() const

Get the type name for this prim. This looks for the attribute of type SdfValueTypeNames->PrimTypeTag in fabric.

Returns

Return the prim type name.

bool SetTypeName(const TfToken &typeName) const

Set this prim’s type name. This clears any existing type name and sets the attribute SdfValueTypeNames->PrimTypeTag in fabric to typeName.

Parameters

typeName – Prim’s new type name to set.

Returns

Return true if this prim’s type name has been updated. False otherwise.

bool ClearTypeName() const

Clear this prim’s typename. This removes the attribute of type SdfValueTypeNames->PrimTypeTag from fabric.

Returns

Return true if this prim’s type name has been cleared. False otherwise.

bool HasAuthoredTypeName() const

Check if this prim has an authored typename. True if an attribute of type SdfValueTypeNames->PrimTypeTag has a value authored.

Returns

Return true if this prim’s typename tag is authored, false otherwise.

template<typename SchemaType>
inline bool IsA() const

Query if this prim’s type is or is a child type of SchemaType.

Template Parameters

SchemaType – The schema type name or alias type.

Returns

Return true if this prim is or is a child type of SchemaType.

bool IsA(const TfToken &schemaType) const

Query if this prim’s type is or is a child type of SchemaType.

Parameters

schemaType – The schema c++ type.

Returns

Return true if this prim is or is a child type of SchemaType.

bool AddAppliedSchema(const TfToken &appliedSchemaName) const

Apply schema of type appliedSchemaName. This authors an attribute of type SdfValueTypeNames->AppliedSchemaTypeTag with value appliedSchemaName.

Parameters

appliedSchemaName – The full name or alias of the schema to apply.

Returns

Return true if the schema has been applied, false otherwise.

bool RemoveAppliedSchema(const TfToken &appliedSchemaName) const

Remove schema of type appliedSchemaName. This removes the attribute of type SdfValueTypeNames->AppliedSchemaTypeTag with value appliedSchemaName.

Parameters

appliedSchemaName – The full name or alias of the schema to remove.

Returns

Return true if the schema has been removed, false otherwise.

bool HasAPI(const TfToken &schemaIdentifier) const

Check is this prim has a schema schemaIdentifier applied. Looks for an authored attribute of type SdfValueTypeNames->AppliedSchemaTypeTag and value schemaIdentifier.

Parameters

schemaIdentifier – The full name or alias of the schema to check.

Returns

Return true if the schema is applied to this prim, false otherwise.

template<typename SchemaType>
inline bool HasAPI() const

Check is this prim has a schema of type @tp SchemaType applied. Looks for an authored attribute of type SdfValueTypeNames->AppliedSchemaTypeTag and value @tp SchemaType.

Template Parameters

SchemaType – The schema type to check.

Returns

Return true if the schema is applied to this prim, false otherwise.

bool ApplyAPI(const TfToken &schemaIdentifier) const

Apply schema of type schemaIdentifier. Equivalent to AddAppliedSchema.

Parameters

schemaIdentifier – The full name or alias of the schema to apply.

Returns

Return true if the schema has been applied, false otherwise.

template<typename SchemaType>
inline bool ApplyAPI() const

Apply schema of type @tp SchemaType. Equivalent to AddAppliedSchema.

Template Parameters

SchemaType – The schema type to apply.

Returns

Return true if the schema has been applied, false otherwise.

bool RemoveAPI(const TfToken &schemaIdentifier) const

Remove schema of type schemaIdentifier. Equivalent to RemoveAppliedSchema.

Parameters

schemaIdentifier – The full name or alias of the schema to remove.

Returns

Return true if the schema has been removed, false otherwise.

template<typename SchemaType>
inline bool RemoveAPI() const

Remove schema of type @tp SchemaType. Equivalent to RemoveAppliedSchema.

Template Parameters

SchemaType – The schema type to remove.

Returns

Return true if the schema has been removed, false otherwise.

TfTokenVector GetAppliedSchemas() const

Get all applied schemas. Look for all attributes of type SdfValueTypeNames->AppliedSchemaTypeTag.

Returns

Return a vector of applied schema alias names.

explicit operator bool() const

Check if this prim is valid. See UsdPrim::IsValid.

Returns

Return true if this prim is valid, and false otherwise.