HDK
|
#include <primvarsAPI.h>
Static Public Member Functions | |
static USDGEOM_API const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
static USDGEOM_API UsdGeomPrimvarsAPI | Get (const UsdStagePtr &stage, const SdfPath &path) |
static USDGEOM_API bool | CanContainPropertyName (const TfToken &name) |
Static Public Member Functions inherited from UsdAPISchemaBase | |
static USD_API const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
Static Public Member Functions inherited from UsdSchemaBase | |
static const TfTokenVector & | GetSchemaAttributeNames (bool includeInherited=true) |
Static Public Attributes | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::NonAppliedAPI |
Static Public Attributes inherited from UsdAPISchemaBase | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Static Public Attributes inherited from UsdSchemaBase | |
static const UsdSchemaKind | schemaKind = UsdSchemaKind::AbstractBase |
Protected Member Functions | |
USDGEOM_API UsdSchemaKind | _GetSchemaKind () const override |
Protected Member Functions inherited from UsdAPISchemaBase | |
UsdAPISchemaBase (const UsdPrim &prim, const TfToken &instanceName) | |
UsdAPISchemaBase (const UsdSchemaBase &schemaObj, const TfToken &instanceName) | |
const TfToken & | _GetInstanceName () const |
USD_API bool | _IsCompatible () const override |
Protected Member Functions inherited from UsdSchemaBase | |
virtual UsdSchemaKind | _GetSchemaType () const |
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 | |
static USD_API TfTokenVector | _GetMultipleApplyInstanceNames (const UsdPrim &prim, const TfType &schemaType) |
UsdGeomPrimvarsAPI encodes geometric "primitive variables", as UsdGeomPrimvar, which interpolate across a primitive's topology, can override shader inputs, and inherit down namespace.
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.
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.
|
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 |
Destructor.
|
overrideprotectedvirtual |
Returns the kind of schema this class belongs to.
Reimplemented from UsdAPISchemaBase.
USDGEOM_API void UsdGeomPrimvarsAPI::BlockPrimvar | ( | const TfToken & | name | ) |
Remove all time samples on the primvar and its associated indices attr, and author a block default
value. This will cause authored opinions in weaker layers to be ignored.
|
static |
Test whether a given name
contains the "primvars:" prefix
|
inline |
Author scene description to create an attribute and authoring a value
on this prim that will be recognized as an indexed Primvar with indices
appropriately set (i.e. will present as a valid UsdGeomPrimvar).
Definition at line 238 of file primvarsAPI.h.
|
inline |
Author scene description to create an attribute and authoring a value
on this prim that will be recognized as a Primvar (i.e. will present as a valid UsdGeomPrimvar). Note that unlike CreatePrimvar using this API explicitly authors a block for the indices attr associated with the primvar, thereby blocking any indices set in any weaker layers.
Definition at line 210 of file primvarsAPI.h.
USDGEOM_API UsdGeomPrimvar UsdGeomPrimvarsAPI::CreatePrimvar | ( | const TfToken & | name, |
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 name
, 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 name
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.
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::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.
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::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.
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::FindPrimvarsWithInheritance | ( | ) | const |
Find all of the value-producing primvars either defined on this prim, or inherited from ancestor prims.
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::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.
USDGEOM_API UsdGeomPrimvar UsdGeomPrimvarsAPI::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.
USDGEOM_API UsdGeomPrimvar UsdGeomPrimvarsAPI::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.
|
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:
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::GetAuthoredPrimvars | ( | ) | const |
Like GetPrimvars(), but include only primvars that have some authored scene description (though not necessarily a value).
USDGEOM_API UsdGeomPrimvar UsdGeomPrimvarsAPI::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.
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::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().
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::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().
USDGEOM_API std::vector<UsdGeomPrimvar> UsdGeomPrimvarsAPI::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().
|
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 UsdGeomPrimvarsAPI::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.
USDGEOM_API bool UsdGeomPrimvarsAPI::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.
USDGEOM_API bool UsdGeomPrimvarsAPI::RemovePrimvar | ( | const TfToken & | name | ) |
Author scene description to delete an attribute on this prim that was recognized as Primvar (i.e. will present as a valid UsdGeomPrimvar), in the current UsdEditTarget.
Because this method can only remove opinions about the primvar from the current EditTarget, you may generally find it more useful to use BlockPrimvar() which will ensure that all values from the EditTarget and weaker layers for the primvar and its indices will be ignored.
Removal may fail and return false if name
contains a reserved keyword, such as the "indices" suffix we use for indexed primvars.
Note this will also remove the indices attribute associated with an indiced primvar.
|
friend |
Definition at line 141 of file primvarsAPI.h.
|
static |
Compile time constant representing what kind of schema this class is.
Definition at line 88 of file primvarsAPI.h.