All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
inbetweenShape.h
1 //
2 // Copyright 2018 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_SKEL_INBETWEEN_SHAPE_H
25 #define PXR_USD_USD_SKEL_INBETWEEN_SHAPE_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/usdSkel/api.h"
29 
30 #include "pxr/usd/usd/attribute.h"
31 #include "pxr/usd/usdSkel/tokens.h"
32 
33 PXR_NAMESPACE_OPEN_SCOPE
34 
35 
51 {
52 public:
55 
64  USDSKEL_API
65  explicit UsdSkelInbetweenShape(const UsdAttribute& attr);
66 
68  USDSKEL_API
69  bool GetWeight(float* weight) const;
70 
72  USDSKEL_API
73  bool SetWeight(float weight) const;
74 
78  USDSKEL_API
79  bool HasAuthoredWeight() const;
80 
82  USDSKEL_API
83  bool GetOffsets(VtVec3fArray* offsets) const;
84 
86  USDSKEL_API
87  bool SetOffsets(const VtVec3fArray& offsets) const;
88 
91  USDSKEL_API
93 
96  USDSKEL_API
98  CreateNormalOffsetsAttr(const VtValue &defaultValue = VtValue()) const;
99 
102  USDSKEL_API
103  bool GetNormalOffsets(VtVec3fArray* offsets) const;
104 
106  USDSKEL_API
107  bool SetNormalOffsets(const VtVec3fArray& offsets) const;
108 
114  USDSKEL_API
115  static bool IsInbetween(const UsdAttribute& attr);
116 
117  // ---------------------------------------------------------------
119  // ---------------------------------------------------------------
121 
125  operator UsdAttribute const& () const { return _attr; }
126 
128  UsdAttribute const &GetAttr() const { return _attr; }
129 
132  bool IsDefined() const { return IsInbetween(_attr); }
133 
138  explicit operator bool() const {
139  return IsDefined() ? (bool)_attr : 0;
140  }
141 
142  bool operator==(const UsdSkelInbetweenShape& o) const {
143  return _attr == o._attr;
144  }
145 
146  bool operator!=(const UsdSkelInbetweenShape& o) const {
147  return !(*this == o);
148  }
149 
151 
152 private:
153  friend class UsdSkelBlendShape;
154 
157  static bool _IsValidInbetweenName(const std::string& name,
158  bool quiet=false);
159 
162  static bool _IsNamespaced(const TfToken& name);
163 
171  static TfToken _MakeNamespaced(const TfToken& name, bool quiet=false);
172 
173  static const TfToken& _GetNamespacePrefix();
174 
175  static const TfToken& _GetNormalOffsetsSuffix();
176 
177  UsdAttribute _GetNormalOffsetsAttr(bool create) const;
178 
192  static UsdSkelInbetweenShape _Create(const UsdPrim& prim,
193  const TfToken& name);
194 
195  UsdAttribute _attr;
196 };
197 
198 
199 PXR_NAMESPACE_CLOSE_SCOPE
200 
201 #endif // PXR_USD_USD_SKEL_INBETWEEN_SHAPE_H
USDSKEL_API bool SetNormalOffsets(const VtVec3fArray &offsets) const
Set the normal offsets authored for this shape.
Describes a target blend shape, possibly containing inbetween shapes.
Definition: blendShape.h:65
USDSKEL_API bool GetWeight(float *weight) const
Return the location at which the shape is applied.
UsdAttribute const & GetAttr() const
Explicit UsdAttribute extractor.
UsdSkelInbetweenShape()
Default constructor returns an invalid inbetween shape.
USDSKEL_API UsdAttribute CreateNormalOffsetsAttr(const VtValue &defaultValue=VtValue()) const
Returns the existing normal offsets attribute if the shape has normal offsets, or creates a new one...
USDSKEL_API bool GetOffsets(VtVec3fArray *offsets) const
Get the point offsets corresponding to this shape.
static USDSKEL_API bool IsInbetween(const UsdAttribute &attr)
Test whether a given UsdAttribute represents a valid Inbetween, which implies that creating a UsdSkel...
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:132
USDSKEL_API bool SetWeight(float weight) const
Set the location at which the shape is applied.
USDSKEL_API bool SetOffsets(const VtVec3fArray &offsets) const
Set the point offsets corresponding to this shape.
USDSKEL_API bool HasAuthoredWeight() const
Has a weight value been explicitly authored on this shape?
USDSKEL_API bool GetNormalOffsets(VtVec3fArray *offsets) const
Get the normal offsets authored for this shape.
USDSKEL_API UsdAttribute GetNormalOffsetsAttr() const
Returns a valid normal offsets attribute if the shape has normal offsets.
bool IsDefined() const
Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as ...
Schema wrapper for UsdAttribute for authoring and introspecting attributes that serve as inbetween sh...
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:168