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 PXR_USD_SDF_ATTRIBUTE_SPEC_H
25 #define PXR_USD_SDF_ATTRIBUTE_SPEC_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"
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 
83 
88  SDF_API
90 
92  SDF_API
93  bool HasConnectionPaths() const;
94 
96  SDF_API
97  void ClearConnectionPaths();
98 
102 
108  SDF_API
109  VtTokenArray GetAllowedTokens() const;
110 
112  SDF_API
113  void SetAllowedTokens(const VtTokenArray& allowedTokens);
114 
116  SDF_API
117  bool HasAllowedTokens() const;
118 
120  SDF_API
121  void ClearAllowedTokens();
122 
124  SDF_API
125  TfEnum GetDisplayUnit() const;
126 
128  SDF_API
129  void SetDisplayUnit(const TfEnum& displayUnit);
130 
132  SDF_API
133  bool HasDisplayUnit() const;
134 
136  SDF_API
137  void ClearDisplayUnit();
138 
141  SDF_API
142  TfToken GetColorSpace() const;
143 
146  SDF_API
147  void SetColorSpace(const TfToken &colorSpace);
148 
150  SDF_API
151  bool HasColorSpace() const;
152 
154  SDF_API
155  void ClearColorSpace();
156 
160 
164  SDF_API
165  TfToken GetRoleName() const;
166 
168 };
169 
180 SDF_API
181 bool
183  const SdfLayerHandle &layer,
184  const SdfPath &attrPath,
185  const SdfValueTypeName &typeName,
186  SdfVariability variability = SdfVariabilityVarying,
187  bool isCustom = false);
188 
189 PXR_NAMESPACE_CLOSE_SCOPE
190 
191 #endif // PXR_USD_SDF_ATTRIBUTE_SPEC_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:139
Represents a value type name, i.e.
Definition: valueTypeName.h:87
SDF_API VtTokenArray GetAllowedTokens() const
Returns the allowed tokens metadata for this attribute.
SDF_API void ClearConnectionPaths()
Clears the connection paths for this attribute.
Basic Sdf data types.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:87
A subclass of SdfPropertySpec that holds typed data.
Definition: attributeSpec.h:56
SDF_API bool SdfJustCreatePrimAttributeInLayer(const SdfLayerHandle &layer, const SdfPath &attrPath, const SdfValueTypeName &typeName, SdfVariability variability=SdfVariabilityVarying, bool isCustom=false)
Convenience function to create an attributeSpec on a primSpec at the given path, and any necessary pa...
SDF_API void SetColorSpace(const TfToken &colorSpace)
Sets the color-space in which a color or texture valued attribute is authored.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
SDF_API TfToken GetColorSpace() const
Returns 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:179
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.