Loading...
Searching...
No Matches
subset.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef USDGEOM_GENERATED_SUBSET_H
25#define USDGEOM_GENERATED_SUBSET_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/usdGeom/api.h"
31#include "pxr/usd/usd/typed.h"
32#include "pxr/usd/usd/prim.h"
33#include "pxr/usd/usd/stage.h"
35
36#include "pxr/base/tf/token.h"
40
41
42#include "pxr/base/vt/value.h"
43
44#include "pxr/base/gf/vec3d.h"
45#include "pxr/base/gf/vec3f.h"
47
48#include "pxr/base/tf/token.h"
49#include "pxr/base/tf/type.h"
50
51PXR_NAMESPACE_OPEN_SCOPE
52
53class SdfAssetPath;
54
55// -------------------------------------------------------------------------- //
56// GEOMSUBSET //
57// -------------------------------------------------------------------------- //
58
86class UsdGeomSubset : public UsdTyped
87{
88public:
92 static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
93
98 explicit UsdGeomSubset(const UsdPrim& prim=UsdPrim())
99 : UsdTyped(prim)
100 {
101 }
102
106 explicit UsdGeomSubset(const UsdSchemaBase& schemaObj)
107 : UsdTyped(schemaObj)
108 {
109 }
110
112 USDGEOM_API
113 virtual ~UsdGeomSubset();
114
118 USDGEOM_API
119 static const TfTokenVector &
120 GetSchemaAttributeNames(bool includeInherited=true);
121
131 USDGEOM_API
132 static UsdGeomSubset
133 Get(const UsdStagePtr &stage, const SdfPath &path);
134
157 USDGEOM_API
158 static UsdGeomSubset
159 Define(const UsdStagePtr &stage, const SdfPath &path);
160
161protected:
165 USDGEOM_API
167
168private:
169 // needs to invoke _GetStaticTfType.
170 friend class UsdSchemaRegistry;
171 USDGEOM_API
172 static const TfType &_GetStaticTfType();
173
174 static bool _IsTypedSchema();
175
176 // override SchemaBase virtuals.
177 USDGEOM_API
178 const TfType &_GetTfType() const override;
179
180public:
181 // --------------------------------------------------------------------- //
182 // ELEMENTTYPE
183 // --------------------------------------------------------------------- //
213 USDGEOM_API
215
221 USDGEOM_API
222 UsdAttribute CreateElementTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
223
224public:
225 // --------------------------------------------------------------------- //
226 // INDICES
227 // --------------------------------------------------------------------- //
238 USDGEOM_API
240
246 USDGEOM_API
247 UsdAttribute CreateIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
248
249public:
250 // --------------------------------------------------------------------- //
251 // FAMILYNAME
252 // --------------------------------------------------------------------- //
284 USDGEOM_API
286
292 USDGEOM_API
293 UsdAttribute CreateFamilyNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
294
295public:
296 // ===================================================================== //
297 // Feel free to add custom code below this line, it will be preserved by
298 // the code generator.
299 //
300 // Just remember to:
301 // - Close the class declaration with };
302 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
303 // - Close the include guard with #endif
304 // ===================================================================== //
305 // --(BEGIN CUSTOM CODE)--
306
316 USDGEOM_API
318 const UsdGeomImageable &geom,
319 const TfToken &subsetName,
320 const TfToken &elementType,
321 const VtIntArray &indices,
322 const TfToken &familyName=TfToken(),
323 const TfToken &familyType=TfToken());
324
334 USDGEOM_API
336 const UsdGeomImageable &geom,
337 const TfToken &subsetName,
338 const TfToken &elementType,
339 const VtIntArray &indices,
340 const TfToken &familyName=TfToken(),
341 const TfToken &familyType=TfToken());
342
344 USDGEOM_API
345 static std::vector<UsdGeomSubset> GetAllGeomSubsets(
346 const UsdGeomImageable &geom);
347
354 USDGEOM_API
355 static std::vector<UsdGeomSubset> GetGeomSubsets(
356 const UsdGeomImageable &geom,
357 const TfToken &elementType=TfToken(),
358 const TfToken &familyName=TfToken());
359
362 USDGEOM_API
364 const UsdGeomImageable &geom);
365
381 USDGEOM_API
382 static bool SetFamilyType(
383 const UsdGeomImageable &geom,
384 const TfToken &familyName,
385 const TfToken &familyType);
386
396 USDGEOM_API
398 const UsdGeomImageable &geom,
399 const TfToken &familyName);
400
413 USDGEOM_API
414 static VtIntArray GetUnassignedIndices(
415 const UsdGeomImageable &geom,
416 const TfToken &elementType,
417 const TfToken &familyName,
419
426 USDGEOM_API
427 static VtIntArray GetUnassignedIndices(
428 const std::vector<UsdGeomSubset> &subsets,
429 const size_t elementCount,
431
448 USDGEOM_API
449 static bool ValidateSubsets(
450 const std::vector<UsdGeomSubset> &subsets,
451 const size_t elementCount,
452 const TfToken &familyType,
453 std::string * const reason);
454
469 USDGEOM_API
470 static bool ValidateFamily(
471 const UsdGeomImageable &geom,
472 const TfToken &elementType,
473 const TfToken &familyName,
474 std::string * const reason);
475
476private:
481 VtVec2iArray _GetEdges(const UsdTimeCode t) const;
482};
483
484PXR_NAMESPACE_CLOSE_SCOPE
485
486#endif
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
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:183
TfType represents a dynamic runtime type.
Definition: type.h:65
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:176
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:75
Encodes a subset of a piece of geometry (i.e.
Definition: subset.h:87
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:106
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:92
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:98
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:134
The base class for all schema types in Usd.
Definition: schemaBase.h:56
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:84
static constexpr UsdTimeCode EarliestTime()
Produce a UsdTimeCode representing the lowest/earliest possible timeCode.
Definition: timeCode.h:101
The base class for all typed schemas (those that can impart a typeName to a UsdPrim),...
Definition: typed.h:62
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:164
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:129
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:457