All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
xformable.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_XFORMABLE_H
8#define USDGEOM_GENERATED_XFORMABLE_H
9
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"
18
20#include <vector>
21
22#include "pxr/base/vt/value.h"
23
24#include "pxr/base/gf/vec3d.h"
25#include "pxr/base/gf/vec3f.h"
27
28#include "pxr/base/tf/token.h"
29#include "pxr/base/tf/type.h"
30
31PXR_NAMESPACE_OPEN_SCOPE
32
33class SdfAssetPath;
34
35// -------------------------------------------------------------------------- //
36// XFORMABLE //
37// -------------------------------------------------------------------------- //
38
236{
237public:
241 static const UsdSchemaKind schemaKind = UsdSchemaKind::AbstractTyped;
242
247 explicit UsdGeomXformable(const UsdPrim& prim=UsdPrim())
248 : UsdGeomImageable(prim)
249 {
250 }
251
255 explicit UsdGeomXformable(const UsdSchemaBase& schemaObj)
256 : UsdGeomImageable(schemaObj)
257 {
258 }
259
261 USDGEOM_API
263
267 USDGEOM_API
268 static const TfTokenVector &
269 GetSchemaAttributeNames(bool includeInherited=true);
270
280 USDGEOM_API
281 static UsdGeomXformable
282 Get(const UsdStagePtr &stage, const SdfPath &path);
283
284
285protected:
289 USDGEOM_API
291
292private:
293 // needs to invoke _GetStaticTfType.
294 friend class UsdSchemaRegistry;
295 USDGEOM_API
296 static const TfType &_GetStaticTfType();
297
298 static bool _IsTypedSchema();
299
300 // override SchemaBase virtuals.
301 USDGEOM_API
302 const TfType &_GetTfType() const override;
303
304public:
305 // --------------------------------------------------------------------- //
306 // XFORMOPORDER
307 // --------------------------------------------------------------------- //
324 USDGEOM_API
326
332 USDGEOM_API
333 UsdAttribute CreateXformOpOrderAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
334
335public:
336 // ===================================================================== //
337 // Feel free to add custom code below this line, it will be preserved by
338 // the code generator.
339 //
340 // Just remember to:
341 // - Close the class declaration with };
342 // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
343 // - Close the include guard with #endif
344 // ===================================================================== //
345 // --(BEGIN CUSTOM CODE)--
346
363 public:
364 XformQuery():
365 _resetsXformStack(false)
366 { }
367
371 USDGEOM_API
372 XformQuery(const UsdGeomXformable &xformable);
373
376 USDGEOM_API
378 const UsdTimeCode time) const;
379
381 bool GetResetXformStack() const {
382 return _resetsXformStack;
383 }
384
386 USDGEOM_API
388
390 USDGEOM_API
392
397 USDGEOM_API
398 bool GetTimeSamples(std::vector<double> *times) const;
399
404 USDGEOM_API
406 std::vector<double> *times) const;
407
410 USDGEOM_API
412 const TfToken &attrName) const;
413
414 private:
415 // Cached copy of the vector of ordered xform ops.
416 std::vector<UsdGeomXformOp> _xformOps;
417
418 // Cache whether the xformable has !resetsXformStack! in its
419 // xformOpOrder.
420 bool _resetsXformStack;
421 };
422
458 USDGEOM_API
462 TfToken const &opSuffix = TfToken(),
463 bool isInverseOp=false) const;
464
484 USDGEOM_API
486 TfToken const &opSuffix = TfToken(),
487 bool isInverseOp=false) const;
488
493 USDGEOM_API
496 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
497
502 USDGEOM_API
504 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
505
510 USDGEOM_API
513 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
514
519 USDGEOM_API
521 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
522
528 USDGEOM_API
531 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
532
537 USDGEOM_API
539 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
540
546 USDGEOM_API
549 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
550
555 USDGEOM_API
557 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
558
563 USDGEOM_API
566 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
567
572 USDGEOM_API
574 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
575
581 USDGEOM_API
584 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
585
590 USDGEOM_API
592 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
593
599 USDGEOM_API
602 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
603
608 USDGEOM_API
610 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
611
617 USDGEOM_API
620 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
621
626 USDGEOM_API
628 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
629
635 USDGEOM_API
638 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
639
644 USDGEOM_API
646 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
647
653 USDGEOM_API
656 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
657
662 USDGEOM_API
664 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
665
671 USDGEOM_API
674 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
675
680 USDGEOM_API
682 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
683
688 USDGEOM_API
691 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
692
697 USDGEOM_API
699 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
700
710 USDGEOM_API
713 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
714
720 USDGEOM_API
722 TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
723
733 USDGEOM_API
734 bool SetResetXformStack(bool resetXform) const;
735
742 USDGEOM_API
743 bool GetResetXformStack() const;
744
766 USDGEOM_API
767 bool SetXformOpOrder(std::vector<UsdGeomXformOp> const &orderedXformOps,
768 bool resetXformStack = false) const;
769
787 USDGEOM_API
788 std::vector<UsdGeomXformOp> GetOrderedXformOps(bool *resetsXformStack) const;
789
791 USDGEOM_API
792 bool ClearXformOpOrder() const;
793
802 USDGEOM_API
804
811 USDGEOM_API
813
822 USDGEOM_API
824 const std::vector<UsdGeomXformOp> &ops) const;
825
833 USDGEOM_API
834 bool GetTimeSamples(std::vector<double> *times) const;
835
844 USDGEOM_API
846 std::vector<double> *times) const;
847
855 USDGEOM_API
856 static bool GetTimeSamples(
857 std::vector<UsdGeomXformOp> const &orderedXformOps,
858 std::vector<double> *times);
859
868 USDGEOM_API
870 std::vector<UsdGeomXformOp> const &orderedXformOps,
871 const GfInterval &interval,
872 std::vector<double> *times);
873
894 USDGEOM_API
896 GfMatrix4d *transform,
897 bool *resetsXformStack,
898 const UsdTimeCode time = UsdTimeCode::Default()) const;
899
921 USDGEOM_API
923 bool *resetsXformStack,
924 const std::vector<UsdGeomXformOp> &ops,
925 const UsdTimeCode time = UsdTimeCode::Default()) const;
926
939 USDGEOM_API
940 static bool GetLocalTransformation(GfMatrix4d *transform,
941 std::vector<UsdGeomXformOp> const &ops,
942 const UsdTimeCode time);
943
946 USDGEOM_API
947 static bool IsTransformationAffectedByAttrNamed(const TfToken &attrName);
948
949private:
950 // Extracts the value of the xformOpOrder attribute. Returns false if
951 // the xformOpOrder attribute doesn't exist on the prim (eg. when the prim
952 // type is incompatible or if it's a pure over).
953 bool _GetXformOpOrderValue(VtTokenArray *xformOpOrder) const;
954
955 // Helper function for getting xformops with or without attribute queries.
956 std::vector<UsdGeomXformOp>
957 _GetOrderedXformOps(bool *resetsXformStack,
958 bool withAttributeQueries) const;
959};
960
961PXR_NAMESPACE_CLOSE_SCOPE
962
963#endif
A basic mathematical interval class.
Definition: interval.h:33
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:71
Contains an asset path and an optional resolved path.
Definition: assetPath.h:30
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
TfType represents a dynamic runtime type.
Definition: type.h:48
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:160
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:58
Schema wrapper for UsdAttribute for authoring and computing transformation operations,...
Definition: xformOp.h:94
Type
Enumerates the set of all transformation operation types.
Definition: xformOp.h:98
Precision
Precision with which the value of the tranformation operation is encoded.
Definition: xformOp.h:122
@ PrecisionFloat
Floating-point precision.
Definition: xformOp.h:124
@ PrecisionDouble
Double precision.
Definition: xformOp.h:123
Helper class that caches the ordered vector of UsGeomXformOps that contribute to the local transforma...
Definition: xformable.h:362
USDGEOM_API bool GetTimeSamples(std::vector< double > *times) const
Sets the vector of times at which xformOp samples have been authored in the cached set of xform ops.
USDGEOM_API bool GetLocalTransformation(GfMatrix4d *transform, const UsdTimeCode time) const
Utilizes the internally cached UsdAttributeQuery's to efficiently compute the transform value at the ...
USDGEOM_API bool GetTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
Sets the vector of times in the interval at which xformOp samples have been authored in the cached se...
bool GetResetXformStack() const
Returns whether the xformable resets its parent's transformation.
Definition: xformable.h:381
USDGEOM_API bool TransformMightBeTimeVarying() const
Returns whether the xform value might change over time.
USDGEOM_API bool HasNonEmptyXformOpOrder() const
Returns whether xformOpOrder is non-empty.
USDGEOM_API bool IsAttributeIncludedInLocalTransform(const TfToken &attrName) const
Returns whether the given attribute affects the local transformation computed for this query.
USDGEOM_API XformQuery(const UsdGeomXformable &xformable)
Constructs an XformQuery object for the given xformable prim.
Base class for all transformable prims, which allows arbitrary sequences of component affine transfor...
Definition: xformable.h:236
USDGEOM_API bool GetTimeSamples(std::vector< double > *times) const
Sets times to the union of all the timesamples at which xformOps that are included in the xformOpOrde...
USDGEOM_API UsdAttribute CreateXformOpOrderAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
See GetXformOpOrderAttr(), and also Create vs Get Property Methods for when to use Get vs Create.
USDGEOM_API UsdGeomXformOp GetTransformOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a tranform op (4x4 matrix transformation) from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp AddTransformOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionDouble, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a tranform op (4x4 matrix transformation) to the local stack represented by this xformable.
USDGEOM_API bool ClearXformOpOrder() const
Clears the local transform stack.
USDGEOM_API UsdGeomXformOp GetRotateZXYOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation op with ZXY rotation order from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp GetScaleOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a scale operation from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp AddRotateYZXOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation op with YZX rotation order to the local stack represented by this xformable.
USDGEOM_API bool GetLocalTransformation(GfMatrix4d *transform, bool *resetsXformStack, const std::vector< UsdGeomXformOp > &ops, const UsdTimeCode time=UsdTimeCode::Default()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
Definition: xformable.h:241
USDGEOM_API bool TransformMightBeTimeVarying(const std::vector< UsdGeomXformOp > &ops) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDGEOM_API UsdGeomXformOp GetRotateZOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation about the Z-axis from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp GetRotateZYXOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation op with ZYX rotation order from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp AddRotateYOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation about the Y-axis to the local stack represented by this xformable.
USDGEOM_API bool SetXformOpOrder(std::vector< UsdGeomXformOp > const &orderedXformOps, bool resetXformStack=false) const
Reorder the already-existing transform ops on this prim.
UsdGeomXformable(const UsdSchemaBase &schemaObj)
Construct a UsdGeomXformable on the prim held by schemaObj .
Definition: xformable.h:255
USDGEOM_API UsdGeomXformOp AddScaleOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a scale operation to the local stack represented by this xformable.
static USDGEOM_API bool GetTimeSamplesInInterval(std::vector< UsdGeomXformOp > const &orderedXformOps, const GfInterval &interval, std::vector< double > *times)
Returns the union of all the timesamples in the interval at which the attributes belonging to the giv...
USDGEOM_API UsdGeomXformOp AddRotateZYXOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation op with ZYX rotation order to the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp GetOrientOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get an orient op (arbitrary axis/angle rotation) from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp AddRotateXZYOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation op with XZY rotation order to the local stack represented by this xformable.
USDGEOM_API bool GetTimeSamplesInInterval(const GfInterval &interval, std::vector< double > *times) const
Sets times to the union of all the timesamples in the interval, interval, at which xformOps that are ...
USDGEOM_API bool GetResetXformStack() const
Does this prim reset its parent's inherited transformation?
USDGEOM_API UsdGeomXformOp AddRotateZXYOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation op with ZXY rotation order to the local stack represented by this xformable.
USDGEOM_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
USDGEOM_API UsdGeomXformOp AddTranslateOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionDouble, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a translate operation to the local stack represented by this xformable.
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...
USDGEOM_API UsdGeomXformOp GetRotateYXZOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation op with YXZ rotation order from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp AddOrientOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a orient op (arbitrary axis/angle rotation) to the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp GetRotateXYZOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation op with XYZ rotation order from the local stack represented by this xformable.
virtual USDGEOM_API ~UsdGeomXformable()
Destructor.
USDGEOM_API UsdGeomXformOp MakeMatrixXform() const
Clears the existing local transform stack and creates a new xform op of type 'transform'.
USDGEOM_API UsdGeomXformOp GetRotateYOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation about the Y-axis from the local stack represented by this xformable.
USDGEOM_API bool SetResetXformStack(bool resetXform) const
Specify whether this prim's transform should reset the transformation stack inherited from its parent...
USDGEOM_API bool GetLocalTransformation(GfMatrix4d *transform, bool *resetsXformStack, const UsdTimeCode time=UsdTimeCode::Default()) const
Computes the fully-combined, local-to-parent transformation for this prim.
USDGEOM_API UsdGeomXformOp AddRotateZOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation about the Z-axis to the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp GetRotateYZXOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation op with YZX rotation order from the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp GetXformOp(UsdGeomXformOp::Type const opType, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get an affine transformation from the local stack represented by this Xformable.
USDGEOM_API UsdGeomXformOp GetTranslateOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a translate operation from the local stack represented by this xformable.
static USDGEOM_API bool GetTimeSamples(std::vector< UsdGeomXformOp > const &orderedXformOps, std::vector< double > *times)
Returns the union of all the timesamples at which the attributes belonging to the given orderedXformO...
USDGEOM_API UsdGeomXformOp AddRotateXYZOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation op with XYZ rotation order to the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp AddRotateXOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation about the X-axis to the local stack represented by this xformable.
USDGEOM_API UsdGeomXformOp AddRotateYXZOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation op with YXZ rotation order to the local stack represented by this xformable.
USDGEOM_API std::vector< UsdGeomXformOp > GetOrderedXformOps(bool *resetsXformStack) const
Return the ordered list of transform operations to be applied to this prim, in least-to-most-local or...
USDGEOM_API bool TransformMightBeTimeVarying() const
Determine whether there is any possibility that this prim's local transformation may vary over time.
static USDGEOM_API UsdGeomXformable Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdGeomXformable holding the prim adhering to this schema at path on stage.
static USDGEOM_API bool GetLocalTransformation(GfMatrix4d *transform, std::vector< UsdGeomXformOp > const &ops, const UsdTimeCode time)
This is an overloaded member function, provided for convenience. It differs from the above function o...
USDGEOM_API UsdGeomXformOp AddXformOp(UsdGeomXformOp::Type const opType, UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionDouble, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add an affine transformation to the local stack represented by this Xformable.
static USDGEOM_API bool IsTransformationAffectedByAttrNamed(const TfToken &attrName)
Returns true if the attribute named attrName could affect the local transformation of an xformable pr...
USDGEOM_API UsdGeomXformOp GetRotateXOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation about the X-axis from the local stack represented by this xformable.
UsdGeomXformable(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomXformable on UsdPrim prim .
Definition: xformable.h:247
USDGEOM_API UsdGeomXformOp GetRotateXZYOp(TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Get a rotation op with XZY rotation order from the local stack represented by this xformable.
USDGEOM_API UsdAttribute GetXformOpOrderAttr() const
Encodes the sequence of transformation operations in the order in which they should be pushed onto a ...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
The base class for all schema types in Usd.
Definition: schemaBase.h:39
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:67
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
Definition: timeCode.h:95
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
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:440