HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scope.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_SCOPE_H
8 #define USDGEOM_GENERATED_SCOPE_H
9 
10 /// \file usdGeom/scope.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdGeom/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 
18 #include "pxr/base/vt/value.h"
19 
20 #include "pxr/base/gf/vec3d.h"
21 #include "pxr/base/gf/vec3f.h"
22 #include "pxr/base/gf/matrix4d.h"
23 
24 #include "pxr/base/tf/token.h"
25 #include "pxr/base/tf/type.h"
26 
28 
29 class SdfAssetPath;
30 
31 // -------------------------------------------------------------------------- //
32 // SCOPE //
33 // -------------------------------------------------------------------------- //
34 
35 /// \class UsdGeomScope
36 ///
37 /// Scope is the simplest grouping primitive, and does not carry the
38 /// baggage of transformability. Note that transforms should inherit down
39 /// through a Scope successfully - it is just a guaranteed no-op from a
40 /// transformability perspective.
41 ///
43 {
44 public:
45  /// Compile time constant representing what kind of schema this class is.
46  ///
47  /// \sa UsdSchemaKind
49 
50  /// Construct a UsdGeomScope on UsdPrim \p prim .
51  /// Equivalent to UsdGeomScope::Get(prim.GetStage(), prim.GetPath())
52  /// for a \em valid \p prim, but will not immediately throw an error for
53  /// an invalid \p prim
54  explicit UsdGeomScope(const UsdPrim& prim=UsdPrim())
55  : UsdGeomImageable(prim)
56  {
57  }
58 
59  /// Construct a UsdGeomScope on the prim held by \p schemaObj .
60  /// Should be preferred over UsdGeomScope(schemaObj.GetPrim()),
61  /// as it preserves SchemaBase state.
62  explicit UsdGeomScope(const UsdSchemaBase& schemaObj)
63  : UsdGeomImageable(schemaObj)
64  {
65  }
66 
67  /// Destructor.
69  virtual ~UsdGeomScope();
70 
71  /// Return a vector of names of all pre-declared attributes for this schema
72  /// class and all its ancestor classes. Does not include attributes that
73  /// may be authored by custom/extended methods of the schemas involved.
75  static const TfTokenVector &
76  GetSchemaAttributeNames(bool includeInherited=true);
77 
78  /// Return a UsdGeomScope holding the prim adhering to this
79  /// schema at \p path on \p stage. If no prim exists at \p path on
80  /// \p stage, or if the prim at that path does not adhere to this schema,
81  /// return an invalid schema object. This is shorthand for the following:
82  ///
83  /// \code
84  /// UsdGeomScope(stage->GetPrimAtPath(path));
85  /// \endcode
86  ///
88  static UsdGeomScope
89  Get(const UsdStagePtr &stage, const SdfPath &path);
90 
91  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
92  /// is defined (according to UsdPrim::IsDefined()) on this stage.
93  ///
94  /// If a prim adhering to this schema at \p path is already defined on this
95  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
96  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
97  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
98  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
99  /// current EditTarget for any nonexistent, or existing but not \a Defined
100  /// ancestors.
101  ///
102  /// The given \a path must be an absolute prim path that does not contain
103  /// any variant selections.
104  ///
105  /// If it is impossible to author any of the necessary PrimSpecs, (for
106  /// example, in case \a path cannot map to the current UsdEditTarget's
107  /// namespace) issue an error and return an invalid \a UsdPrim.
108  ///
109  /// Note that this method may return a defined prim whose typeName does not
110  /// specify this schema class, in case a stronger typeName opinion overrides
111  /// the opinion at the current EditTarget.
112  ///
114  static UsdGeomScope
115  Define(const UsdStagePtr &stage, const SdfPath &path);
116 
117 protected:
118  /// Returns the kind of schema this class belongs to.
119  ///
120  /// \sa UsdSchemaKind
122  UsdSchemaKind _GetSchemaKind() const override;
123 
124 private:
125  // needs to invoke _GetStaticTfType.
126  friend class UsdSchemaRegistry;
128  static const TfType &_GetStaticTfType();
129 
130  static bool _IsTypedSchema();
131 
132  // override SchemaBase virtuals.
134  const TfType &_GetTfType() const override;
135 
136 public:
137  // ===================================================================== //
138  // Feel free to add custom code below this line, it will be preserved by
139  // the code generator.
140  //
141  // Just remember to:
142  // - Close the class declaration with };
143  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
144  // - Close the include guard with #endif
145  // ===================================================================== //
146  // --(BEGIN CUSTOM CODE)--
147 };
148 
150 
151 #endif
static USDGEOM_API UsdGeomScope Define(const UsdStagePtr &stage, const SdfPath &path)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static const UsdSchemaKind schemaKind
Definition: scope.h:48
UsdGeomScope(const UsdPrim &prim=UsdPrim())
Definition: scope.h:54
Represents a concrete typed schema.
static USDGEOM_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
#define USDGEOM_API
Definition: api.h:23
static USDGEOM_API UsdGeomScope Get(const UsdStagePtr &stage, const SdfPath &path)
UsdGeomScope(const UsdSchemaBase &schemaObj)
Definition: scope.h:62
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
virtual USDGEOM_API ~UsdGeomScope()
Destructor.