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