This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
inbetweenShape.h
1//
2// Copyright 2018 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_USD_SKEL_INBETWEEN_SHAPE_H
8#define PXR_USD_USD_SKEL_INBETWEEN_SHAPE_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usdSkel/api.h"
12
13#include "pxr/usd/usd/attribute.h"
15
16PXR_NAMESPACE_OPEN_SCOPE
17
18
34{
35public:
38
47 USDSKEL_API
48 explicit UsdSkelInbetweenShape(const UsdAttribute& attr);
49
51 USDSKEL_API
52 bool GetWeight(float* weight) const;
53
55 USDSKEL_API
56 bool SetWeight(float weight) const;
57
61 USDSKEL_API
62 bool HasAuthoredWeight() const;
63
65 USDSKEL_API
66 bool GetOffsets(VtVec3fArray* offsets) const;
67
69 USDSKEL_API
70 bool SetOffsets(const VtVec3fArray& offsets) const;
71
74 USDSKEL_API
76
79 USDSKEL_API
81 CreateNormalOffsetsAttr(const VtValue &defaultValue = VtValue()) const;
82
85 USDSKEL_API
86 bool GetNormalOffsets(VtVec3fArray* offsets) const;
87
89 USDSKEL_API
90 bool SetNormalOffsets(const VtVec3fArray& offsets) const;
91
97 USDSKEL_API
98 static bool IsInbetween(const UsdAttribute& attr);
99
100 // ---------------------------------------------------------------
102 // ---------------------------------------------------------------
104
108 operator UsdAttribute const& () const { return _attr; }
109
111 UsdAttribute const &GetAttr() const { return _attr; }
112
115 bool IsDefined() const { return IsInbetween(_attr); }
116
121 explicit operator bool() const {
122 return IsDefined() ? (bool)_attr : 0;
123 }
124
125 bool operator==(const UsdSkelInbetweenShape& o) const {
126 return _attr == o._attr;
127 }
128
129 bool operator!=(const UsdSkelInbetweenShape& o) const {
130 return !(*this == o);
131 }
132
134
135private:
136 friend class UsdSkelBlendShape;
137
140 static bool _IsValidInbetweenName(const std::string& name,
141 bool quiet=false);
142
145 static bool _IsNamespaced(const TfToken& name);
146
154 static TfToken _MakeNamespaced(const TfToken& name, bool quiet=false);
155
156 static const TfToken& _GetNamespacePrefix();
157
158 static const TfToken& _GetNormalOffsetsSuffix();
159
160 UsdAttribute _GetNormalOffsetsAttr(bool create) const;
161
175 static UsdSkelInbetweenShape _Create(const UsdPrim& prim,
176 const TfToken& name);
177
178 UsdAttribute _attr;
179};
180
181
182PXR_NAMESPACE_CLOSE_SCOPE
183
184#endif // PXR_USD_USD_SKEL_INBETWEEN_SHAPE_H
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Definition: attribute.h:160
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
Describes a target blend shape, possibly containing inbetween shapes.
Definition: blendShape.h:49
Schema wrapper for UsdAttribute for authoring and introspecting attributes that serve as inbetween sh...
UsdSkelInbetweenShape()
Default constructor returns an invalid inbetween shape.
USDSKEL_API UsdAttribute GetNormalOffsetsAttr() const
Returns a valid normal offsets attribute if the shape has normal offsets.
USDSKEL_API bool GetOffsets(VtVec3fArray *offsets) const
Get the point offsets corresponding to this 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 SetNormalOffsets(const VtVec3fArray &offsets) const
Set the normal offsets authored for this shape.
USDSKEL_API bool HasAuthoredWeight() const
Has a weight value been explicitly authored on 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...
USDSKEL_API bool SetOffsets(const VtVec3fArray &offsets) const
Set the point offsets corresponding to this shape.
bool IsDefined() const
Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as ...
USDSKEL_API bool GetNormalOffsets(VtVec3fArray *offsets) const
Get the normal offsets authored for this shape.
UsdAttribute const & GetAttr() const
Explicit UsdAttribute extractor.
USDSKEL_API bool GetWeight(float *weight) const
Return the location at which the shape is applied.
USDSKEL_API UsdSkelInbetweenShape(const UsdAttribute &attr)
Speculative constructor that will produce a valid UsdSkelInbetweenShape when attr already represents ...
USDSKEL_API bool SetWeight(float weight) const
Set the location at which the shape is applied.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:147