usdrt::UsdPrim
Defined in usdrt/scenegraph/usd/usd/impl/usd_decl.h
-
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
namein 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
nameif 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
nameif 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.
-
TfTokenVector GetPropertyNames() const
Get all of this prim’s properties (attributes and relationships). Includes build in properties.
- Returns
Return a TfTokenVector of property names.
-
TfTokenVector GetAuthoredPropertyNames() const
Get all of this prim’s properties (attributes and relationships). Includes build in properties.
Note: Fabric doesn’t differientiate between authored properties, so this API is here for completeness but is the exact same as GetPropertyNames.
- Returns
Return a TfTokenVector of property names.
-
bool HasProperty(const TfToken &name) const
Check if the prim has property
name.- Parameters
name – Property name
- Returns
True if this prim has property
name.
-
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 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
namefrom 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 child prims of this prim. If fabric population / hierarchy is active, get child prims using the fabric Connectivity API. Otherwise, fall back to
GetChildrenin USD and load the prims into fabric.- Returns
Return a vector containing all child prims of this prim.
-
TfTokenVector GetChildrenNames() const
Get list of child prim names when iterating over GetChildren.
- Returns
TfTokenVector of child names.
-
std::vector<UsdPrim> GetAllChildren() 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
GetChildrenUSD and load the prims into fabric.Note
This differs from USD functionality. Same as GetChildren.
- Returns
Return a vector containing all child prims of this prim.
-
TfTokenVector GetAllChildrenNames() const
Get list of child prim names when iterating over GetAllChildren.
- Returns
TfTokenVector of child names.
-
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. An error will be issued ifSchemaTypeis an unknown schema.- 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. An error will be issued if theschemaTypeis an unknown schema.- 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 valueappliedSchemaName. This method assumes:input validation (if desired) has already been done by other API methods (UsdPrim::ApplyAPI).
the
appliedSchemaNameis the schema alias. For example:MotionAPIinstead ofUsdGeomMotionAPI. This is required for Fabric.for multiple-apply schemas,
appliedSchemaNamecontains both the namespace and instance name. For example: ‘CollectionAPI:myStuff’.
ApplyAPIis the preferred method for applying valid API schemas. UsingApplyAPIinstead will convert schema names to alias and join namespace/instance names.See also
- 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 valueappliedSchemaName. This method assumes:input validation has already been done by other API methods (UsdPrim::RemoveAPI).
the
appliedSchemaNameis the schema alias. For example:MotionAPIinstead ofUsdGeomMotionAPI. This is required for Fabric.for multiple-apply schemas,
appliedSchemaNamecontains both the namespace and instance name. For example: ‘CollectionAPI:myStuff’.
RemoveAPIis the preferred method for applying valid API schemas. UsingRemoveAPIinstead will convert schema names to alias and join namespace/instance names.See also
- 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 TfToken &instanceName = TfToken()) const
Check is this prim has a schema
schemaIdentifierapplied. Looks for an authored attribute of type SdfValueTypeNames->AppliedSchemaTypeTag and valueschemaIdentifier. For MultipleApplyAPI schemas, the query value isschemaIdentifieras the namespace, joined withinstanceName.- Parameters
schemaIdentifier – The full name or alias of the schema to check.
instanceName – If non-empy, used to determine if a particular instance of a multiple-apply api schema has been applied to the prim if
SchemaTypeis a multiple-apply api schema. Default empty.
- Returns
Return true if the schema is applied to this prim, false otherwise.
-
template<typename SchemaType>
inline bool HasAPI(const TfToken &instanceName = TfToken()) const Check is this prim has a schema of type
SchemaTypeapplied. Looks for an authored attribute of type SdfValueTypeNames->AppliedSchemaTypeTag and valueSchemaType.An error will be issued if
SchemaTypedoes not a known applied API schema, or if, for a miltiple-apply API schema,instanceNameis empty.- Template Parameters
SchemaType – The schema type to check.
- Parameters
instanceName – If non-empy, used to determine if a particular instance of a multiple-apply api schema has been applied to the prim if
SchemaTypeis a multiple-apply api schema. Default empty.- Returns
Return true if the schema is applied to this prim, false otherwise.
-
bool ApplyAPI(const TfToken &schemaIdentifier, const TfToken &instanceName = TfToken()) const
Apply schema of type
schemaIdentifierto the prim.For
schemaIdentifierto be valid schema to apply, it must be a single-apply or multiple-apply api schema, and for multiple-apply,instanceNamemust not be empty.See also
- Parameters
schemaIdentifier – The full name or alias of the schema to apply.
instanceName – If non-empy, used to determine if a particular instance of a multiple-apply api schema has been applied to the prim if
SchemaTypeis a multiple-apply api schema. Default empty.
- Returns
Return true if the schema has been applied, false otherwise.
-
template<typename SchemaType>
inline bool ApplyAPI() const Apply schema of type
SchemaTypeto the prim.An error is raised for invalid
SchemaType. ForSchemaTypeto be valid schema to apply using this template, it must be a single-apply API schema.See also
- Template Parameters
SchemaType – The schema type to apply.
- Returns
Return true if the schema has been applied, false otherwise.
-
template<typename SchemaType>
inline bool ApplyAPI(const TfToken &instanceName) const Apply schema of type
SchemaTypeto the prim.An error is raised for invalid
SchemaType. ForSchemaTypeto be valid schema to apply using this template, it must be a multiple-apply api schema and instanceName must not be empty.See also
- Template Parameters
SchemaType – The schema type to apply.
- Parameters
instanceName – If non-empy, used to determine if a particular instance of a multiple-apply api schema has been applied to the prim if
SchemaTypeis a multiple-apply api schema.- Returns
Return true if the schema has been applied, false otherwise.
-
bool RemoveAPI(const TfToken &schemaIdentifier, const TfToken &instanceName = TfToken()) const
Remove schema of type
schemaIdentifier.- Parameters
schemaIdentifier – The full name or alias of the schema to remove.
instanceName – If non-empy, used to remove a particular instance of a multiple-apply api schema from the prim if
SchemaTypeis a multiple-apply api schema. Default empty.
- Returns
Return true if the schema has been removed, false otherwise.
-
template<typename SchemaType>
inline bool RemoveAPI() const Remove single-apply API schema of type
SchemaType.An error is raised for invalid
SchemaType. ForSchemaTypeto be valid schema to remove using this template, it must be a single apply-api schema.See also
- Template Parameters
SchemaType – The schema type to remove.
- Returns
Return true if the schema has been removed, false otherwise.
-
template<typename SchemaType>
inline bool RemoveAPI(const TfToken &instanceName) const Remove multiple-apply API schema of type
SchemaType.An error is raised for invalid
SchemaType. ForSchemaTypeto be valid schema to remove using this template, it must be a multiple-apply api schema and instanceName must not be empty.See also
- Template Parameters
SchemaType – The schema type to remove.
- Parameters
instanceName – Used to remove a particular instance of a multiple-apply api schema from the prim. Must not be empty.
- 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.
-
bool HasAttribute(const TfToken &name) const