All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 // --------------------------------------------------------------------- //
202 USDGEOM_API
204
210 USDGEOM_API
211 UsdAttribute CreateElementTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
212
213public:
214 // --------------------------------------------------------------------- //
215 // INDICES
216 // --------------------------------------------------------------------- //
227 USDGEOM_API
229
235 USDGEOM_API
236 UsdAttribute CreateIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
237
238public:
239 // --------------------------------------------------------------------- //
240 // FAMILYNAME
241 // --------------------------------------------------------------------- //
273 USDGEOM_API
275
281 USDGEOM_API
282 UsdAttribute CreateFamilyNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
283
284public:
285 // ===================================================================== //
286 // Feel free to add custom code below this line, it will be preserved by
287 // the code generator.
288 //
289 // Just remember to:
290 // - Close the class declaration with };
291 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
292 // - Close the include guard with #endif
293 // ===================================================================== //
294 // --(BEGIN CUSTOM CODE)--
295
305 USDGEOM_API
307 const UsdGeomImageable &geom,
308 const TfToken &subsetName,
309 const TfToken &elementType,
310 const VtIntArray &indices,
311 const TfToken &familyName=TfToken(),
312 const TfToken &familyType=TfToken());
313
323 USDGEOM_API
325 const UsdGeomImageable &geom,
326 const TfToken &subsetName,
327 const TfToken &elementType,
328 const VtIntArray &indices,
329 const TfToken &familyName=TfToken(),
330 const TfToken &familyType=TfToken());
331
333 USDGEOM_API
334 static std::vector<UsdGeomSubset> GetAllGeomSubsets(
335 const UsdGeomImageable &geom);
336
343 USDGEOM_API
344 static std::vector<UsdGeomSubset> GetGeomSubsets(
345 const UsdGeomImageable &geom,
346 const TfToken &elementType=TfToken(),
347 const TfToken &familyName=TfToken());
348
351 USDGEOM_API
353 const UsdGeomImageable &geom);
354
370 USDGEOM_API
371 static bool SetFamilyType(
372 const UsdGeomImageable &geom,
373 const TfToken &familyName,
374 const TfToken &familyType);
375
385 USDGEOM_API
387 const UsdGeomImageable &geom,
388 const TfToken &familyName);
389
402 USDGEOM_API
403 static VtIntArray GetUnassignedIndices(
404 const UsdGeomImageable &geom,
405 const TfToken &elementType,
406 const TfToken &familyName,
408
415 USDGEOM_API
416 static VtIntArray GetUnassignedIndices(
417 const std::vector<UsdGeomSubset> &subsets,
418 const size_t elementCount,
420
437 USDGEOM_API
438 static bool ValidateSubsets(
439 const std::vector<UsdGeomSubset> &subsets,
440 const size_t elementCount,
441 const TfToken &familyType,
442 std::string * const reason);
443
458 USDGEOM_API
459 static bool ValidateFamily(
460 const UsdGeomImageable &geom,
461 const TfToken &elementType,
462 const TfToken &familyName,
463 std::string * const reason);
464
465private:
472 VtVec2iArray _GetIndexPairs(const UsdTimeCode t, bool preserveOrder) const;
473};
474
475PXR_NAMESPACE_CLOSE_SCOPE
476
477#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:160
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 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