All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
propertySpec.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_PROPERTYSPEC_H
25 #define SDF_PROPERTYSPEC_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/spec.h"
33 #include "pxr/usd/sdf/declareHandles.h"
34 #include "pxr/usd/sdf/proxyTypes.h"
35 #include "pxr/usd/sdf/types.h"
36 
37 #include "pxr/base/vt/value.h"
38 
39 #include "pxr/base/tf/declarePtrs.h"
40 #include "pxr/base/tf/token.h"
41 
42 #include <iosfwd>
43 #include <string>
44 
45 PXR_NAMESPACE_OPEN_SCOPE
46 
59 class SdfPropertySpec : public SdfSpec
60 {
61  SDF_DECLARE_ABSTRACT_SPEC(SdfPropertySpec, SdfSpec);
62 
63 public:
67 
69  SDF_API
70  const std::string &GetName() const;
71 
73  SDF_API
74  TfToken GetNameToken() const;
75 
81  SDF_API
82  bool CanSetName(const std::string &newName, std::string *whyNot) const;
83 
91  SDF_API
92  bool SetName(const std::string &newName, bool validate = true);
93 
97  SDF_API
98  static bool IsValidName(const std::string &name);
99 
103 
105  SDF_API
106  SdfSpecHandle GetOwner() const;
107 
111 
123  SDF_API
125 
138  SDF_API
140 
144  SDF_API
145  void SetCustomData(const std::string &name, const VtValue &value);
146 
153  SDF_API
154  void SetAssetInfo(const std::string& name, const VtValue& value);
155 
159  SDF_API
160  std::string GetDisplayGroup() const;
161 
163  SDF_API
164  void SetDisplayGroup(const std::string &value);
165 
169  SDF_API
170  std::string GetDisplayName() const;
171 
173  SDF_API
174  void SetDisplayName(const std::string &value);
175 
179  SDF_API
180  std::string GetDocumentation() const;
181 
183  SDF_API
184  void SetDocumentation(const std::string &value);
185 
189  SDF_API
190  bool GetHidden() const;
191 
193  SDF_API
194  void SetHidden(bool value);
195 
199  SDF_API
201 
203  SDF_API
204  void SetPermission(SdfPermission value);
205 
209  SDF_API
210  std::string GetPrefix() const;
211 
213  SDF_API
214  void SetPrefix(const std::string &value);
215 
219  SDF_API
220  std::string GetSuffix() const;
221 
223  SDF_API
224  void SetSuffix(const std::string &value);
225 
229  SDF_API
230  std::string GetSymmetricPeer() const;
231 
236  SDF_API
237  void SetSymmetricPeer(const std::string &peerName);
238 
242  SDF_API
244 
249  SDF_API
250  void SetSymmetryArgument(const std::string &name, const VtValue &value);
251 
255  SDF_API
257 
262  SDF_API
263  void SetSymmetryFunction(const TfToken &functionName);
264 
268 
270  SDF_API
272 
274  SDF_API
275  TfType GetValueType() const;
276 
281  SDF_API
283 
287  SDF_API
288  VtValue GetDefaultValue() const;
289 
294  SDF_API
295  bool SetDefaultValue(const VtValue &defaultValue);
296 
298  SDF_API
299  bool HasDefaultValue() const;
300 
302  SDF_API
303  void ClearDefaultValue();
304 
308 
312  SDF_API
313  std::string GetComment() const;
314 
316  SDF_API
317  void SetComment(const std::string &value);
318 
320  SDF_API
321  bool IsCustom() const;
322 
324  SDF_API
325  void SetCustom(bool custom);
326 
355  SDF_API
357 
369  SDF_API
370  bool HasOnlyRequiredFields() const;
371 
372 private:
373  inline TfToken _GetAttributeValueTypeName() const;
374 };
375 
376 PXR_NAMESPACE_CLOSE_SCOPE
377 
378 #endif // #ifndef SDF_PROPERTYSPEC_H
SDF_API void SetPermission(SdfPermission value)
Sets the property&#39;s permission restriction.
SDF_API TfToken GetSymmetryFunction() const
Returns the property&#39;s symmetry function.
SDF_API std::string GetComment() const
Returns the comment string for this property spec.
SDF_API SdfDictionaryProxy GetSymmetryArguments() const
Returns the property&#39;s symmetry arguments.
Base class for SdfAttributeSpec and SdfRelationshipSpec.
Definition: propertySpec.h:59
SDF_API SdfDictionaryProxy GetAssetInfo() const
Returns the asset info dictionary for this property.
static SDF_API bool IsValidName(const std::string &name)
Returns true if the given name is considered a valid name for a property.
SDF_API bool IsCustom() const
Returns true if this spec declares a custom property.
SDF_API SdfPermission GetPermission() const
Returns the property&#39;s permission restriction.
SDF_API void SetAssetInfo(const std::string &name, const VtValue &value)
Sets a asset info entry for this property.
SDF_API bool CanSetName(const std::string &newName, std::string *whyNot) const
Returns true if setting the property spec&#39;s name to newName will succeed.
Base class for all Sdf spec classes.
Definition: spec.h:51
SDF_API std::string GetDisplayName() const
Returns the displayName string for this property spec.
SDF_API std::string GetDocumentation() const
Returns the documentation string for this property spec.
Represents a value type name, i.e.
Definition: valueTypeName.h:83
SDF_API SdfTimeSampleMap GetTimeSampleMap() const
Returns the entire set of time samples.
SDF_API void SetPrefix(const std::string &value)
Sets the prefix string for this property spec.
SDF_API void SetSuffix(const std::string &value)
Sets the suffix string for this property spec.
SDF_API std::string GetSymmetricPeer() const
Returns the property&#39;s symmetric peer.
SDF_API void SetComment(const std::string &value)
Sets the comment string for this property spec.
SDF_API std::string GetPrefix() const
Returns the prefix string for this property spec.
SDF_API void SetDisplayName(const std::string &value)
Sets the displayName string for this property spec.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
SDF_API TfType GetValueType() const
Returns the TfType representing the value type this property holds.
SDF_API bool SetDefaultValue(const VtValue &defaultValue)
Sets the attribute&#39;s default value.
SDF_API void SetCustomData(const std::string &name, const VtValue &value)
Sets a property custom data entry.
SDF_API std::string GetDisplayGroup() const
Returns the displayGroup string for this property spec.
SdfVariability
An enum that identifies variability types for attributes.
Definition: types.h:182
A proxy for editing map-like values.
Definition: mapEditProxy.h:120
SDF_API void SetDisplayGroup(const std::string &value)
Sets the displayGroup string for this property spec.
SDF_API void SetCustom(bool custom)
Sets whether this spec declares a custom property.
SDF_API SdfDictionaryProxy GetCustomData() const
Returns the property&#39;s custom data.
SDF_API SdfSpecHandle GetOwner() const
Returns the owner prim or relationship of this property.
SDF_API bool GetHidden() const
Returns whether this property spec will be hidden in browsers.
SDF_API void SetHidden(bool value)
Sets whether this property spec will be hidden in browsers.
SDF_API void ClearDefaultValue()
Clear the attribute&#39;s default value.
SDF_API TfToken GetNameToken() const
Returns the property&#39;s name, as a token.
SDF_API SdfVariability GetVariability() const
Returns the variability of the property.
SDF_API void SetSymmetryFunction(const TfToken &functionName)
Sets the property&#39;s symmetry function.
TfType represents a dynamic runtime type.
Definition: type.h:70
SDF_API SdfValueTypeName GetTypeName() const
Returns the name of the value type that this property holds.
SDF_API bool HasDefaultValue() const
Returns true if a default value is set for this attribute.
SDF_API bool HasOnlyRequiredFields() const
Returns true if this PropertySpec has no significant data other than just what is necessary for insta...
SDF_API void SetDocumentation(const std::string &value)
Sets the documentation string for this property spec.
SDF_API VtValue GetDefaultValue() const
Returns the attribute&#39;s default value.
SdfPermission
An enum that defines permission levels.
Definition: types.h:155
SDF_API const std::string & GetName() const
Returns the property&#39;s name.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:182
SDF_API void SetSymmetryArgument(const std::string &name, const VtValue &value)
Sets a property symmetry argument.
SDF_API bool SetName(const std::string &newName, bool validate=true)
Sets the property&#39;s name.
SDF_API std::string GetSuffix() const
Returns the suffix string for this property spec.
SDF_API void SetSymmetricPeer(const std::string &peerName)
Sets the property&#39;s symmetric peer.
std::map< double, VtValue > SdfTimeSampleMap
A map from sample times to sample values.
Definition: types.h:280