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"
24
25
26#include "pxr/base/vt/value.h"
27
28#include "pxr/base/gf/vec3d.h"
29#include "pxr/base/gf/vec3f.h"
31
32#include "pxr/base/tf/token.h"
33#include "pxr/base/tf/type.h"
34
35PXR_NAMESPACE_OPEN_SCOPE
36
37class SdfAssetPath;
38
39// -------------------------------------------------------------------------- //
40// GEOMSUBSET //
41// -------------------------------------------------------------------------- //
42
70class UsdGeomSubset : public UsdTyped
71{
72public:
76 static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
77
82 explicit UsdGeomSubset(const UsdPrim& prim=UsdPrim())
83 : UsdTyped(prim)
84 {
85 }
86
90 explicit UsdGeomSubset(const UsdSchemaBase& schemaObj)
91 : UsdTyped(schemaObj)
92 {
93 }
94
96 USDGEOM_API
97 virtual ~UsdGeomSubset();
98
102 USDGEOM_API
103 static const TfTokenVector &
104 GetSchemaAttributeNames(bool includeInherited=true);
105
115 USDGEOM_API
116 static UsdGeomSubset
117 Get(const UsdStagePtr &stage, const SdfPath &path);
118
141 USDGEOM_API
142 static UsdGeomSubset
143 Define(const UsdStagePtr &stage, const SdfPath &path);
144
145protected:
149 USDGEOM_API
151
152private:
153 // needs to invoke _GetStaticTfType.
154 friend class UsdSchemaRegistry;
155 USDGEOM_API
156 static const TfType &_GetStaticTfType();
157
158 static bool _IsTypedSchema();
159
160 // override SchemaBase virtuals.
161 USDGEOM_API
162 const TfType &_GetTfType() const override;
163
164public:
165 // --------------------------------------------------------------------- //
166 // ELEMENTTYPE
167 // --------------------------------------------------------------------- //
203 USDGEOM_API
205
211 USDGEOM_API
212 UsdAttribute CreateElementTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
213
214public:
215 // --------------------------------------------------------------------- //
216 // INDICES
217 // --------------------------------------------------------------------- //
229 USDGEOM_API
231
237 USDGEOM_API
238 UsdAttribute CreateIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
239
240public:
241 // --------------------------------------------------------------------- //
242 // FAMILYNAME
243 // --------------------------------------------------------------------- //
275 USDGEOM_API
277
283 USDGEOM_API
284 UsdAttribute CreateFamilyNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
285
286public:
287 // ===================================================================== //
288 // Feel free to add custom code below this line, it will be preserved by
289 // the code generator.
290 //
291 // Just remember to:
292 // - Close the class declaration with };
293 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
294 // - Close the include guard with #endif
295 // ===================================================================== //
296 // --(BEGIN CUSTOM CODE)--
297
307 USDGEOM_API
309 const UsdGeomImageable &geom,
310 const TfToken &subsetName,
311 const TfToken &elementType,
312 const VtIntArray &indices,
313 const TfToken &familyName=TfToken(),
314 const TfToken &familyType=TfToken());
315
325 USDGEOM_API
327 const UsdGeomImageable &geom,
328 const TfToken &subsetName,
329 const TfToken &elementType,
330 const VtIntArray &indices,
331 const TfToken &familyName=TfToken(),
332 const TfToken &familyType=TfToken());
333
335 USDGEOM_API
336 static std::vector<UsdGeomSubset> GetAllGeomSubsets(
337 const UsdGeomImageable &geom);
338
345 USDGEOM_API
346 static std::vector<UsdGeomSubset> GetGeomSubsets(
347 const UsdGeomImageable &geom,
348 const TfToken &elementType=TfToken(),
349 const TfToken &familyName=TfToken());
350
353 USDGEOM_API
355 const UsdGeomImageable &geom);
356
372 USDGEOM_API
373 static bool SetFamilyType(
374 const UsdGeomImageable &geom,
375 const TfToken &familyName,
376 const TfToken &familyType);
377
387 USDGEOM_API
389 const UsdGeomImageable &geom,
390 const TfToken &familyName);
391
404 USDGEOM_API
405 static VtIntArray GetUnassignedIndices(
406 const UsdGeomImageable &geom,
407 const TfToken &elementType,
408 const TfToken &familyName,
410
417 USDGEOM_API
418 static VtIntArray GetUnassignedIndices(
419 const std::vector<UsdGeomSubset> &subsets,
420 const size_t elementCount,
422
439 USDGEOM_API
440 static bool ValidateSubsets(
441 const std::vector<UsdGeomSubset> &subsets,
442 const size_t elementCount,
443 const TfToken &familyType,
444 std::string * const reason);
445
460 USDGEOM_API
461 static bool ValidateFamily(
462 const UsdGeomImageable &geom,
463 const TfToken &elementType,
464 const TfToken &familyName,
465 std::string * const reason);
466
467private:
474 VtVec2iArray _GetIndexPairs(const UsdTimeCode t, bool preserveOrder) const;
475};
476
477PXR_NAMESPACE_CLOSE_SCOPE
478
479#endif
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:79
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:281
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:183
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:71
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:90
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:76
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:82
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 identifying elements 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:72
static constexpr UsdTimeCode EarliestTime()
Produce a UsdTimeCode representing the lowest/earliest possible timeCode.
Definition: timeCode.h:102
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:90
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