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 USDPHYSICS_GENERATED_SPHERICALJOINT_H
25 #define USDPHYSICS_GENERATED_SPHERICALJOINT_H
26 
27 /// \file usdPhysics/sphericalJoint.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdPhysics/api.h"
31 #include "pxr/usd/usdPhysics/joint.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdPhysics/tokens.h"
35 
36 #include "pxr/base/vt/value.h"
37 
38 #include "pxr/base/gf/vec3d.h"
39 #include "pxr/base/gf/vec3f.h"
40 #include "pxr/base/gf/matrix4d.h"
41 
42 #include "pxr/base/tf/token.h"
43 #include "pxr/base/tf/type.h"
44 
45 PXR_NAMESPACE_OPEN_SCOPE
46 
47 class SdfAssetPath;
48 
49 // -------------------------------------------------------------------------- //
50 // PHYSICSSPHERICALJOINT                                                      //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdPhysicsSphericalJoint
54 ///
55 /// Predefined spherical joint type (Removes linear degrees of
56 /// freedom, cone limit may restrict the motion in a given range.) It allows
57 /// two limit values, which when equal create a circular, else an elliptic
58 /// cone limit around the limit axis.
59 ///
60 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
61 /// that are text/tokens, the actual token is published and defined in \ref UsdPhysicsTokens.
62 /// So to set an attribute to the value "rightHanded", use UsdPhysicsTokens->rightHanded
63 /// as the value.
64 ///
65 class UsdPhysicsSphericalJoint : public UsdPhysicsJoint
66 {
67 public:
68     /// Compile time constant representing what kind of schema this class is.
69     ///
70     /// \sa UsdSchemaKind
71     static const UsdSchemaKind schemaKind = UsdSchemaKind::ConcreteTyped;
72 
73     /// Construct a UsdPhysicsSphericalJoint on UsdPrim \p prim .
74     /// Equivalent to UsdPhysicsSphericalJoint::Get(prim.GetStage(), prim.GetPath())
75     /// for a \em valid \p prim, but will not immediately throw an error for
76     /// an invalid \p prim
77     explicit UsdPhysicsSphericalJoint(const UsdPrim& prim=UsdPrim())
UsdPhysicsJoint(prim)78         : UsdPhysicsJoint(prim)
79     {
80     }
81 
82     /// Construct a UsdPhysicsSphericalJoint on the prim held by \p schemaObj .
83     /// Should be preferred over UsdPhysicsSphericalJoint(schemaObj.GetPrim()),
84     /// as it preserves SchemaBase state.
UsdPhysicsSphericalJoint(const UsdSchemaBase & schemaObj)85     explicit UsdPhysicsSphericalJoint(const UsdSchemaBase& schemaObj)
86         : UsdPhysicsJoint(schemaObj)
87     {
88     }
89 
90     /// Destructor.
91     USDPHYSICS_API
92     virtual ~UsdPhysicsSphericalJoint();
93 
94     /// Return a vector of names of all pre-declared attributes for this schema
95     /// class and all its ancestor classes.  Does not include attributes that
96     /// may be authored by custom/extended methods of the schemas involved.
97     USDPHYSICS_API
98     static const TfTokenVector &
99     GetSchemaAttributeNames(bool includeInherited=true);
100 
101     /// Return a UsdPhysicsSphericalJoint holding the prim adhering to this
102     /// schema at \p path on \p stage.  If no prim exists at \p path on
103     /// \p stage, or if the prim at that path does not adhere to this schema,
104     /// return an invalid schema object.  This is shorthand for the following:
105     ///
106     /// \code
107     /// UsdPhysicsSphericalJoint(stage->GetPrimAtPath(path));
108     /// \endcode
109     ///
110     USDPHYSICS_API
111     static UsdPhysicsSphericalJoint
112     Get(const UsdStagePtr &stage, const SdfPath &path);
113 
114     /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
115     /// is defined (according to UsdPrim::IsDefined()) on this stage.
116     ///
117     /// If a prim adhering to this schema at \p path is already defined on this
118     /// stage, return that prim.  Otherwise author an \a SdfPrimSpec with
119     /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
120     /// the prim at \p path at the current EditTarget.  Author \a SdfPrimSpec s
121     /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
122     /// current EditTarget for any nonexistent, or existing but not \a Defined
123     /// ancestors.
124     ///
125     /// The given \a path must be an absolute prim path that does not contain
126     /// any variant selections.
127     ///
128     /// If it is impossible to author any of the necessary PrimSpecs, (for
129     /// example, in case \a path cannot map to the current UsdEditTarget's
130     /// namespace) issue an error and return an invalid \a UsdPrim.
131     ///
132     /// Note that this method may return a defined prim whose typeName does not
133     /// specify this schema class, in case a stronger typeName opinion overrides
134     /// the opinion at the current EditTarget.
135     ///
136     USDPHYSICS_API
137     static UsdPhysicsSphericalJoint
138     Define(const UsdStagePtr &stage, const SdfPath &path);
139 
140 protected:
141     /// Returns the kind of schema this class belongs to.
142     ///
143     /// \sa UsdSchemaKind
144     USDPHYSICS_API
145     UsdSchemaKind _GetSchemaKind() const override;
146 
147 private:
148     // needs to invoke _GetStaticTfType.
149     friend class UsdSchemaRegistry;
150     USDPHYSICS_API
151     static const TfType &_GetStaticTfType();
152 
153     static bool _IsTypedSchema();
154 
155     // override SchemaBase virtuals.
156     USDPHYSICS_API
157     const TfType &_GetTfType() const override;
158 
159 public:
160     // --------------------------------------------------------------------- //
161     // AXIS
162     // --------------------------------------------------------------------- //
163     /// Cone limit axis.
164     ///
165     /// | ||
166     /// | -- | -- |
167     /// | Declaration | `uniform token physics:axis = "X"` |
168     /// | C++ Type | TfToken |
169     /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
170     /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
171     /// | \ref UsdPhysicsTokens "Allowed Values" | X, Y, Z |
172     USDPHYSICS_API
173     UsdAttribute GetAxisAttr() const;
174 
175     /// See GetAxisAttr(), 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.
180     USDPHYSICS_API
181     UsdAttribute CreateAxisAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
182 
183 public:
184     // --------------------------------------------------------------------- //
185     // CONEANGLE0LIMIT
186     // --------------------------------------------------------------------- //
187     /// Cone limit from the primary joint axis in the local0 frame
188     /// toward the next axis. (Next axis of X is Y, and of Z is X.) A
189     /// negative value means not limited. Units: degrees.
190     ///
191     /// | ||
192     /// | -- | -- |
193     /// | Declaration | `float physics:coneAngle0Limit = -1` |
194     /// | C++ Type | float |
195     /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
196     USDPHYSICS_API
197     UsdAttribute GetConeAngle0LimitAttr() const;
198 
199     /// See GetConeAngle0LimitAttr(), and also
200     /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
201     /// If specified, author \p defaultValue as the attribute's default,
202     /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
203     /// the default for \p writeSparsely is \c false.
204     USDPHYSICS_API
205     UsdAttribute CreateConeAngle0LimitAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
206 
207 public:
208     // --------------------------------------------------------------------- //
209     // CONEANGLE1LIMIT
210     // --------------------------------------------------------------------- //
211     /// Cone limit from the primary joint axis in the local0 frame
212     /// toward the second to next axis. A negative value means not limited.
213     /// Units: degrees.
214     ///
215     /// | ||
216     /// | -- | -- |
217     /// | Declaration | `float physics:coneAngle1Limit = -1` |
218     /// | C++ Type | float |
219     /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Float |
220     USDPHYSICS_API
221     UsdAttribute GetConeAngle1LimitAttr() const;
222 
223     /// See GetConeAngle1LimitAttr(), and also
224     /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
225     /// If specified, author \p defaultValue as the attribute's default,
226     /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
227     /// the default for \p writeSparsely is \c false.
228     USDPHYSICS_API
229     UsdAttribute CreateConeAngle1LimitAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
230 
231 public:
232     // ===================================================================== //
233     // Feel free to add custom code below this line, it will be preserved by
234     // the code generator.
235     //
236     // Just remember to:
237     //  - Close the class declaration with };
238     //  - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
239     //  - Close the include guard with #endif
240     // ===================================================================== //
241     // --(BEGIN CUSTOM CODE)--
242 };
243 
244 PXR_NAMESPACE_CLOSE_SCOPE
245 
246 #endif
247