All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdGeomPrimvarsAPI Class Reference

UsdGeomPrimvarsAPI encodes geometric "primitive variables", as UsdGeomPrimvar, which interpolate across a primitive's topology, can override shader inputs, and inherit down namespace. More...

+ Inheritance diagram for UsdGeomPrimvarsAPI:

Public Member Functions

 UsdGeomPrimvarsAPI (const UsdPrim &prim=UsdPrim())
 Construct a UsdGeomPrimvarsAPI on UsdPrim prim . More...
 
 UsdGeomPrimvarsAPI (const UsdSchemaBase &schemaObj)
 Construct a UsdGeomPrimvarsAPI on the prim held by schemaObj . More...
 
virtual USDGEOM_API ~UsdGeomPrimvarsAPI ()
 Destructor. More...
 
USDGEOM_API UsdGeomPrimvar CreatePrimvar (const TfToken &attrName, const SdfValueTypeName &typeName, const TfToken &interpolation=TfToken(), int elementSize=-1) const
 Author scene description to create an attribute on this prim that will be recognized as Primvar (i.e. More...
 
USDGEOM_API UsdGeomPrimvar GetPrimvar (const TfToken &name) const
 Return the Primvar object named by name, which will be valid if a Primvar attribute definition already exists. More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
GetPrimvars () const
 Return valid UsdGeomPrimvar objects for all defined Primvars on this prim, similarly to UsdPrim::GetAttributes(). More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
GetAuthoredPrimvars () const
 Like GetPrimvars(), but include only primvars that have some authored scene description (though not necessarily a value). More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
GetPrimvarsWithValues () const
 Like GetPrimvars(), but include only primvars that have some value, whether it comes from authored scene description or a schema fallback. More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
GetPrimvarsWithAuthoredValues () const
 Like GetPrimvars(), but include only primvars that have an authored value. More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
FindInheritablePrimvars () const
 Compute the primvars that can be inherited from this prim by its child prims, including the primvars that this prim inherits from ancestor prims. More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
FindIncrementallyInheritablePrimvars (const std::vector< UsdGeomPrimvar > &inheritedFromAncestors) const
 Compute the primvars that can be inherited from this prim by its child prims, starting from the set of primvars inherited from this prim's ancestors. More...
 
USDGEOM_API UsdGeomPrimvar FindPrimvarWithInheritance (const TfToken &name) const
 Like GetPrimvar(), but if the named primvar does not exist or has no authored value on this prim, search for the named, value-producing primvar on ancestor prims. More...
 
USDGEOM_API UsdGeomPrimvar FindPrimvarWithInheritance (const TfToken &name, const std::vector< UsdGeomPrimvar > &inheritedFromAncestors) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version of FindPrimvarWithInheritance() takes the pre-computed set of primvars inherited from this prim's ancestors, as computed by FindInheritablePrimvars() or FindIncrementallyInheritablePrimvars() on the prim's parent. More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
FindPrimvarsWithInheritance () const
 Find all of the value-producing primvars either defined on this prim, or inherited from ancestor prims. More...
 
USDGEOM_API std::vector
< UsdGeomPrimvar
FindPrimvarsWithInheritance (const std::vector< UsdGeomPrimvar > &inheritedFromAncestors) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version of FindPrimvarsWithInheritance() takes the pre-computed set of primvars inherited from this prim's ancestors, as computed by FindInheritablePrimvars() or FindIncrementallyInheritablePrimvars() on the prim's parent. More...
 
USDGEOM_API bool HasPrimvar (const TfToken &name) const
 Is there a defined Primvar name on this prim? More...
 
USDGEOM_API bool HasPossiblyInheritedPrimvar (const TfToken &name) const
 Is there a Primvar named name with an authored value on this prim or any of its ancestors? More...
 
- Public Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim=UsdPrim())
 Construct a UsdAPISchemaBase on UsdPrim prim . More...
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj)
 Construct a UsdAPISchemaBase on the prim held by schemaObj . More...
 
virtual USD_API ~UsdAPISchemaBase ()=0
 Destructor. More...
 
- Public Member Functions inherited from UsdSchemaBase
bool IsConcrete () const
 Returns whether or not this class corresponds to a concrete instantiable prim type in scene description. More...
 
bool IsTyped () const
 Returns whether or not this class inherits from UsdTyped. More...
 
bool IsAPISchema () const
 Returns whether this is an API schema or not. More...
 
bool IsAppliedAPISchema () const
 Returns whether this is an applied API schema or not. More...
 
bool IsMultipleApplyAPISchema () const
 Returns whether this is an applied API schema or not. More...
 
UsdSchemaType GetSchemaType () const
 
USD_API UsdSchemaBase (const UsdPrim &prim=UsdPrim())
 Construct and store prim as the held prim. More...
 
USD_API UsdSchemaBase (const UsdSchemaBase &otherSchema)
 Construct and store for the same prim held by otherSchema. More...
 
virtual USD_API ~UsdSchemaBase ()
 Destructor. More...
 
USD_API operator bool () const
 Return true if this schema object is compatible with its held prim, false otherwise. More...
 
UsdPrim GetPrim () const
 Return this schema object's held prim. More...
 
SdfPath GetPath () const
 Shorthand for GetPrim()->GetPath(). More...
 
USD_API SdfPrimSpecHandle GetSchemaClassPrimDefinition () const
 Return the prim definition associated with this schema instance if one exists, otherwise return null. More...
 

Static Public Member Functions

static USDGEOM_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. More...
 
static USDGEOM_API
UsdGeomPrimvarsAPI 
Get (const UsdStagePtr &stage, const SdfPath &path)
 Return a UsdGeomPrimvarsAPI holding the prim adhering to this schema at path on stage. More...
 
- Static Public Member Functions inherited from UsdAPISchemaBase
static USD_API const
TfTokenVector
GetSchemaAttributeNames (bool includeInherited=true)
 Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. More...
 
- Static Public Member Functions inherited from UsdSchemaBase
static const TfTokenVectorGetSchemaAttributeNames (bool includeInherited=true)
 

Static Public Attributes

static const UsdSchemaType schemaType = UsdSchemaType::NonAppliedAPI
 Compile time constant representing what kind of schema this class is. More...
 
- Static Public Attributes inherited from UsdAPISchemaBase
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 Compile time constant representing what kind of schema this class is. More...
 
- Static Public Attributes inherited from UsdSchemaBase
static const UsdSchemaType schemaType = UsdSchemaType::AbstractBase
 Compile time constant representing what kind of schema this class is. More...
 

Protected Member Functions

USDGEOM_API UsdSchemaType _GetSchemaType () const override
 Returns the type of schema this class belongs to. More...
 
- Protected Member Functions inherited from UsdAPISchemaBase
 UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName)
 Construct a multiple-apply UsdAPISchemaBase on UsdPrim prim with the specified instanceName. More...
 
 UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName)
 Construct a multiple-apply UsdAPISchemaBase on the prim held by schemaObj with the given instanceName. More...
 
const TfToken_GetInstanceName () const
 Returns the instance name of the API schema object belonging to a multiple-apply API schema. More...
 
USD_API bool _IsCompatible () const override
 Check whether this APISchema object is valid for the currently held prim. More...
 
- Protected Member Functions inherited from UsdSchemaBase
const TfType_GetType () const
 
USD_API UsdAttribute _CreateAttr (TfToken const &attrName, SdfValueTypeName const &typeName, bool custom, SdfVariability variability, VtValue const &defaultValue, bool writeSparsely) const
 

Friends

class UsdSchemaRegistry
 

Additional Inherited Members

- Static Protected Member Functions inherited from UsdAPISchemaBase
template<typename APISchemaType >
static APISchemaType _ApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName)
 Helper method to apply a single-apply API schema with the given schema name apiSchemaName' and C++ type 'APISchemaType'. More...
 
template<typename APISchemaType >
static APISchemaType _MultipleApplyAPISchema (const UsdPrim &prim, const TfToken &apiSchemaName, const TfToken &instanceName)
 Helper method to apply a multiple-apply API schema with the given schema name apiSchemaName', C++ type 'APISchemaType' and instance name instanceName. More...
 

Detailed Description

UsdGeomPrimvarsAPI encodes geometric "primitive variables", as UsdGeomPrimvar, which interpolate across a primitive's topology, can override shader inputs, and inherit down namespace.

Which Method to Use to Retrieve Primvars

While creating primvars is unambiguous (CreatePrimvar()), there are quite a few methods available for retrieving primvars, making it potentially confusing knowing which one to use. Here are some guidelines:

Definition at line 82 of file primvarsAPI.h.

Constructor & Destructor Documentation

UsdGeomPrimvarsAPI ( const UsdPrim prim = UsdPrim())
inlineexplicit

Construct a UsdGeomPrimvarsAPI on UsdPrim prim .

Equivalent to UsdGeomPrimvarsAPI::Get(prim.GetStage(), prim.GetPath()) for a valid prim, but will not immediately throw an error for an invalid prim

Definition at line 94 of file primvarsAPI.h.

UsdGeomPrimvarsAPI ( const UsdSchemaBase schemaObj)
inlineexplicit

Construct a UsdGeomPrimvarsAPI on the prim held by schemaObj .

Should be preferred over UsdGeomPrimvarsAPI(schemaObj.GetPrim()), as it preserves SchemaBase state.

Definition at line 102 of file primvarsAPI.h.

virtual USDGEOM_API ~UsdGeomPrimvarsAPI ( )
virtual

Destructor.

Member Function Documentation

USDGEOM_API UsdSchemaType _GetSchemaType ( ) const
overrideprotectedvirtual

Returns the type of schema this class belongs to.

See Also
UsdSchemaType

Reimplemented from UsdAPISchemaBase.

USDGEOM_API UsdGeomPrimvar CreatePrimvar ( const TfToken attrName,
const SdfValueTypeName typeName,
const TfToken interpolation = TfToken(),
int  elementSize = -1 
) const

Author scene description to create an attribute on this prim that will be recognized as Primvar (i.e.

will present as a valid UsdGeomPrimvar).

The name of the created attribute may or may not be the specified attrName, due to the possible need to apply property namespacing for primvars. See Creating and Accessing Primvars for more information. Creation may fail and return an invalid Primvar if attrName contains a reserved keyword, such as the "indices" suffix we use for indexed primvars.

The behavior with respect to the provided typeName is the same as for UsdAttributes::Create(), and interpolation and elementSize are as described in UsdGeomPrimvar::GetInterpolation() and UsdGeomPrimvar::GetElementSize().

If interpolation and/or elementSize are left unspecified, we will author no opinions for them, which means any (strongest) opinion already authored in any contributing layer for these fields will become the Primvar's values, or the fallbacks if no opinions have been authored.

Returns
an invalid UsdGeomPrimvar if we failed to create a valid attribute, a valid UsdGeomPrimvar otherwise. It is not an error to create over an existing, compatible attribute.
See Also
UsdPrim::CreateAttribute(), UsdGeomPrimvar::IsPrimvar()
USDGEOM_API std::vector<UsdGeomPrimvar> FindIncrementallyInheritablePrimvars ( const std::vector< UsdGeomPrimvar > &  inheritedFromAncestors) const

Compute the primvars that can be inherited from this prim by its child prims, starting from the set of primvars inherited from this prim's ancestors.

If this method returns an empty vector, then this prim's children should inherit the same set of primvars available to this prim, i.e. the input inheritedFromAncestors .

As opposed to FindInheritablePrimvars(), which always recurses up through all of the prim's ancestors, this method allows more efficient computation of inheritable primvars by starting with the list of primvars inherited from this prim's ancestors, and returning a newly allocated vector only when this prim makes a change to the set of inherited primvars. This enables O(n) inherited primvar computation for all prims on a Stage, with potential to share computed results that are identical (i.e. when this method returns an empty vector, its parent's result can (and must!) be reused for all of the prim's children.

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API std::vector<UsdGeomPrimvar> FindInheritablePrimvars ( ) const

Compute the primvars that can be inherited from this prim by its child prims, including the primvars that this prim inherits from ancestor prims.

Inherited primvars will be bound to attributes on the corresponding ancestor prims.

Only primvars with authored, non-blocked, constant interpolation values are inheritable; fallback values are not inherited. The order of the returned primvars is undefined.

It is not generally useful to call this method on UsdGeomGprim leaf prims, and furthermore likely to be expensive since most primvars are defined on Gprims.

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API std::vector<UsdGeomPrimvar> FindPrimvarsWithInheritance ( ) const

Find all of the value-producing primvars either defined on this prim, or inherited from ancestor prims.

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API std::vector<UsdGeomPrimvar> FindPrimvarsWithInheritance ( const std::vector< UsdGeomPrimvar > &  inheritedFromAncestors) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version of FindPrimvarsWithInheritance() takes the pre-computed set of primvars inherited from this prim's ancestors, as computed by FindInheritablePrimvars() or FindIncrementallyInheritablePrimvars() on the prim's parent.

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API UsdGeomPrimvar FindPrimvarWithInheritance ( const TfToken name) const

Like GetPrimvar(), but if the named primvar does not exist or has no authored value on this prim, search for the named, value-producing primvar on ancestor prims.

The returned primvar will be bound to the attribute on the corresponding ancestor prim on which it was found (if any). If neither this prim nor any ancestor contains a value-producing primvar, then the returned primvar will be the same as that returned by GetPrimvar().

This is probably the method you want to call when needing to consume a primvar of a particular name.

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API UsdGeomPrimvar FindPrimvarWithInheritance ( const TfToken name,
const std::vector< UsdGeomPrimvar > &  inheritedFromAncestors 
) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version of FindPrimvarWithInheritance() takes the pre-computed set of primvars inherited from this prim's ancestors, as computed by FindInheritablePrimvars() or FindIncrementallyInheritablePrimvars() on the prim's parent.

See Also
Which Method to Use to Retrieve Primvars
static USDGEOM_API UsdGeomPrimvarsAPI Get ( const UsdStagePtr &  stage,
const SdfPath path 
)
static

Return a UsdGeomPrimvarsAPI holding the prim adhering to this schema at path on stage.

If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following:

* UsdGeomPrimvarsAPI(stage->GetPrimAtPath(path));
*
USDGEOM_API std::vector<UsdGeomPrimvar> GetAuthoredPrimvars ( ) const

Like GetPrimvars(), but include only primvars that have some authored scene description (though not necessarily a value).

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API UsdGeomPrimvar GetPrimvar ( const TfToken name) const

Return the Primvar object named by name, which will be valid if a Primvar attribute definition already exists.

Name lookup will account for Primvar namespacing, which means that this method will succeed in some cases where

*

will not, unless name is properly namespace prefixed.

Note
Just because a Primvar is valid and defined, and even if its underlying UsdAttribute (GetAttr()) answers HasValue() affirmatively, one must still check the return value of Get(), due to the potential of time-varying value blocks (see Attribute Value Blocking).
See Also
HasPrimvar(), Which Method to Use to Retrieve Primvars
USDGEOM_API std::vector<UsdGeomPrimvar> GetPrimvars ( ) const

Return valid UsdGeomPrimvar objects for all defined Primvars on this prim, similarly to UsdPrim::GetAttributes().

The returned primvars may not possess any values, and therefore not be useful to some clients. For the primvars useful for inheritance computations, see GetPrimvarsWithAuthoredValues(), and for primvars useful for direct consumption, see GetPrimvarsWithValues().

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API std::vector<UsdGeomPrimvar> GetPrimvarsWithAuthoredValues ( ) const

Like GetPrimvars(), but include only primvars that have an authored value.

This is the query used when computing inheritable primvars, and is generally more useful than GetAuthoredPrimvars().

See Also
Which Method to Use to Retrieve Primvars
USDGEOM_API std::vector<UsdGeomPrimvar> GetPrimvarsWithValues ( ) const

Like GetPrimvars(), but include only primvars that have some value, whether it comes from authored scene description or a schema fallback.

For most purposes, this method is more useful than GetPrimvars().

See Also
Which Method to Use to Retrieve Primvars
static USDGEOM_API const TfTokenVector& GetSchemaAttributeNames ( bool  includeInherited = true)
static

Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes.

Does not include attributes that may be authored by custom/extended methods of the schemas involved.

USDGEOM_API bool HasPossiblyInheritedPrimvar ( const TfToken name) const

Is there a Primvar named name with an authored value on this prim or any of its ancestors?

This is probably the method you want to call when wanting to know whether or not the prim "has" a primvar of a particular name.

See Also
FindPrimvarWithInheritance()
USDGEOM_API bool HasPrimvar ( const TfToken name) const

Is there a defined Primvar name on this prim?

Name lookup will account for Primvar namespacing.

Like GetPrimvar(), a return value of true for HasPrimvar() does not guarantee the primvar will produce a value.

Member Data Documentation

const UsdSchemaType schemaType = UsdSchemaType::NonAppliedAPI
static

Compile time constant representing what kind of schema this class is.

See Also
UsdSchemaType

Definition at line 88 of file primvarsAPI.h.


The documentation for this class was generated from the following file: