Loading...
Searching...
No Matches
primvarsAPI.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef USDGEOM_GENERATED_PRIMVARSAPI_H
8#define USDGEOM_GENERATED_PRIMVARSAPI_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdGeom/api.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
17
18#include "pxr/usd/usdGeom/primvar.h"
19
20#include "pxr/base/vt/value.h"
21
22#include "pxr/base/gf/vec3d.h"
23#include "pxr/base/gf/vec3f.h"
25
26#include "pxr/base/tf/token.h"
27#include "pxr/base/tf/type.h"
28
29PXR_NAMESPACE_OPEN_SCOPE
30
31class SdfAssetPath;
32
33// -------------------------------------------------------------------------- //
34// PRIMVARSAPI //
35// -------------------------------------------------------------------------- //
36
66{
67public:
71 static const UsdSchemaKind schemaKind = UsdSchemaKind::NonAppliedAPI;
72
77 explicit UsdGeomPrimvarsAPI(const UsdPrim& prim=UsdPrim())
78 : UsdAPISchemaBase(prim)
79 {
80 }
81
85 explicit UsdGeomPrimvarsAPI(const UsdSchemaBase& schemaObj)
86 : UsdAPISchemaBase(schemaObj)
87 {
88 }
89
91 USDGEOM_API
93
97 USDGEOM_API
98 static const TfTokenVector &
99 GetSchemaAttributeNames(bool includeInherited=true);
100
110 USDGEOM_API
111 static UsdGeomPrimvarsAPI
112 Get(const UsdStagePtr &stage, const SdfPath &path);
113
114
115protected:
119 USDGEOM_API
121
122private:
123 // needs to invoke _GetStaticTfType.
124 friend class UsdSchemaRegistry;
125 USDGEOM_API
126 static const TfType &_GetStaticTfType();
127
128 static bool _IsTypedSchema();
129
130 // override SchemaBase virtuals.
131 USDGEOM_API
132 const TfType &_GetTfType() const override;
133
134public:
135 // ===================================================================== //
136 // Feel free to add custom code below this line, it will be preserved by
137 // the code generator.
138 //
139 // Just remember to:
140 // - Close the class declaration with };
141 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
142 // - Close the include guard with #endif
143 // ===================================================================== //
144 // --(BEGIN CUSTOM CODE)--
145
173 USDGEOM_API
175 const SdfValueTypeName &typeName,
176 const TfToken& interpolation = TfToken(),
177 int elementSize = -1) const;
178
192 template <typename T>
194 const TfToken& name,
195 const SdfValueTypeName &typeName,
196 const T &value,
197 const TfToken &interpolation = TfToken(),
198 int elementSize = -1,
199 UsdTimeCode time = UsdTimeCode::Default()) const
200 {
201 UsdGeomPrimvar primvar =
202 CreatePrimvar(name, typeName, interpolation, elementSize);
203
204 primvar.GetAttr().Set(value, time);
205 primvar.BlockIndices();
206 return primvar;
207 }
208
220 template <typename T>
222 const TfToken& name,
223 const SdfValueTypeName &typeName,
224 const T &value,
225 const VtIntArray &indices,
226 const TfToken &interpolation = TfToken(),
227 int elementSize = -1,
228 UsdTimeCode time = UsdTimeCode::Default()) const
229 {
230 UsdGeomPrimvar primvar =
231 CreatePrimvar(name, typeName, interpolation, elementSize);
232
233 primvar.GetAttr().Set(value, time);
234 primvar.SetIndices(indices, time);
235 return primvar;
236 }
237
257 USDGEOM_API
258 bool RemovePrimvar(const TfToken& name);
259
265 USDGEOM_API
266 void BlockPrimvar(const TfToken& name);
267
284 USDGEOM_API
286
296 USDGEOM_API
297 std::vector<UsdGeomPrimvar> GetPrimvars() const;
298
303 USDGEOM_API
304 std::vector<UsdGeomPrimvar> GetAuthoredPrimvars() const;
305
313 USDGEOM_API
314 std::vector<UsdGeomPrimvar> GetPrimvarsWithValues() const;
315
323 USDGEOM_API
324 std::vector<UsdGeomPrimvar> GetPrimvarsWithAuthoredValues() const;
325
341 USDGEOM_API
342 std::vector<UsdGeomPrimvar> FindInheritablePrimvars() const;
343
362 USDGEOM_API
363 std::vector<UsdGeomPrimvar> FindIncrementallyInheritablePrimvars(
364 const std::vector<UsdGeomPrimvar> &inheritedFromAncestors) const;
365
379 USDGEOM_API
381
390 USDGEOM_API
392 const std::vector<UsdGeomPrimvar> &inheritedFromAncestors) const;
393
398 USDGEOM_API
399 std::vector<UsdGeomPrimvar> FindPrimvarsWithInheritance() const;
400
409 USDGEOM_API
410 std::vector<UsdGeomPrimvar> FindPrimvarsWithInheritance(
411 const std::vector<UsdGeomPrimvar> &inheritedFromAncestors) const;
412
419 USDGEOM_API
420 bool HasPrimvar(const TfToken &name) const;
421
429 USDGEOM_API
430 bool HasPossiblyInheritedPrimvar(const TfToken &name) const;
431
434 USDGEOM_API
435 static bool CanContainPropertyName(const TfToken& name);
436};
437
438PXR_NAMESPACE_CLOSE_SCOPE
439
440#endif
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:78
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Represents a value type name, i.e.
Definition: valueTypeName.h:72
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfType represents a dynamic runtime type.
Definition: type.h:48
The base class for all API schemas.
Definition: apiSchemaBase.h:99
bool Set(const T &value, UsdTimeCode time=UsdTimeCode::Default()) const
Set the value of this attribute in the current UsdEditTarget to value at UsdTimeCode time,...
Definition: attribute.h:511
Schema wrapper for UsdAttribute for authoring and introspecting attributes that are primvars.
Definition: primvar.h:248
USDGEOM_API bool SetIndices(const VtIntArray &indices, UsdTimeCode time=UsdTimeCode::Default()) const
Sets the indices value of the indexed primvar at time.
UsdAttribute const & GetAttr() const
Explicit UsdAttribute extractor.
Definition: primvar.h:386
USDGEOM_API void BlockIndices() const
Block the indices that were previously set.
UsdGeomPrimvarsAPI encodes geometric "primitive variables", as UsdGeomPrimvar, which interpolate acro...
Definition: primvarsAPI.h:66
USDGEOM_API void BlockPrimvar(const TfToken &name)
Remove all time samples on the primvar and its associated indices attr, and author a block default va...
USDGEOM_API std::vector< UsdGeomPrimvar > GetPrimvarsWithValues() const
Like GetPrimvars(), but include only primvars that have some value, whether it comes from authored sc...
USDGEOM_API std::vector< UsdGeomPrimvar > GetPrimvars() const
Return valid UsdGeomPrimvar objects for all defined Primvars on this prim, similarly to UsdPrim::GetA...
USDGEOM_API std::vector< UsdGeomPrimvar > FindPrimvarsWithInheritance() const
Find all of the value-producing primvars either defined on this prim, or inherited from ancestor prim...
USDGEOM_API UsdGeomPrimvar GetPrimvar(const TfToken &name) const
Return the Primvar object named by name, which will be valid if a Primvar attribute definition alread...
USDGEOM_API std::vector< UsdGeomPrimvar > GetPrimvarsWithAuthoredValues() const
Like GetPrimvars(), but include only primvars that have an authored value.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: primvarsAPI.h:71
virtual USDGEOM_API ~UsdGeomPrimvarsAPI()
Destructor.
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 o...
UsdGeomPrimvar CreateIndexedPrimvar(const TfToken &name, const SdfValueTypeName &typeName, const T &value, const VtIntArray &indices, const TfToken &interpolation=TfToken(), int elementSize=-1, UsdTimeCode time=UsdTimeCode::Default()) const
Author scene description to create an attribute and authoring a value on this prim that will be recog...
Definition: primvarsAPI.h:221
USDGEOM_API UsdGeomPrimvar 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....
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
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,...
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 cl...
USDGEOM_API bool RemovePrimvar(const TfToken &name)
Author scene description to delete an attribute on this prim that was recognized as Primvar (i....
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 o...
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.
USDGEOM_API std::vector< UsdGeomPrimvar > FindInheritablePrimvars() const
Compute the primvars that can be inherited from this prim by its child prims, including the primvars ...
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?
UsdGeomPrimvarsAPI(const UsdSchemaBase &schemaObj)
Construct a UsdGeomPrimvarsAPI on the prim held by schemaObj .
Definition: primvarsAPI.h:85
USDGEOM_API std::vector< UsdGeomPrimvar > GetAuthoredPrimvars() const
Like GetPrimvars(), but include only primvars that have some authored scene description (though not n...
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 o...
USDGEOM_API bool HasPrimvar(const TfToken &name) const
Is there a defined Primvar name on this prim?
UsdGeomPrimvarsAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomPrimvarsAPI on UsdPrim prim .
Definition: primvarsAPI.h:77
UsdGeomPrimvar CreateNonIndexedPrimvar(const TfToken &name, const SdfValueTypeName &typeName, const T &value, const TfToken &interpolation=TfToken(), int elementSize=-1, UsdTimeCode time=UsdTimeCode::Default()) const
Author scene description to create an attribute and authoring a value on this prim that will be recog...
Definition: primvarsAPI.h:193
static USDGEOM_API bool CanContainPropertyName(const TfToken &name)
Test whether a given name contains the "primvars:" prefix.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
The base class for all schema types in Usd.
Definition: schemaBase.h:39
Singleton registry that provides access to schema type information and the prim definitions for regis...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:72
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:113
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440