Loading...
Searching...
No Matches
xformCommonAPI.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_XFORMCOMMONAPI_H
25#define USDGEOM_GENERATED_XFORMCOMMONAPI_H
26
28
29#include "pxr/pxr.h"
30#include "pxr/usd/usdGeom/api.h"
32#include "pxr/usd/usd/prim.h"
33#include "pxr/usd/usd/stage.h"
35
38
39#include "pxr/base/vt/value.h"
40
41#include "pxr/base/gf/vec3d.h"
42#include "pxr/base/gf/vec3f.h"
44
45#include "pxr/base/tf/token.h"
46#include "pxr/base/tf/type.h"
47
48PXR_NAMESPACE_OPEN_SCOPE
49
50class SdfAssetPath;
51
52// -------------------------------------------------------------------------- //
53// XFORMCOMMONAPI //
54// -------------------------------------------------------------------------- //
55
90{
91public:
95 static const UsdSchemaKind schemaKind = UsdSchemaKind::NonAppliedAPI;
96
101 explicit UsdGeomXformCommonAPI(const UsdPrim& prim=UsdPrim())
102 : UsdAPISchemaBase(prim)
103 {
104 }
105
109 explicit UsdGeomXformCommonAPI(const UsdSchemaBase& schemaObj)
110 : UsdAPISchemaBase(schemaObj)
111 {
112 }
113
115 USDGEOM_API
117
121 USDGEOM_API
122 static const TfTokenVector &
123 GetSchemaAttributeNames(bool includeInherited=true);
124
134 USDGEOM_API
136 Get(const UsdStagePtr &stage, const SdfPath &path);
137
138
139protected:
143 USDGEOM_API
145
146private:
147 // needs to invoke _GetStaticTfType.
148 friend class UsdSchemaRegistry;
149 USDGEOM_API
150 static const TfType &_GetStaticTfType();
151
152 static bool _IsTypedSchema();
153
154 // override SchemaBase virtuals.
155 USDGEOM_API
156 const TfType &_GetTfType() const override;
157
158public:
159 // ===================================================================== //
160 // Feel free to add custom code below this line, it will be preserved by
161 // the code generator.
162 //
163 // Just remember to:
164 // - Close the class declaration with };
165 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
166 // - Close the include guard with #endif
167 // ===================================================================== //
168 // --(BEGIN CUSTOM CODE)--
169
172 RotationOrderXYZ,
173 RotationOrderXZY,
174 RotationOrderYXZ,
175 RotationOrderYZX,
176 RotationOrderZXY,
177 RotationOrderZYX
178 };
179
182 enum OpFlags {
183 OpNone = 0,
184 OpTranslate = 1,
185 OpPivot = 2,
186 OpRotate = 4,
187 OpScale = 8,
188 };
189
194 struct Ops {
195 UsdGeomXformOp translateOp;
196 UsdGeomXformOp pivotOp;
197 UsdGeomXformOp rotateOp;
198 UsdGeomXformOp scaleOp;
199 UsdGeomXformOp inversePivotOp;
200 };
201
214 USDGEOM_API
215 bool SetXformVectors(const GfVec3d &translation,
216 const GfVec3f &rotation,
217 const GfVec3f &scale,
218 const GfVec3f &pivot,
219 RotationOrder rotOrder,
220 const UsdTimeCode time) const;
221
232 USDGEOM_API
233 bool GetXformVectors(GfVec3d *translation,
234 GfVec3f *rotation,
235 GfVec3f *scale,
236 GfVec3f *pivot,
237 RotationOrder *rotOrder,
238 const UsdTimeCode time) const;
239
256 USDGEOM_API
258 GfVec3f* rotation,
259 GfVec3f* scale,
260 GfVec3f* pivot,
262 const UsdTimeCode time) const;
263
266 USDGEOM_API
267 bool GetResetXformStack() const;
268
273
275 USDGEOM_API
276 bool SetTranslate(const GfVec3d &translation,
277 const UsdTimeCode time=UsdTimeCode::Default()) const;
278
280 USDGEOM_API
281 bool SetPivot(const GfVec3f &pivot,
282 const UsdTimeCode time=UsdTimeCode::Default()) const;
283
285 USDGEOM_API
286 bool SetRotate(const GfVec3f &rotation,
287 UsdGeomXformCommonAPI::RotationOrder rotOrder=RotationOrderXYZ,
288 const UsdTimeCode time=UsdTimeCode::Default()) const;
289
291 USDGEOM_API
292 bool SetScale(const GfVec3f &scale,
293 const UsdTimeCode time=UsdTimeCode::Default()) const;
294
297 USDGEOM_API
298 bool SetResetXformStack(bool resetXformStack) const;
299
309 USDGEOM_API
311 RotationOrder rotOrder,
312 OpFlags op1=OpNone,
313 OpFlags op2=OpNone,
314 OpFlags op3=OpNone,
315 OpFlags op4=OpNone) const;
316
323 USDGEOM_API
325 OpFlags op1=OpNone,
326 OpFlags op2=OpNone,
327 OpFlags op3=OpNone,
328 OpFlags op4=OpNone) const;
329
331
334
340 USDGEOM_API
342 const GfVec3f &rotation,
343 const UsdGeomXformCommonAPI::RotationOrder rotationOrder);
344
346
351 USDGEOM_API
353 RotationOrder rotOrder);
354
360 USDGEOM_API
362 UsdGeomXformOp::Type opType);
363
367 USDGEOM_API
369 UsdGeomXformOp::Type opType);
370
371protected:
373 USDGEOM_API
374 bool _IsCompatible() const override;
375};
376
377
378PXR_NAMESPACE_CLOSE_SCOPE
379
380#endif
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Basic type for a vector of 3 double components.
Definition: vec3d.h:63
Basic type for a vector of 3 float components.
Definition: vec3f.h:63
Contains an asset path and an optional resolved path.
Definition: assetPath.h:47
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:291
TfType represents a dynamic runtime type.
Definition: type.h:65
The base class for all API schemas.
This class provides API for authoring and retrieving a standard set of component transformations whic...
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
static USDGEOM_API RotationOrder ConvertOpTypeToRotationOrder(UsdGeomXformOp::Type opType)
Converts the given opType to the corresponding value in the UsdGeomXformCommonAPI::RotationOrder enum...
static USDGEOM_API bool CanConvertOpTypeToRotationOrder(UsdGeomXformOp::Type opType)
Whether the given opType has a corresponding value in the UsdGeomXformCommonAPI::RotationOrder enum (...
USDGEOM_API bool GetXformVectorsByAccumulation(GfVec3d *translation, GfVec3f *rotation, GfVec3f *scale, GfVec3f *pivot, UsdGeomXformCommonAPI::RotationOrder *rotOrder, const UsdTimeCode time) const
Retrieve values of the various component xformOps at a given time.
USDGEOM_API bool GetResetXformStack() const
Returns whether the xformable resets the transform stack.
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USDGEOM_API bool SetScale(const GfVec3f &scale, const UsdTimeCode time=UsdTimeCode::Default()) const
Set scale at time to scale.
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...
OpFlags
Enumerates the categories of ops that can be handled by XformCommonAPI.
USDGEOM_API Ops CreateXformOps(OpFlags op1=OpNone, OpFlags op2=OpNone, OpFlags op3=OpNone, OpFlags op4=OpNone) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDGEOM_API bool SetPivot(const GfVec3f &pivot, const UsdTimeCode time=UsdTimeCode::Default()) const
Set pivot position at time to pivot.
static USDGEOM_API UsdGeomXformCommonAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomXformCommonAPI holding the prim adhering to this schema at path on stage.
USDGEOM_API bool GetXformVectors(GfVec3d *translation, GfVec3f *rotation, GfVec3f *scale, GfVec3f *pivot, RotationOrder *rotOrder, const UsdTimeCode time) const
Retrieve values of the various component xformOps at a given time.
UsdGeomXformCommonAPI(const UsdSchemaBase &schemaObj)
Construct a UsdGeomXformCommonAPI on the prim held by schemaObj .
USDGEOM_API bool SetResetXformStack(bool resetXformStack) const
Set whether the xformable resets the transform stack.
static USDGEOM_API GfMatrix4d GetRotationTransform(const GfVec3f &rotation, const UsdGeomXformCommonAPI::RotationOrder rotationOrder)
Return the 4x4 matrix that applies the rotation encoded by rotation vector rotation using the rotatio...
UsdGeomXformCommonAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomXformCommonAPI on UsdPrim prim .
USDGEOM_API bool SetRotate(const GfVec3f &rotation, UsdGeomXformCommonAPI::RotationOrder rotOrder=RotationOrderXYZ, const UsdTimeCode time=UsdTimeCode::Default()) const
Set rotation at time to rotation.
virtual USDGEOM_API ~UsdGeomXformCommonAPI()
Destructor.
static USDGEOM_API UsdGeomXformOp::Type ConvertRotationOrderToOpType(RotationOrder rotOrder)
Converts the given rotOrder to the corresponding value in the UsdGeomXformOp::Type enum.
USDGEOM_API bool SetXformVectors(const GfVec3d &translation, const GfVec3f &rotation, const GfVec3f &scale, const GfVec3f &pivot, RotationOrder rotOrder, const UsdTimeCode time) const
Set values for the various component xformOps at a given time.
RotationOrder
Enumerates the rotation order of the 3-angle Euler rotation.
USDGEOM_API Ops CreateXformOps(RotationOrder rotOrder, OpFlags op1=OpNone, OpFlags op2=OpNone, OpFlags op3=OpNone, OpFlags op4=OpNone) const
Creates the specified XformCommonAPI-compatible xform ops, or returns the existing ops if they alread...
USDGEOM_API bool SetTranslate(const GfVec3d &translation, const UsdTimeCode time=UsdTimeCode::Default()) const
Set translation at time to translation.
USDGEOM_API bool _IsCompatible() const override
Returns whether the underlying xformable is compatible with the API.
Return type for CreateXformOps().
Schema wrapper for UsdAttribute for authoring and computing transformation operations,...
Definition: xformOp.h:112
Type
Enumerates the set of all transformation operation types.
Definition: xformOp.h:116
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:134
The base class for all schema types in Usd.
Definition: schemaBase.h:56
Singleton registry that provides access to schema type information and the prim definitions for regis...
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:84
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:112
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:127
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:442