All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xformable.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_XFORMABLE_H
25 #define USDGEOM_GENERATED_XFORMABLE_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdGeom/api.h"
31 #include "pxr/usd/usdGeom/imageable.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdGeom/tokens.h"
35 
36 #include "pxr/usd/usdGeom/xformOp.h"
37 #include <vector>
38 
39 #include "pxr/base/vt/value.h"
40 
41 #include "pxr/base/gf/vec3d.h"
42 #include "pxr/base/gf/vec3f.h"
43 #include "pxr/base/gf/matrix4d.h"
44 
45 #include "pxr/base/tf/token.h"
46 #include "pxr/base/tf/type.h"
47 
48 PXR_NAMESPACE_OPEN_SCOPE
49 
50 class SdfAssetPath;
51 
52 // -------------------------------------------------------------------------- //
53 // XFORMABLE //
54 // -------------------------------------------------------------------------- //
55 
253 {
254 public:
259 
264  explicit UsdGeomXformable(const UsdPrim& prim=UsdPrim())
265  : UsdGeomImageable(prim)
266  {
267  }
268 
272  explicit UsdGeomXformable(const UsdSchemaBase& schemaObj)
273  : UsdGeomImageable(schemaObj)
274  {
275  }
276 
278  USDGEOM_API
279  virtual ~UsdGeomXformable();
280 
284  USDGEOM_API
285  static const TfTokenVector &
286  GetSchemaAttributeNames(bool includeInherited=true);
287 
297  USDGEOM_API
298  static UsdGeomXformable
299  Get(const UsdStagePtr &stage, const SdfPath &path);
300 
301 
302 protected:
306  USDGEOM_API
307  UsdSchemaType _GetSchemaType() const override;
308 
309 private:
310  // needs to invoke _GetStaticTfType.
311  friend class UsdSchemaRegistry;
312  USDGEOM_API
313  static const TfType &_GetStaticTfType();
314 
315  static bool _IsTypedSchema();
316 
317  // override SchemaBase virtuals.
318  USDGEOM_API
319  const TfType &_GetTfType() const override;
320 
321 public:
322  // --------------------------------------------------------------------- //
323  // XFORMOPORDER
324  // --------------------------------------------------------------------- //
339  USDGEOM_API
341 
347  USDGEOM_API
348  UsdAttribute CreateXformOpOrderAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
349 
350 public:
351  // ===================================================================== //
352  // Feel free to add custom code below this line, it will be preserved by
353  // the code generator.
354  //
355  // Just remember to:
356  // - Close the class declaration with };
357  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
358  // - Close the include guard with #endif
359  // ===================================================================== //
360  // --(BEGIN CUSTOM CODE)--
361 
377  class XformQuery {
378  public:
379  XformQuery():
380  _resetsXformStack(false)
381  { }
382 
386  USDGEOM_API
387  XformQuery(const UsdGeomXformable &xformable);
388 
391  USDGEOM_API
392  bool GetLocalTransformation(GfMatrix4d *transform,
393  const UsdTimeCode time) const;
394 
396  bool GetResetXformStack() const {
397  return _resetsXformStack;
398  }
399 
401  USDGEOM_API
402  bool TransformMightBeTimeVarying() const;
403 
408  USDGEOM_API
409  bool GetTimeSamples(std::vector<double> *times) const;
410 
415  USDGEOM_API
416  bool GetTimeSamplesInInterval(const GfInterval &interval,
417  std::vector<double> *times) const;
418 
421  USDGEOM_API
423  const TfToken &attrName) const;
424 
425  private:
426  // Cached copy of the vector of ordered xform ops.
427  std::vector<UsdGeomXformOp> _xformOps;
428 
429  // Cache whether the xformable has !resetsXformStack! in its
430  // xformOpOrder.
431  bool _resetsXformStack;
432  };
433 
469  USDGEOM_API
473  TfToken const &opSuffix = TfToken(),
474  bool isInverseOp=false) const;
475 
480  USDGEOM_API
483  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
484 
489  USDGEOM_API
492  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
493 
499  USDGEOM_API
502  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
503 
509  USDGEOM_API
512  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
513 
518  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 
538  USDGEOM_API
541  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
542 
548  USDGEOM_API
551  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
552 
558  USDGEOM_API
561  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
562 
568  USDGEOM_API
571  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
572 
578  USDGEOM_API
581  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
582 
587  USDGEOM_API
590  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
591 
601  USDGEOM_API
604  TfToken const &opSuffix = TfToken(), bool isInverseOp=false) const;
605 
615  USDGEOM_API
616  bool SetResetXformStack(bool resetXform) const;
617 
624  USDGEOM_API
625  bool GetResetXformStack() const;
626 
648  USDGEOM_API
649  bool SetXformOpOrder(std::vector<UsdGeomXformOp> const &orderedXformOps,
650  bool resetXformStack = false) const;
651 
669  USDGEOM_API
670  std::vector<UsdGeomXformOp> GetOrderedXformOps(bool *resetsXformStack) const;
671 
673  USDGEOM_API
674  bool ClearXformOpOrder() const;
675 
684  USDGEOM_API
686 
693  USDGEOM_API
694  bool TransformMightBeTimeVarying() const;
695 
704  USDGEOM_API
706  const std::vector<UsdGeomXformOp> &ops) const;
707 
715  USDGEOM_API
716  bool GetTimeSamples(std::vector<double> *times) const;
717 
726  USDGEOM_API
727  bool GetTimeSamplesInInterval(const GfInterval &interval,
728  std::vector<double> *times) const;
729 
737  USDGEOM_API
738  static bool GetTimeSamples(
739  std::vector<UsdGeomXformOp> const &orderedXformOps,
740  std::vector<double> *times);
741 
750  USDGEOM_API
751  static bool GetTimeSamplesInInterval(
752  std::vector<UsdGeomXformOp> const &orderedXformOps,
753  const GfInterval &interval,
754  std::vector<double> *times);
755 
776  USDGEOM_API
778  GfMatrix4d *transform,
779  bool *resetsXformStack,
780  const UsdTimeCode time = UsdTimeCode::Default()) const;
781 
803  USDGEOM_API
804  bool GetLocalTransformation(GfMatrix4d *transform,
805  bool *resetsXformStack,
806  const std::vector<UsdGeomXformOp> &ops,
807  const UsdTimeCode time = UsdTimeCode::Default()) const;
808 
821  USDGEOM_API
822  static bool GetLocalTransformation(GfMatrix4d *transform,
823  std::vector<UsdGeomXformOp> const &ops,
824  const UsdTimeCode time);
825 
828  USDGEOM_API
829  static bool IsTransformationAffectedByAttrNamed(const TfToken &attrName);
830 
831 private:
832  // Extracts the value of the xformOpOrder attribute. Returns false if
833  // the xformOpOrder attribute doesn't exist on the prim (eg. when the prim
834  // type is incompatible or if it's a pure over).
835  bool _GetXformOpOrderValue(VtTokenArray *xformOpOrder) const;
836 
837  // Helper function for getting xformops with or without attribute queries.
838  std::vector<UsdGeomXformOp>
839  _GetOrderedXformOps(bool *resetsXformStack,
840  bool withAttributeQueries) const;
841 };
842 
843 PXR_NAMESPACE_CLOSE_SCOPE
844 
845 #endif
USDGEOM_API UsdGeomXformOp AddRotateYOp(UsdGeomXformOp::Precision const precision=UsdGeomXformOp::PrecisionFloat, TfToken const &opSuffix=TfToken(), bool isInverseOp=false) const
Add a rotation about the YX-axis to the local stack represented by this xformable.
Floating-point precision.
Definition: xformOp.h:142
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.
USDGEOM_API bool GetResetXformStack() const
Does this prim reset its parent&#39;s inherited transformation?
USDGEOM_API UsdSchemaType _GetSchemaType() const override
Returns the type of schema this class belongs to.
USDGEOM_API UsdGeomXformOp MakeMatrixXform() const
Clears the existing local transform stack and creates a new xform op of type &#39;transform&#39;.
UsdGeomXformable(const UsdSchemaBase &schemaObj)
Construct a UsdGeomXformable on the prim held by schemaObj .
Definition: xformable.h:272
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 ...
UsdGeomXformable(const UsdPrim &prim=UsdPrim())
Construct a UsdGeomXformable on UsdPrim prim .
Definition: xformable.h:264
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 bool GetLocalTransformation(GfMatrix4d *transform, const UsdTimeCode time) const
Utilizes the internally cached UsdAttributeQuery&#39;s to efficiently compute the transform value at the ...
static const UsdSchemaType schemaType
Compile time constant representing what kind of schema this class is.
Definition: xformable.h:258
Schema wrapper for UsdAttribute for authoring and computing transformation operations, as consumed by UsdGeomXformable schema.
Definition: xformOp.h:111
USDGEOM_API bool TransformMightBeTimeVarying() const
Determine whether there is any possibility that this prim&#39;s local transformation may vary over time...
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 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 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...
Type
Enumerates the set of all transformation operation types.
Definition: xformOp.h:116
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 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...
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
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 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.
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 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.
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...
Helper class that caches the ordered vector of UsGeomXformOps that contribute to the local transforma...
Definition: xformable.h:377
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
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 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.
Double precision.
Definition: xformOp.h:141
Stores a 4x4 matrix of double elements.
Definition: matrix4d.h:88
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:85
USDGEOM_API bool IsAttributeIncludedInLocalTransform(const TfToken &attrName) const
Returns whether the given attribute affects the local transformation computed for this query...
USDGEOM_API UsdAttribute GetXformOpOrderAttr() const
Encodes the sequence of transformation operations in the order in which they should be pushed onto a ...
virtual USDGEOM_API ~UsdGeomXformable()
Destructor.
UsdSchemaType
An enum representing which type of schema a given schema class belongs to.
Definition: common.h:149
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
A basic mathematical interval class.
Definition: interval.h:50
Represents a non-concrete typed schema.
bool GetResetXformStack() const
Returns whether the xformable resets its parent&#39;s transformation.
Definition: xformable.h:396
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
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.
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 bool ClearXformOpOrder() const
Clears the local transform stack.
Precision
Precision with which the value of the tranformation operation is encoded.
Definition: xformOp.h:140
USDGEOM_API bool SetResetXformStack(bool resetXform) const
Specify whether this prim&#39;s transform should reset the transformation stack inherited from its parent...
Contains an asset path and an optional resolved path.
Definition: assetPath.h:43
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 constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for &#39;default&#39;.
Definition: timeCode.h:113
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 GetLocalTransformation(GfMatrix4d *transform, bool *resetsXformStack, const UsdTimeCode time=UsdTimeCode::Default()) const
Computes the fully-combined, local-to-parent transformation for this prim.
TfType represents a dynamic runtime type.
Definition: type.h:70
Singleton registry that provides access to prim and property definition information for registered Us...
USDGEOM_API bool TransformMightBeTimeVarying() const
Returns whether the xform value might change over time.
USDGEOM_API bool SetXformOpOrder(std::vector< UsdGeomXformOp > const &orderedXformOps, bool resetXformStack=false) const
Reorder the already-existing transform ops on this prim.
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...
The base class for all schema types in Usd.
Definition: schemaBase.h:56
Base class for all prims that may require rendering or visualization of some sort.
Definition: imageable.h:74
Base class for all transformable prims, which allows arbitrary sequences of component affine transfor...
Definition: xformable.h:252
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:182
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 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. ...