All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
constraintTarget.h
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 PXR_USD_USD_GEOM_CONSTRAINT_TARGET_H
25 #define PXR_USD_USD_GEOM_CONSTRAINT_TARGET_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/usdGeom/api.h"
29 #include "pxr/usd/usd/attribute.h"
30 
31 #include <string>
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 
36 class GfMatrix4d;
37 class UsdGeomXformCache;
38 
70 {
71 public:
72 
73  // Default constructor returns an invalid ConstraintTarget. Exists for
74  // container classes
76  {
77  /* NOTHING */
78  }
79 
90  USDGEOM_API
91  explicit UsdGeomConstraintTarget(const UsdAttribute &attr);
92 
98  USDGEOM_API
99  static bool IsValid(const UsdAttribute &attr);
100 
101  // ---------------------------------------------------------------
103  // ---------------------------------------------------------------
104 
108  operator UsdAttribute const& () const { return _attr; }
109 
111  UsdAttribute const &GetAttr() const { return _attr; }
112 
115  bool IsDefined() const { return IsValid(_attr); }
116 
117 
123  explicit operator bool() const {
124  return IsDefined();
125  }
126 
128  USDGEOM_API
129  bool Get(GfMatrix4d* value, UsdTimeCode time = UsdTimeCode::Default())
130  const;
131 
133  USDGEOM_API
134  bool Set(const GfMatrix4d& value, UsdTimeCode time = UsdTimeCode::Default())
135  const;
136 
140  USDGEOM_API
141  TfToken GetIdentifier() const;
142 
146  USDGEOM_API
147  void SetIdentifier(const TfToken &identifier);
148 
151  USDGEOM_API
152  static TfToken GetConstraintAttrName(const std::string &constraintName);
153 
164  USDGEOM_API
166  UsdGeomXformCache *xfCache=NULL) const;
167 
168 private:
169 
170  UsdAttribute _attr;
171 };
172 
173 
174 PXR_NAMESPACE_CLOSE_SCOPE
175 
176 #endif // USD_CONSTRAINT_TARGET_H
USDGEOM_API void SetIdentifier(const TfToken &identifier)
Explicitly sets the stored identifier to the given string.
Schema wrapper for UsdAttribute for authoring and introspecting attributes that are constraint target...
bool IsDefined() const
Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as ...
USDGEOM_API bool Get(GfMatrix4d *value, UsdTimeCode time=UsdTimeCode::Default()) const
Get the attribute value of the ConstraintTarget at time.
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
static USDGEOM_API TfToken GetConstraintAttrName(const std::string &constraintName)
Returns the fully namespaced constraint attribute name, given the constraint name.
USDGEOM_API GfMatrix4d ComputeInWorldSpace(UsdTimeCode time=UsdTimeCode::Default(), UsdGeomXformCache *xfCache=NULL) const
Computes the value of the constraint target in world space.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
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
UsdAttribute const & GetAttr() const
Explicit UsdAttribute extractor.
static USDGEOM_API bool IsValid(const UsdAttribute &attr)
Test whether a given UsdAttribute represents valid ConstraintTarget, which implies that creating a Us...
USDGEOM_API TfToken GetIdentifier() const
Get the stored identifier unique to the enclosing model&#39;s namespace for this constraint target...
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for &#39;default&#39;.
Definition: timeCode.h:113
USDGEOM_API bool Set(const GfMatrix4d &value, UsdTimeCode time=UsdTimeCode::Default()) const
Set the attribute value of the ConstraintTarget at time.
A caching mechanism for transform matrices.
Definition: xformCache.h:58