Loading...
Searching...
No Matches
subset.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_SUBSET_H
8#define USDGEOM_GENERATED_SUBSET_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/usdGeom/api.h"
14#include "pxr/usd/usd/typed.h"
15#include "pxr/usd/usd/prim.h"
16#include "pxr/usd/usd/stage.h"
18
19#include "pxr/base/tf/token.h"
23
24
25#include "pxr/base/vt/value.h"
26
27#include "pxr/base/gf/vec3d.h"
28#include "pxr/base/gf/vec3f.h"
30
31#include "pxr/base/tf/token.h"
32#include "pxr/base/tf/type.h"
33
34PXR_NAMESPACE_OPEN_SCOPE
35
36class SdfAssetPath;
37
38// -------------------------------------------------------------------------- //
39// GEOMSUBSET //
40// -------------------------------------------------------------------------- //
41
69class UsdGeomSubset : public UsdTyped
70{
71public:
75 static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
76
81 explicit UsdGeomSubset(const UsdPrim& prim=UsdPrim())
82 : UsdTyped(prim)
83 {
84 }
85
89 explicit UsdGeomSubset(const UsdSchemaBase& schemaObj)
90 : UsdTyped(schemaObj)
91 {
92 }
93
95 USDGEOM_API
96 virtual ~UsdGeomSubset();
97
101 USDGEOM_API
102 static const TfTokenVector &
103 GetSchemaAttributeNames(bool includeInherited=true);
104
114 USDGEOM_API
115 static UsdGeomSubset
116 Get(const UsdStagePtr &stage, const SdfPath &path);
117
140 USDGEOM_API
141 static UsdGeomSubset
142 Define(const UsdStagePtr &stage, const SdfPath &path);
143
144protected:
148 USDGEOM_API
150
151private:
152 // needs to invoke _GetStaticTfType.
153 friend class UsdSchemaRegistry;
154 USDGEOM_API
155 static const TfType &_GetStaticTfType();
156
157 static bool _IsTypedSchema();
158
159 // override SchemaBase virtuals.
160 USDGEOM_API
161 const TfType &_GetTfType() const override;
162
163public:
164 // --------------------------------------------------------------------- //
165 // ELEMENTTYPE
166 // --------------------------------------------------------------------- //
196 USDGEOM_API
198
204 USDGEOM_API
205 UsdAttribute CreateElementTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
206
207public:
208 // --------------------------------------------------------------------- //
209 // INDICES
210 // --------------------------------------------------------------------- //
221 USDGEOM_API
223
229 USDGEOM_API
230 UsdAttribute CreateIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
231
232public:
233 // --------------------------------------------------------------------- //
234 // FAMILYNAME
235 // --------------------------------------------------------------------- //
267 USDGEOM_API
269
275 USDGEOM_API
276 UsdAttribute CreateFamilyNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
277
278public:
279 // ===================================================================== //
280 // Feel free to add custom code below this line, it will be preserved by
281 // the code generator.
282 //
283 // Just remember to:
284 // - Close the class declaration with };
285 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
286 // - Close the include guard with #endif
287 // ===================================================================== //
288 // --(BEGIN CUSTOM CODE)--
289
299 USDGEOM_API
301 const UsdGeomImageable &geom,
302 const TfToken &subsetName,
303 const TfToken &elementType,
304 const VtIntArray &indices,
305 const TfToken &familyName=TfToken(),
306 const TfToken &familyType=TfToken());
307
317 USDGEOM_API
319 const UsdGeomImageable &geom,
320 const TfToken &subsetName,
321 const TfToken &elementType,
322 const VtIntArray &indices,
323 const TfToken &familyName=TfToken(),
324 const TfToken &familyType=TfToken());
325
327 USDGEOM_API
328 static std::vector<UsdGeomSubset> GetAllGeomSubsets(
329 const UsdGeomImageable &geom);
330
337 USDGEOM_API
338 static std::vector<UsdGeomSubset> GetGeomSubsets(
339 const UsdGeomImageable &geom,
340 const TfToken &elementType=TfToken(),
341 const TfToken &familyName=TfToken());
342
345 USDGEOM_API
347 const UsdGeomImageable &geom);
348
364 USDGEOM_API
365 static bool SetFamilyType(
366 const UsdGeomImageable &geom,
367 const TfToken &familyName,
368 const TfToken &familyType);
369
379 USDGEOM_API
381 const UsdGeomImageable &geom,
382 const TfToken &familyName);
383
396 USDGEOM_API
397 static VtIntArray GetUnassignedIndices(
398 const UsdGeomImageable &geom,
399 const TfToken &elementType,
400 const TfToken &familyName,
402
409 USDGEOM_API
410 static VtIntArray GetUnassignedIndices(
411 const std::vector<UsdGeomSubset> &subsets,
412 const size_t elementCount,
414
431 USDGEOM_API
432 static bool ValidateSubsets(
433 const std::vector<UsdGeomSubset> &subsets,
434 const size_t elementCount,
435 const TfToken &familyType,
436 std::string * const reason);
437
452 USDGEOM_API
453 static bool ValidateFamily(
454 const UsdGeomImageable &geom,
455 const TfToken &elementType,
456 const TfToken &familyName,
457 std::string * const reason);
458
459private:
464 VtVec2iArray _GetEdges(const UsdTimeCode t) const;
465};
466
467PXR_NAMESPACE_CLOSE_SCOPE
468
469#endif
Contains an asset path and an optional resolved path.
Definition: assetPath.h:30
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
std::set< TfToken, TfTokenFastArbitraryLessThan > Set
Predefined type for set of tokens, for when faster lookup is desired, without paying the memory or in...
Definition: token.h:166
TfType represents a dynamic runtime type.
Definition: type.h:48
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:159
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:58
Encodes a subset of a piece of geometry (i.e.
Definition: subset.h:70
static USDGEOM_API std::vector< UsdGeomSubset > GetAllGeomSubsets(const UsdGeomImageable &geom)
Returns all the GeomSubsets defined on the given imageable, geom.
UsdGeomSubset(const UsdSchemaBase &schemaObj)
Construct a UsdGeomSubset on the prim held by schemaObj .
Definition: subset.h:89
USDGEOM_API UsdAttribute CreateElementTypeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetElementTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: subset.h:75
static USDGEOM_API UsdGeomSubset Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomSubset holding the prim adhering to this schema at path on stage.
static USDGEOM_API bool ValidateFamily(const UsdGeomImageable &geom, const TfToken &elementType, const TfToken &familyName, std::string *const reason)
Validates whether the family of subsets identified by the given familyName and elementType on the giv...
static USDGEOM_API bool ValidateSubsets(const std::vector< UsdGeomSubset > &subsets, const size_t elementCount, const TfToken &familyType, std::string *const reason)
static USDGEOM_API UsdGeomSubset Define(const UsdStagePtr &stage, const SdfPath &path)
Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefin...
static USDGEOM_API TfToken GetFamilyType(const UsdGeomImageable &geom, const TfToken &familyName)
Returns the type of family that the GeomSubsets on the given geometric prim geom, with the given fami...
static USDGEOM_API UsdGeomSubset CreateGeomSubset(const UsdGeomImageable &geom, const TfToken &subsetName, const TfToken &elementType, const VtIntArray &indices, const TfToken &familyName=TfToken(), const TfToken &familyType=TfToken())
Creates a new GeomSubset below the given geom with the given name, subsetName, element type,...
static USDGEOM_API VtIntArray GetUnassignedIndices(const std::vector< UsdGeomSubset > &subsets, const size_t elementCount, const UsdTimeCode &time=UsdTimeCode::EarliestTime())
UsdGeomSubset(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomSubset on UsdPrim prim .
Definition: subset.h:81
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USDGEOM_API UsdAttribute GetElementTypeAttr() const
The type of element that the indices target.
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...
static USDGEOM_API TfToken::Set GetAllGeomSubsetFamilyNames(const UsdGeomImageable &geom)
Returns the names of all the families of GeomSubsets defined on the given imageable,...
USDGEOM_API UsdAttribute CreateFamilyNameAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetFamilyNameAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdAttribute CreateIndicesAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
static USDGEOM_API UsdGeomSubset CreateUniqueGeomSubset(const UsdGeomImageable &geom, const TfToken &subsetName, const TfToken &elementType, const VtIntArray &indices, const TfToken &familyName=TfToken(), const TfToken &familyType=TfToken())
Creates a new GeomSubset below the given imageable, geom with the given name, subsetName,...
static USDGEOM_API std::vector< UsdGeomSubset > GetGeomSubsets(const UsdGeomImageable &geom, const TfToken &elementType=TfToken(), const TfToken &familyName=TfToken())
Returns all the GeomSubsets of the given elementType belonging to the specified family,...
static USDGEOM_API VtIntArray GetUnassignedIndices(const UsdGeomImageable &geom, const TfToken &elementType, const TfToken &familyName, const UsdTimeCode &time=UsdTimeCode::EarliestTime())
Utility for getting the list of indices that are not assigned to any of the GeomSubsets in the family...
static USDGEOM_API bool SetFamilyType(const UsdGeomImageable &geom, const TfToken &familyName, const TfToken &familyType)
This method is used to encode the type of family that the GeomSubsets on the given geometric prim geo...
USDGEOM_API UsdAttribute GetIndicesAttr() const
The set of indices included in this subset.
USDGEOM_API UsdAttribute GetFamilyNameAttr() const
The name of the family of subsets that this subset belongs to.
virtual USDGEOM_API ~UsdGeomSubset()
Destructor.
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:67
static constexpr UsdTimeCode EarliestTime()
Produce a UsdTimeCode representing the lowest/earliest possible timeCode.
Definition: timeCode.h:84
The base class for all typed schemas (those that can impart a typeName to a UsdPrim),...
Definition: typed.h:45
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
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