HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
propertyHints.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 
8 #ifndef PXR_USD_USDUI_PROPERTY_HINTS_H
9 #define PXR_USD_USDUI_PROPERTY_HINTS_H
10 
11 /// \file usdUI/propertyHints.h
12 
14 #include "pxr/usd/usd/property.h"
15 
17 
18 /// \class UsdUIPropertyHints
19 ///
20 /// A "schema-like" wrapper that provides API for retrieving and authoring UI
21 /// hint values within the \c uiHints dictionary field on a UsdProperty
22 /// instance.
23 ///
24 /// UsdUIPropertyHints is "schema-like" in that it interprets fields belonging
25 /// to a core object type (in this case UsdProperty, but see also
26 /// UsdUIObjectHints, UsdUIPrimHints, and UsdUIAttributeHints), and provides
27 /// convenient API for using those fields. However, it is not formally a schema
28 /// and does not derive from UsdSchemaBase.
29 ///
30 /// See \ref usdUI_hintsOverview for an overview of UI hints.
32 {
33 public:
34  /// Default constructor that creates an invalid hints object.
35  ///
36  /// Calling "set" operations on this object will post errors. "Get"
37  /// operations will return fallback values.
38  USDUI_API
40 
41  /// Construct a hints object for the given UsdProperty \p prop.
42  USDUI_API
43  explicit UsdUIPropertyHints(const UsdProperty& prop);
44 
45  /// Return the property that this hints instance is interpreting.
46  UsdProperty GetProperty() const { return _prop; }
47 
48  /// Return the property's display group, indicating which group it should
49  /// appear under in the UI.
50  ///
51  /// Backwards compatibility note: If no display group is stored in the
52  /// property's \c uiHints dictionary, the value of
53  /// UsdProperty::GetDisplayGroup (which has been deprecated) will be
54  /// returned. This fallback behavior is temporary, and will be removed in
55  /// a future release.
56  USDUI_API
57  std::string GetDisplayGroup() const;
58 
59  /// Set the object's display group to \p group. Return \c true if
60  /// successful.
61  ///
62  /// Backwards compatibility note: this function always writes to the
63  /// \c uiHints dictionary. It does not call UsdObject::SetDisplayGroup,
64  /// which has been deprecatd.
65  USDUI_API
66  bool SetDisplayGroup(const std::string& group);
67 
68  /// Return the property's "shown if" expression string.
69  ///
70  /// This expression, when evaluated, determines whether the property should
71  /// be shown or hidden in the UI.
72  USDUI_API
73  std::string GetShownIf() const;
74 
75  /// Set the property's "shown if" expression string. Return \c true if
76  /// successful.
77  USDUI_API
78  bool SetShownIf(const std::string& shownIf);
79 
80 private:
81  UsdProperty _prop;
82 };
83 
85 
86 #endif
USDUI_API UsdUIPropertyHints()
USDUI_API std::string GetDisplayGroup() const
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
UsdProperty GetProperty() const
Return the property that this hints instance is interpreting.
Definition: propertyHints.h:46
USDUI_API bool SetDisplayGroup(const std::string &group)
USDUI_API std::string GetShownIf() const
#define USDUI_API
Definition: api.h:23
USDUI_API bool SetShownIf(const std::string &shownIf)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74