HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
backdrop.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef USDUI_GENERATED_BACKDROP_H
8 #define USDUI_GENERATED_BACKDROP_H
9 
10 /// \file usdUI/backdrop.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdUI/api.h"
14 #include "pxr/usd/usd/typed.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 #include "pxr/usd/usdUI/tokens.h"
18 
19 #include "pxr/base/vt/value.h"
20 
21 #include "pxr/base/gf/vec3d.h"
22 #include "pxr/base/gf/vec3f.h"
23 #include "pxr/base/gf/matrix4d.h"
24 
25 #include "pxr/base/tf/token.h"
26 #include "pxr/base/tf/type.h"
27 
29 
30 class SdfAssetPath;
31 
32 // -------------------------------------------------------------------------- //
33 // BACKDROP //
34 // -------------------------------------------------------------------------- //
35 
36 /// \class UsdUIBackdrop
37 ///
38 /// Provides a 'group-box' for the purpose of node graph organization.
39 ///
40 /// Unlike containers, backdrops do not store the Shader nodes inside of them.
41 /// Backdrops are an organizational tool that allows Shader nodes to be visually
42 /// grouped together in a node-graph UI, but there is no direct relationship
43 /// between a Shader node and a Backdrop.
44 ///
45 /// The guideline for a node-graph UI is that a Shader node is considered part
46 /// of a Backdrop when the Backdrop is the smallest Backdrop a Shader node's
47 /// bounding-box fits inside.
48 ///
49 /// Backdrop objects are contained inside a NodeGraph, similar to how Shader
50 /// objects are contained inside a NodeGraph.
51 ///
52 /// Backdrops have no shading inputs or outputs that influence the rendered
53 /// results of a NodeGraph. Therefore they can be safely ignored during import.
54 ///
55 /// Like Shaders and NodeGraphs, Backdrops subscribe to the NodeGraphNodeAPI to
56 /// specify position and size.
57 ///
58 ///
59 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
60 /// that are text/tokens, the actual token is published and defined in \ref UsdUITokens.
61 /// So to set an attribute to the value "rightHanded", use UsdUITokens->rightHanded
62 /// as the value.
63 ///
64 class UsdUIBackdrop : public UsdTyped
65 {
66 public:
67  /// Compile time constant representing what kind of schema this class is.
68  ///
69  /// \sa UsdSchemaKind
71 
72  /// Construct a UsdUIBackdrop on UsdPrim \p prim .
73  /// Equivalent to UsdUIBackdrop::Get(prim.GetStage(), prim.GetPath())
74  /// for a \em valid \p prim, but will not immediately throw an error for
75  /// an invalid \p prim
76  explicit UsdUIBackdrop(const UsdPrim& prim=UsdPrim())
77  : UsdTyped(prim)
78  {
79  }
80 
81  /// Construct a UsdUIBackdrop on the prim held by \p schemaObj .
82  /// Should be preferred over UsdUIBackdrop(schemaObj.GetPrim()),
83  /// as it preserves SchemaBase state.
84  explicit UsdUIBackdrop(const UsdSchemaBase& schemaObj)
85  : UsdTyped(schemaObj)
86  {
87  }
88 
89  /// Destructor.
90  USDUI_API
91  virtual ~UsdUIBackdrop();
92 
93  /// Return a vector of names of all pre-declared attributes for this schema
94  /// class and all its ancestor classes. Does not include attributes that
95  /// may be authored by custom/extended methods of the schemas involved.
96  USDUI_API
97  static const TfTokenVector &
98  GetSchemaAttributeNames(bool includeInherited=true);
99 
100  /// Return a UsdUIBackdrop holding the prim adhering to this
101  /// schema at \p path on \p stage. If no prim exists at \p path on
102  /// \p stage, or if the prim at that path does not adhere to this schema,
103  /// return an invalid schema object. This is shorthand for the following:
104  ///
105  /// \code
106  /// UsdUIBackdrop(stage->GetPrimAtPath(path));
107  /// \endcode
108  ///
109  USDUI_API
110  static UsdUIBackdrop
111  Get(const UsdStagePtr &stage, const SdfPath &path);
112 
113  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
114  /// is defined (according to UsdPrim::IsDefined()) on this stage.
115  ///
116  /// If a prim adhering to this schema at \p path is already defined on this
117  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
118  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
119  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
120  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
121  /// current EditTarget for any nonexistent, or existing but not \a Defined
122  /// ancestors.
123  ///
124  /// The given \a path must be an absolute prim path that does not contain
125  /// any variant selections.
126  ///
127  /// If it is impossible to author any of the necessary PrimSpecs, (for
128  /// example, in case \a path cannot map to the current UsdEditTarget's
129  /// namespace) issue an error and return an invalid \a UsdPrim.
130  ///
131  /// Note that this method may return a defined prim whose typeName does not
132  /// specify this schema class, in case a stronger typeName opinion overrides
133  /// the opinion at the current EditTarget.
134  ///
135  USDUI_API
136  static UsdUIBackdrop
137  Define(const UsdStagePtr &stage, const SdfPath &path);
138 
139 protected:
140  /// Returns the kind of schema this class belongs to.
141  ///
142  /// \sa UsdSchemaKind
143  USDUI_API
144  UsdSchemaKind _GetSchemaKind() const override;
145 
146 private:
147  // needs to invoke _GetStaticTfType.
148  friend class UsdSchemaRegistry;
149  USDUI_API
150  static const TfType &_GetStaticTfType();
151 
152  static bool _IsTypedSchema();
153 
154  // override SchemaBase virtuals.
155  USDUI_API
156  const TfType &_GetTfType() const override;
157 
158 public:
159  // --------------------------------------------------------------------- //
160  // DESCRIPTION
161  // --------------------------------------------------------------------- //
162  /// The text label that is displayed on the backdrop in the node
163  /// graph. This help-description explains what the nodes in a backdrop do.
164  ///
165  ///
166  /// | ||
167  /// | -- | -- |
168  /// | Declaration | `uniform token ui:description` |
169  /// | C++ Type | TfToken |
170  /// | \ref Usd_Datatypes "Usd Type" | SdfValueTypeNames->Token |
171  /// | \ref SdfVariability "Variability" | SdfVariabilityUniform |
172  USDUI_API
174 
175  /// See GetDescriptionAttr(), and also
176  /// \ref Usd_Create_Or_Get_Property for when to use Get vs Create.
177  /// If specified, author \p defaultValue as the attribute's default,
178  /// sparsely (when it makes sense to do so) if \p writeSparsely is \c true -
179  /// the default for \p writeSparsely is \c false.
180  USDUI_API
181  UsdAttribute CreateDescriptionAttr(VtValue const &defaultValue = VtValue(), bool writeSparsely=false) const;
182 
183 public:
184  // ===================================================================== //
185  // Feel free to add custom code below this line, it will be preserved by
186  // the code generator.
187  //
188  // Just remember to:
189  // - Close the class declaration with };
190  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
191  // - Close the include guard with #endif
192  // ===================================================================== //
193  // --(BEGIN CUSTOM CODE)--
194 };
195 
197 
198 #endif
static USDUI_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDUI_API UsdSchemaKind _GetSchemaKind() const override
virtual USDUI_API ~UsdUIBackdrop()
Destructor.
UsdUIBackdrop(const UsdSchemaBase &schemaObj)
Definition: backdrop.h:84
Represents a concrete typed schema.
Definition: prim.h:116
Definition: typed.h:44
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
static const UsdSchemaKind schemaKind
Definition: backdrop.h:70
Definition: path.h:273
UsdSchemaKind
Definition: common.h:112
#define USDUI_API
Definition: api.h:23
static USDUI_API UsdUIBackdrop Define(const UsdStagePtr &stage, const SdfPath &path)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
static USDUI_API UsdUIBackdrop Get(const UsdStagePtr &stage, const SdfPath &path)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
USDUI_API UsdAttribute GetDescriptionAttr() const
USDUI_API UsdAttribute CreateDescriptionAttr(VtValue const &defaultValue=VtValue(), bool writeSparsely=false) const
Definition: value.h:146
UsdUIBackdrop(const UsdPrim &prim=UsdPrim())
Definition: backdrop.h:76