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"
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  UsdSchemaKind _GetSchemaKind() 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  // --------------------------------------------------------------------- //
193  USDGEOM_API
195 
201  USDGEOM_API
202  UsdAttribute CreateElementTypeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
203 
204 public:
205  // --------------------------------------------------------------------- //
206  // INDICES
207  // --------------------------------------------------------------------- //
216  USDGEOM_API
218 
224  USDGEOM_API
225  UsdAttribute CreateIndicesAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
226 
227 public:
228  // --------------------------------------------------------------------- //
229  // FAMILYNAME
230  // --------------------------------------------------------------------- //
261  USDGEOM_API
263 
269  USDGEOM_API
270  UsdAttribute CreateFamilyNameAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
271 
272 public:
273  // ===================================================================== //
274  // Feel free to add custom code below this line, it will be preserved by
275  // the code generator.
276  //
277  // Just remember to:
278  // - Close the class declaration with };
279  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
280  // - Close the include guard with #endif
281  // ===================================================================== //
282  // --(BEGIN CUSTOM CODE)--
283 
293  USDGEOM_API
295  const UsdGeomImageable &geom,
296  const TfToken &subsetName,
297  const TfToken &elementType,
298  const VtIntArray &indices,
299  const TfToken &familyName=TfToken(),
300  const TfToken &familyType=TfToken());
301 
311  USDGEOM_API
313  const UsdGeomImageable &geom,
314  const TfToken &subsetName,
315  const TfToken &elementType,
316  const VtIntArray &indices,
317  const TfToken &familyName=TfToken(),
318  const TfToken &familyType=TfToken());
319 
321  USDGEOM_API
322  static std::vector<UsdGeomSubset> GetAllGeomSubsets(
323  const UsdGeomImageable &geom);
324 
331  USDGEOM_API
332  static std::vector<UsdGeomSubset> GetGeomSubsets(
333  const UsdGeomImageable &geom,
334  const TfToken &elementType=TfToken(),
335  const TfToken &familyName=TfToken());
336 
339  USDGEOM_API
341  const UsdGeomImageable &geom);
342 
358  USDGEOM_API
359  static bool SetFamilyType(
360  const UsdGeomImageable &geom,
361  const TfToken &familyName,
362  const TfToken &familyType);
363 
373  USDGEOM_API
374  static TfToken GetFamilyType(
375  const UsdGeomImageable &geom,
376  const TfToken &familyName);
377 
382  USDGEOM_API
383  static VtIntArray GetUnassignedIndices(
384  const std::vector<UsdGeomSubset> &subsets,
385  const size_t elementCount,
386  const UsdTimeCode &time=UsdTimeCode::EarliestTime());
387 
403  USDGEOM_API
404  static bool ValidateSubsets(
405  const std::vector<UsdGeomSubset> &subsets,
406  const size_t elementCount,
407  const TfToken &familyType,
408  std::string * const reason);
409 
424  USDGEOM_API
425  static bool ValidateFamily(
426  const UsdGeomImageable &geom,
427  const TfToken &elementType,
428  const TfToken &familyName,
429  std::string * const reason);
430 };
431 
432 PXR_NAMESPACE_CLOSE_SCOPE
433 
434 #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...
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
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
USDGEOM_API UsdAttribute GetElementTypeAttr() const
The type of element that the indices target.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:127
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
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
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...
Represents a concrete typed schema.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:132
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:442
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
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...
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: subset.h:91
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.
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
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:64
Singleton registry that provides access to schema type information and the prim definitions for regis...
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:168
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...