|
| 1 | +// Copyright 2025 DeepMind Technologies Limited |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#ifndef MJCPHYSICS_GENERATED_EQUALITYCONNECTAPI_H |
| 16 | +#define MJCPHYSICS_GENERATED_EQUALITYCONNECTAPI_H |
| 17 | + |
| 18 | +/// \file mjcPhysics/equalityConnectAPI.h |
| 19 | + |
| 20 | +#include <mujoco/experimental/usd/mjcPhysics/api.h> |
| 21 | +#include <pxr/base/gf/matrix4d.h> |
| 22 | +#include <pxr/base/gf/vec3d.h> |
| 23 | +#include <pxr/base/gf/vec3f.h> |
| 24 | +#include <pxr/base/tf/token.h> |
| 25 | +#include <pxr/base/tf/type.h> |
| 26 | +#include <pxr/base/vt/value.h> |
| 27 | +#include <pxr/pxr.h> |
| 28 | +#include <pxr/usd/usd/apiSchemaBase.h> |
| 29 | +#include <pxr/usd/usd/prim.h> |
| 30 | +#include <pxr/usd/usd/stage.h> |
| 31 | + |
| 32 | +PXR_NAMESPACE_OPEN_SCOPE |
| 33 | + |
| 34 | +class SdfAssetPath; |
| 35 | + |
| 36 | +// -------------------------------------------------------------------------- // |
| 37 | +// MJCEQUALITYCONNECTAPI // |
| 38 | +// -------------------------------------------------------------------------- // |
| 39 | + |
| 40 | +/// \class MjcPhysicsEqualityConnectAPI |
| 41 | +/// |
| 42 | +/// API providing extension attributes to represent equality/connect |
| 43 | +/// constraints. |
| 44 | +/// |
| 45 | +class MjcPhysicsEqualityConnectAPI : public UsdAPISchemaBase { |
| 46 | + public: |
| 47 | + /// Compile time constant representing what kind of schema this class is. |
| 48 | + /// |
| 49 | + /// \sa UsdSchemaKind |
| 50 | + static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI; |
| 51 | + |
| 52 | + /// Construct a MjcPhysicsEqualityConnectAPI on UsdPrim \p prim . |
| 53 | + /// Equivalent to MjcPhysicsEqualityConnectAPI::Get(prim.GetStage(), |
| 54 | + /// prim.GetPath()) for a \em valid \p prim, but will not immediately throw an |
| 55 | + /// error for an invalid \p prim |
| 56 | + explicit MjcPhysicsEqualityConnectAPI(const UsdPrim& prim = UsdPrim()) |
| 57 | + : UsdAPISchemaBase(prim) {} |
| 58 | + |
| 59 | + /// Construct a MjcPhysicsEqualityConnectAPI on the prim held by \p schemaObj |
| 60 | + /// . Should be preferred over |
| 61 | + /// MjcPhysicsEqualityConnectAPI(schemaObj.GetPrim()), as it preserves |
| 62 | + /// SchemaBase state. |
| 63 | + explicit MjcPhysicsEqualityConnectAPI(const UsdSchemaBase& schemaObj) |
| 64 | + : UsdAPISchemaBase(schemaObj) {} |
| 65 | + |
| 66 | + /// Destructor. |
| 67 | + MJCPHYSICS_API |
| 68 | + virtual ~MjcPhysicsEqualityConnectAPI(); |
| 69 | + |
| 70 | + /// Return a vector of names of all pre-declared attributes for this schema |
| 71 | + /// class and all its ancestor classes. Does not include attributes that |
| 72 | + /// may be authored by custom/extended methods of the schemas involved. |
| 73 | + MJCPHYSICS_API |
| 74 | + static const TfTokenVector& GetSchemaAttributeNames( |
| 75 | + bool includeInherited = true); |
| 76 | + |
| 77 | + /// Return a MjcPhysicsEqualityConnectAPI holding the prim adhering to this |
| 78 | + /// schema at \p path on \p stage. If no prim exists at \p path on |
| 79 | + /// \p stage, or if the prim at that path does not adhere to this schema, |
| 80 | + /// return an invalid schema object. This is shorthand for the following: |
| 81 | + /// |
| 82 | + /// \code |
| 83 | + /// MjcPhysicsEqualityConnectAPI(stage->GetPrimAtPath(path)); |
| 84 | + /// \endcode |
| 85 | + /// |
| 86 | + MJCPHYSICS_API |
| 87 | + static MjcPhysicsEqualityConnectAPI Get(const UsdStagePtr& stage, |
| 88 | + const SdfPath& path); |
| 89 | + |
| 90 | + /// Returns true if this <b>single-apply</b> API schema can be applied to |
| 91 | + /// the given \p prim. If this schema can not be a applied to the prim, |
| 92 | + /// this returns false and, if provided, populates \p whyNot with the |
| 93 | + /// reason it can not be applied. |
| 94 | + /// |
| 95 | + /// Note that if CanApply returns false, that does not necessarily imply |
| 96 | + /// that calling Apply will fail. Callers are expected to call CanApply |
| 97 | + /// before calling Apply if they want to ensure that it is valid to |
| 98 | + /// apply a schema. |
| 99 | + /// |
| 100 | + /// \sa UsdPrim::GetAppliedSchemas() |
| 101 | + /// \sa UsdPrim::HasAPI() |
| 102 | + /// \sa UsdPrim::CanApplyAPI() |
| 103 | + /// \sa UsdPrim::ApplyAPI() |
| 104 | + /// \sa UsdPrim::RemoveAPI() |
| 105 | + /// |
| 106 | + MJCPHYSICS_API |
| 107 | + static bool CanApply(const UsdPrim& prim, std::string* whyNot = nullptr); |
| 108 | + |
| 109 | + /// Applies this <b>single-apply</b> API schema to the given \p prim. |
| 110 | + /// This information is stored by adding "MjcEqualityConnectAPI" to the |
| 111 | + /// token-valued, listOp metadata \em apiSchemas on the prim. |
| 112 | + /// |
| 113 | + /// \return A valid MjcPhysicsEqualityConnectAPI object is returned upon |
| 114 | + /// success. An invalid (or empty) MjcPhysicsEqualityConnectAPI object is |
| 115 | + /// returned upon failure. See \ref UsdPrim::ApplyAPI() for conditions |
| 116 | + /// resulting in failure. |
| 117 | + /// |
| 118 | + /// \sa UsdPrim::GetAppliedSchemas() |
| 119 | + /// \sa UsdPrim::HasAPI() |
| 120 | + /// \sa UsdPrim::CanApplyAPI() |
| 121 | + /// \sa UsdPrim::ApplyAPI() |
| 122 | + /// \sa UsdPrim::RemoveAPI() |
| 123 | + /// |
| 124 | + MJCPHYSICS_API |
| 125 | + static MjcPhysicsEqualityConnectAPI Apply(const UsdPrim& prim); |
| 126 | + |
| 127 | + protected: |
| 128 | + /// Returns the kind of schema this class belongs to. |
| 129 | + /// |
| 130 | + /// \sa UsdSchemaKind |
| 131 | + MJCPHYSICS_API |
| 132 | + UsdSchemaKind _GetSchemaKind() const override; |
| 133 | + |
| 134 | + private: |
| 135 | + // needs to invoke _GetStaticTfType. |
| 136 | + friend class UsdSchemaRegistry; |
| 137 | + MJCPHYSICS_API |
| 138 | + static const TfType& _GetStaticTfType(); |
| 139 | + |
| 140 | + static bool _IsTypedSchema(); |
| 141 | + |
| 142 | + // override SchemaBase virtuals. |
| 143 | + MJCPHYSICS_API |
| 144 | + const TfType& _GetTfType() const override; |
| 145 | + |
| 146 | + public: |
| 147 | + // ===================================================================== // |
| 148 | + // Feel free to add custom code below this line, it will be preserved by |
| 149 | + // the code generator. |
| 150 | + // |
| 151 | + // Just remember to: |
| 152 | + // - Close the class declaration with }; |
| 153 | + // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE |
| 154 | + // - Close the include guard with #endif |
| 155 | + // ===================================================================== // |
| 156 | + // --(BEGIN CUSTOM CODE)-- |
| 157 | +}; |
| 158 | + |
| 159 | +PXR_NAMESPACE_CLOSE_SCOPE |
| 160 | + |
| 161 | +#endif |
0 commit comments