All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
34 #include "pxr/usd/usdGeom/tokens.h"
35 
36 #include "pxr/base/tf/token.h"
37 #include "pxr/usd/usdGeom/imageable.h"
38 
39 
40 #include "pxr/base/vt/value.h"
41 
42 #include "pxr/base/gf/vec3d.h"
43 #include "pxr/base/gf/vec3f.h"
44 #include "pxr/base/gf/matrix4d.h"
45 
46 #include "pxr/base/tf/token.h"
47 #include "pxr/base/tf/type.h"
48 
49 PXR_NAMESPACE_OPEN_SCOPE
50 
51 class SdfAssetPath;
52 
53 // -------------------------------------------------------------------------- //
54 // GEOMSUBSET //
55 // -------------------------------------------------------------------------- //
56 
85 class UsdGeomSubset : public UsdTyped
86 {
87 public:
92 
97  explicit UsdGeomSubset(const UsdPrim& prim=UsdPrim())
98  : UsdTyped(prim)
99  {
100  }
101 
105  explicit UsdGeomSubset(const UsdSchemaBase& schemaObj)
106  : UsdTyped(schemaObj)
107  {
108  }
109 
111  USDGEOM_API
112  virtual ~UsdGeomSubset();
113 
117  USDGEOM_API
118  static const TfTokenVector &
119  GetSchemaAttributeNames(bool includeInherited=true);
120 
130  USDGEOM_API
131  static UsdGeomSubset
132  Get(const UsdStagePtr &stage, const SdfPath &path);
133 
156  USDGEOM_API
157  static UsdGeomSubset
158  Define(const UsdStagePtr &stage, const SdfPath &path);
159 
160 protected:
164  USDGEOM_API
165  UsdSchemaType _GetSchemaType() const override;
166 
167 private:
168  // needs to invoke _GetStaticTfType.
169  friend class UsdSchemaRegistry;
170  USDGEOM_API
171  static const TfType &_GetStaticTfType();
172 
173  static bool _IsTypedSchema();
174 
175  // override SchemaBase virtuals.
176  USDGEOM_API
177  const TfType &_GetTfType() const override;
178 
179 public:
180  // --------------------------------------------------------------------- //
181  // ELEMENTTYPE
182  // --------------------------------------------------------------------- //
191  USDGEOM_API
193 
199  USDGEOM_API
200  UsdAttribute CreateElementTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
201 
202 public:
203  // --------------------------------------------------------------------- //
204  // INDICES
205  // --------------------------------------------------------------------- //
213  USDGEOM_API
215 
221  USDGEOM_API
222  UsdAttribute CreateIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
223 
224 public:
225  // --------------------------------------------------------------------- //
226  // FAMILYNAME
227  // --------------------------------------------------------------------- //
256  USDGEOM_API
258 
264  USDGEOM_API
265  UsdAttribute CreateFamilyNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
266 
267 public:
268  // ===================================================================== //
269  // Feel free to add custom code below this line, it will be preserved by
270  // the code generator.
271  //
272  // Just remember to:
273  // - Close the class declaration with };
274  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
275  // - Close the include guard with #endif
276  // ===================================================================== //
277  // --(BEGIN CUSTOM CODE)--
278 
288  USDGEOM_API
290  const UsdGeomImageable &geom,
291  const TfToken &subsetName,
292  const TfToken &elementType,
293  const VtIntArray &indices,
294  const TfToken &familyName=TfToken(),
295  const TfToken &familyType=TfToken());
296 
306  USDGEOM_API
308  const UsdGeomImageable &geom,
309  const TfToken &subsetName,
310  const TfToken &elementType,
311  const VtIntArray &indices,
312  const TfToken &familyName=TfToken(),
313  const TfToken &familyType=TfToken());
314 
316  USDGEOM_API
317  static std::vector<UsdGeomSubset> GetAllGeomSubsets(
318  const UsdGeomImageable &geom);
319 
326  USDGEOM_API
327  static std::vector<UsdGeomSubset> GetGeomSubsets(
328  const UsdGeomImageable &geom,
329  const TfToken &elementType=TfToken(),
330  const TfToken &familyName=TfToken());
331 
334  USDGEOM_API
336  const UsdGeomImageable &geom);
337 
353  USDGEOM_API
354  static bool SetFamilyType(
355  const UsdGeomImageable &geom,
356  const TfToken &familyName,
357  const TfToken &familyType);
358 
368  USDGEOM_API
369  static TfToken GetFamilyType(
370  const UsdGeomImageable &geom,
371  const TfToken &familyName);
372 
377  USDGEOM_API
378  static VtIntArray GetUnassignedIndices(
379  const std::vector<UsdGeomSubset> &subsets,
380  const size_t elementCount,
381  const UsdTimeCode &time=UsdTimeCode::EarliestTime());
382 
398  USDGEOM_API
399  static bool ValidateSubsets(
400  const std::vector<UsdGeomSubset> &subsets,
401  const size_t elementCount,
402  const TfToken &familyType,
403  std::string * const reason);
404 
419  USDGEOM_API
420  static bool ValidateFamily(
421  const UsdGeomImageable &geom,
422  const TfToken &elementType,
423  const TfToken &familyName,
424  std::string * const reason);
425 };
426 
427 PXR_NAMESPACE_CLOSE_SCOPE
428 
429 #endif
static USDGEOM_API VtIntArray GetUnassignedIndices(const std::vector< UsdGeomSubset > &subsets, const size_t elementCount, const UsdTimeCode &time=UsdTimeCode::EarliestTime())
Utility for getting the list of indices that are not assigned to any of the GeomSubsets in subsets at...
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, familyName on the given imageable, geom.
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:105
static constexpr UsdTimeCode EarliestTime()
Produce a UsdTimeCode representing the lowest/earliest possible timeCode.
Definition: timeCode.h:102
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 const UsdSchemaType schemaType
Compile time constant representing what kind of schema this class is.
Definition: subset.h:91
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...
UsdGeomSubset(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomSubset on UsdPrim prim .
Definition: subset.h:97
USDGEOM_API UsdSchemaType _GetSchemaType() const override
Returns the type of schema this class belongs to.
static USDGEOM_API TfToken::Set GetAllGeomSubsetFamilyNames(const UsdGeomImageable &geom)
Returns the names of all the families of GeomSubsets defined on the given imageable, geom.
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
Represents a concrete typed schema.
USDGEOM_API UsdAttribute GetElementTypeAttr() const
The type of element that the indices target.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
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:185
virtual USDGEOM_API ~UsdGeomSubset()
Destructor.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
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...
UsdSchemaType
An enum representing which type of schema a given schema class belongs to.
Definition: common.h:149
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
The base class for all typed schemas (those that can impart a typeName to a UsdPrim), and therefore the base class for all instantiable and &quot;IsA&quot; schemas.
Definition: typed.h:47
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
static USDGEOM_API bool ValidateSubsets(const std::vector< UsdGeomSubset > &subsets, const size_t elementCount, const TfToken &familyType, std::string *const reason)
Validates the data in the given set of GeomSubsets, subsets, given the total number of elements in th...
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.
Contains an asset path and an optional resolved path.
Definition: assetPath.h:43
Encodes a subset of a piece of geometry (i.e.
Definition: subset.h:85
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 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, element type, elementType and indices.
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...
TfType represents a dynamic runtime type.
Definition: type.h:70
Singleton registry that provides access to prim and property definition information for registered Us...
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 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 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 UsdGeomSubset Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomSubset holding the prim adhering to this schema at path on stage. ...
The base class for all schema types in Usd.
Definition: schemaBase.h:56
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:74
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...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:182