HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scene.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 USDPHYSICS_GENERATED_SCENE_H
8 #define USDPHYSICS_GENERATED_SCENE_H
9 
10 /// \file usdPhysics/scene.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdPhysics/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/vt/value.h"
20 
21 #include "pxr/base/gf/vec3d.h"
22 #include "pxr/base/gf/vec3f.h"
23 #include "pxr/base/gf/matrix4d.h"
24 
25 #include "pxr/base/tf/token.h"
26 #include "pxr/base/tf/type.h"
27 
29 
30 class SdfAssetPath;
31 
32 // -------------------------------------------------------------------------- //
33 // PHYSICSSCENE //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdPhysicsScene
37 ///
38 /// General physics simulation properties, required for simulation.
39 ///
40 class UsdPhysicsScene : public UsdTyped
41 {
42 public:
43  /// Compile time constant representing what kind of schema this class is.
44  ///
45  /// \sa UsdSchemaKind
47 
48  /// Construct a UsdPhysicsScene on UsdPrim \p prim .
49  /// Equivalent to UsdPhysicsScene::Get(prim.GetStage(), prim.GetPath())
50  /// for a \em valid \p prim, but will not immediately throw an error for
51  /// an invalid \p prim
52  explicit UsdPhysicsScene(const UsdPrim& prim=UsdPrim())
53  : UsdTyped(prim)
54  {
55  }
56 
57  /// Construct a UsdPhysicsScene on the prim held by \p schemaObj .
58  /// Should be preferred over UsdPhysicsScene(schemaObj.GetPrim()),
59  /// as it preserves SchemaBase state.
60  explicit UsdPhysicsScene(const UsdSchemaBase& schemaObj)
61  : UsdTyped(schemaObj)
62  {
63  }
64 
65  /// Destructor.
67  virtual ~UsdPhysicsScene();
68 
69  /// Return a vector of names of all pre-declared attributes for this schema
70  /// class and all its ancestor classes. Does not include attributes that
71  /// may be authored by custom/extended methods of the schemas involved.
73  static const TfTokenVector &
74  GetSchemaAttributeNames(bool includeInherited=true);
75 
76  /// Return a UsdPhysicsScene holding the prim adhering to this
77  /// schema at \p path on \p stage. If no prim exists at \p path on
78  /// \p stage, or if the prim at that path does not adhere to this schema,
79  /// return an invalid schema object. This is shorthand for the following:
80  ///
81  /// \code
82  /// UsdPhysicsScene(stage->GetPrimAtPath(path));
83  /// \endcode
84  ///
86  static UsdPhysicsScene
87  Get(const UsdStagePtr &stage, const SdfPath &path);
88 
89  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
90  /// is defined (according to UsdPrim::IsDefined()) on this stage.
91  ///
92  /// If a prim adhering to this schema at \p path is already defined on this
93  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
94  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
95  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
96  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
97  /// current EditTarget for any nonexistent, or existing but not \a Defined
98  /// ancestors.
99  ///
100  /// The given \a path must be an absolute prim path that does not contain
101  /// any variant selections.
102  ///
103  /// If it is impossible to author any of the necessary PrimSpecs, (for
104  /// example, in case \a path cannot map to the current UsdEditTarget's
105  /// namespace) issue an error and return an invalid \a UsdPrim.
106  ///
107  /// Note that this method may return a defined prim whose typeName does not
108  /// specify this schema class, in case a stronger typeName opinion overrides
109  /// the opinion at the current EditTarget.
110  ///
112  static UsdPhysicsScene
113  Define(const UsdStagePtr &stage, const SdfPath &path);
114 
115 protected:
116  /// Returns the kind of schema this class belongs to.
117  ///
118  /// \sa UsdSchemaKind
120  UsdSchemaKind _GetSchemaKind() const override;
121 
122 private:
123  // needs to invoke _GetStaticTfType.
124  friend class UsdSchemaRegistry;
126  static const TfType &_GetStaticTfType();
127 
128  static bool _IsTypedSchema();
129 
130  // override SchemaBase virtuals.
132  const TfType &_GetTfType() const override;
133 
134 public:
135  // --------------------------------------------------------------------- //
136  // GRAVITYDIRECTION
137  // --------------------------------------------------------------------- //
138  /// Gravity direction vector in simulation world space. Will be
139  /// normalized before use. A zero vector is a request to use the negative
140  /// upAxis. Unitless.
141  ///
142  /// | ||
143  /// | -- | -- |
144  /// | Declaration | `vector3f physics:gravityDirection = (0, 0, 0)` |
145  /// | C++ Type | GfVec3f |
146  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Vector3f |
149 
150  /// See GetGravityDirectionAttr(), and also
151  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
152  /// If specified, author \p defaultValue as the attribute's default,
153  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
154  /// the default for \p writeSparsely is \c false.
156  UsdAttribute CreateGravityDirectionAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
157 
158 public:
159  // --------------------------------------------------------------------- //
160  // GRAVITYMAGNITUDE
161  // --------------------------------------------------------------------- //
162  /// Gravity acceleration magnitude in simulation world space.
163  /// A negative value is a request to use a value equivalent to earth
164  /// gravity regardless of the metersPerUnit scaling used by this scene.
165  /// Units: distance/second/second.
166  ///
167  /// | ||
168  /// | -- | -- |
169  /// | Declaration | `float physics:gravityMagnitude = -inf` |
170  /// | C++ Type | float |
171  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
174 
175  /// See GetGravityMagnitudeAttr(), and also
176  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
177  /// If specified, author \p defaultValue as the attribute's default,
178  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
179  /// the default for \p writeSparsely is \c false.
181  UsdAttribute CreateGravityMagnitudeAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
182 
183 public:
184  // ===================================================================== //
185  // Feel free to add custom code below this line, it will be preserved by
186  // the code generator.
187  //
188  // Just remember to:
189  // - Close the class declaration with };
190  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
191  // - Close the include guard with #endif
192  // ===================================================================== //
193  // --(BEGIN CUSTOM CODE)--
194 };
195 
197 
198 #endif
UsdPhysicsScene(const UsdPrim &prim=UsdPrim())
Definition: scene.h:52
USDPHYSICS_API UsdAttribute GetGravityMagnitudeAttr() const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDPHYSICS_API UsdAttribute CreateGravityDirectionAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
USDPHYSICS_API UsdAttribute CreateGravityMagnitudeAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
static USDPHYSICS_API UsdPhysicsScene Define(const UsdStagePtr &stage, const SdfPath &path)
UsdPhysicsScene(const UsdSchemaBase &schemaObj)
Definition: scene.h:60
Represents a concrete typed schema.
static const UsdSchemaKind schemaKind
Definition: scene.h:46
Definition: prim.h:116
Definition: typed.h:44
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
USDPHYSICS_API UsdSchemaKind _GetSchemaKind() const override
static USDPHYSICS_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
#define USDPHYSICS_API
Definition: api.h:23
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
virtual USDPHYSICS_API ~UsdPhysicsScene()
Destructor.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
static USDPHYSICS_API UsdPhysicsScene Get(const UsdStagePtr &stage, const SdfPath &path)
Definition: type.h:47
USDPHYSICS_API UsdAttribute GetGravityDirectionAttr() const
Definition: value.h:146