All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
attributeSpec.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 SDF_ATTRIBUTESPEC_H
25 #define SDF_ATTRIBUTESPEC_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/sdf/api.h"
31 #include "pxr/usd/sdf/declareSpec.h"
32 #include "pxr/usd/sdf/path.h"
33 #include "pxr/usd/sdf/propertySpec.h"
34 #include "pxr/usd/sdf/types.h"
35 #include "pxr/base/tf/enum.h"
36 
37 PXR_NAMESPACE_OPEN_SCOPE
38 
57 {
58  SDF_DECLARE_SPEC(SdfAttributeSpec, SdfPropertySpec);
59 
60 public:
61  typedef SdfAttributeSpec This;
62  typedef SdfPropertySpec Parent;
63 
67 
72  SDF_API
73  static SdfAttributeSpecHandle
74  New(const SdfPrimSpecHandle& owner,
75  const std::string& name, const SdfValueTypeName& typeName,
76  SdfVariability variability = SdfVariabilityVarying,
77  bool custom = false);
78 
80 
81 public:
84 
89  SDF_API
91 
93  SDF_API
94  bool HasConnectionPaths() const;
95 
97  SDF_API
98  void ClearConnectionPaths();
99 
103 
109  SDF_API
110  VtTokenArray GetAllowedTokens() const;
111 
113  SDF_API
114  void SetAllowedTokens(const VtTokenArray& allowedTokens);
115 
117  SDF_API
118  bool HasAllowedTokens() const;
119 
121  SDF_API
122  void ClearAllowedTokens();
123 
125  SDF_API
126  TfEnum GetDisplayUnit() const;
127 
129  SDF_API
130  void SetDisplayUnit(const TfEnum& displayUnit);
131 
133  SDF_API
134  bool HasDisplayUnit() const;
135 
137  SDF_API
138  void ClearDisplayUnit();
139 
142  SDF_API
143  TfToken GetColorSpace() const;
144 
147  SDF_API
148  void SetColorSpace(const TfToken &colorSpace);
149 
151  SDF_API
152  bool HasColorSpace() const;
153 
155  SDF_API
156  void ClearColorSpace();
157 
161 
165  SDF_API
166  TfToken GetRoleName() const;
167 
169 
170 private:
171  static SdfAttributeSpecHandle
172  _New(const SdfSpecHandle &owner,
173  const SdfPath& attributePath,
174  const SdfValueTypeName& typeName,
175  SdfVariability variability,
176  bool custom);
177 
178  SdfPath _CanonicalizeConnectionPath(const SdfPath& connectionPath) const;
179 
180  friend class Sdf_PyAttributeAccess;
181 };
182 
183 PXR_NAMESPACE_CLOSE_SCOPE
184 
185 #endif // SDF_ATTRIBUTESPEC_H
SDF_API bool HasAllowedTokens() const
Returns true if allowed tokens metadata is set for this attribute.
SDF_API void ClearAllowedTokens()
Clears the allowed tokens metadata for this attribute.
Base class for SdfAttributeSpec and SdfRelationshipSpec.
Definition: propertySpec.h:59
SDF_API void ClearColorSpace()
Clears the colorSpace metadata value set on this attribute.
static SDF_API SdfAttributeSpecHandle New(const SdfPrimSpecHandle &owner, const std::string &name, const SdfValueTypeName &typeName, SdfVariability variability=SdfVariabilityVarying, bool custom=false)
Constructs a new prim attribute instance.
Represents a set of list editing operations.
SDF_API TfEnum GetDisplayUnit() const
Returns the display unit of the attribute.
SDF_API void ClearDisplayUnit()
Clears the display unit of the attribute.
SDF_API SdfConnectionsProxy GetConnectionPathList() const
Returns a proxy for editing the attribute's connection paths.
An enum class that records both enum type and enum value.
Definition: enum.h:140
Represents a value type name, i.e.
Definition: valueTypeName.h:83
SDF_API VtTokenArray GetAllowedTokens() const
Returns the allowed tokens metadata for this attribute.
SDF_API void ClearConnectionPaths()
Clears the connection paths for this attribute.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
A subclass of SdfPropertySpec that holds typed data.
Definition: attributeSpec.h:56
SDF_API void SetColorSpace(const TfToken &colorSpace)
Sets the color-space in which a color or texture valued attribute is authored.
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:182
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
SDF_API TfToken GetColorSpace() const
Returns the color-space in which a color or texture valued attribute is authored. ...
SDF_API bool HasColorSpace() const
Returns true if this attribute has a colorSpace value authored.
SDF_API bool HasConnectionPaths() const
Returns true if any connection paths are set on this attribute.
SDF_API TfToken GetRoleName() const
Returns the roleName for this attribute's typeName.
SDF_API bool HasDisplayUnit() const
Returns true if a display unit is set for this attribute.
SDF_API void SetDisplayUnit(const TfEnum &displayUnit)
Sets the display unit of the attribute.
SDF_API void SetAllowedTokens(const VtTokenArray &allowedTokens)
Sets the allowed tokens metadata for this attribute.