HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pluginLight.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 USDLUX_GENERATED_PLUGINLIGHT_H
8 #define USDLUX_GENERATED_PLUGINLIGHT_H
9 
10 /// \file usdLux/pluginLight.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdLux/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
17 
19 
20 #include "pxr/base/vt/value.h"
21 
22 #include "pxr/base/gf/vec3d.h"
23 #include "pxr/base/gf/vec3f.h"
24 #include "pxr/base/gf/matrix4d.h"
25 
26 #include "pxr/base/tf/token.h"
27 #include "pxr/base/tf/type.h"
28 
30 
31 class SdfAssetPath;
32 
33 // -------------------------------------------------------------------------- //
34 // PLUGINLIGHT //
35 // -------------------------------------------------------------------------- //
36 
37 /// \class UsdLuxPluginLight
38 ///
39 /// Light that provides properties that allow it to identify an
40 /// external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be
41 /// provided to render delegates without the need to provide a schema
42 /// definition for the light's type.
43 ///
44 /// \see \ref usdLux_PluginSchemas
45 ///
46 ///
48 {
49 public:
50  /// Compile time constant representing what kind of schema this class is.
51  ///
52  /// \sa UsdSchemaKind
54 
55  /// Construct a UsdLuxPluginLight on UsdPrim \p prim .
56  /// Equivalent to UsdLuxPluginLight::Get(prim.GetStage(), prim.GetPath())
57  /// for a \em valid \p prim, but will not immediately throw an error for
58  /// an invalid \p prim
59  explicit UsdLuxPluginLight(const UsdPrim& prim=UsdPrim())
60  : UsdGeomXformable(prim)
61  {
62  }
63 
64  /// Construct a UsdLuxPluginLight on the prim held by \p schemaObj .
65  /// Should be preferred over UsdLuxPluginLight(schemaObj.GetPrim()),
66  /// as it preserves SchemaBase state.
67  explicit UsdLuxPluginLight(const UsdSchemaBase& schemaObj)
68  : UsdGeomXformable(schemaObj)
69  {
70  }
71 
72  /// Destructor.
74  virtual ~UsdLuxPluginLight();
75 
76  /// Return a vector of names of all pre-declared attributes for this schema
77  /// class and all its ancestor classes. Does not include attributes that
78  /// may be authored by custom/extended methods of the schemas involved.
80  static const TfTokenVector &
81  GetSchemaAttributeNames(bool includeInherited=true);
82 
83  /// Return a UsdLuxPluginLight holding the prim adhering to this
84  /// schema at \p path on \p stage. If no prim exists at \p path on
85  /// \p stage, or if the prim at that path does not adhere to this schema,
86  /// return an invalid schema object. This is shorthand for the following:
87  ///
88  /// \code
89  /// UsdLuxPluginLight(stage->GetPrimAtPath(path));
90  /// \endcode
91  ///
93  static UsdLuxPluginLight
94  Get(const UsdStagePtr &stage, const SdfPath &path);
95 
96  /// Attempt to ensure a \a UsdPrim adhering to this schema at \p path
97  /// is defined (according to UsdPrim::IsDefined()) on this stage.
98  ///
99  /// If a prim adhering to this schema at \p path is already defined on this
100  /// stage, return that prim. Otherwise author an \a SdfPrimSpec with
101  /// \a specifier == \a SdfSpecifierDef and this schema's prim type name for
102  /// the prim at \p path at the current EditTarget. Author \a SdfPrimSpec s
103  /// with \p specifier == \a SdfSpecifierDef and empty typeName at the
104  /// current EditTarget for any nonexistent, or existing but not \a Defined
105  /// ancestors.
106  ///
107  /// The given \a path must be an absolute prim path that does not contain
108  /// any variant selections.
109  ///
110  /// If it is impossible to author any of the necessary PrimSpecs, (for
111  /// example, in case \a path cannot map to the current UsdEditTarget's
112  /// namespace) issue an error and return an invalid \a UsdPrim.
113  ///
114  /// Note that this method may return a defined prim whose typeName does not
115  /// specify this schema class, in case a stronger typeName opinion overrides
116  /// the opinion at the current EditTarget.
117  ///
118  USDLUX_API
119  static UsdLuxPluginLight
120  Define(const UsdStagePtr &stage, const SdfPath &path);
121 
122 protected:
123  /// Returns the kind of schema this class belongs to.
124  ///
125  /// \sa UsdSchemaKind
126  USDLUX_API
127  UsdSchemaKind _GetSchemaKind() const override;
128 
129 private:
130  // needs to invoke _GetStaticTfType.
131  friend class UsdSchemaRegistry;
132  USDLUX_API
133  static const TfType &_GetStaticTfType();
134 
135  static bool _IsTypedSchema();
136 
137  // override SchemaBase virtuals.
138  USDLUX_API
139  const TfType &_GetTfType() const override;
140 
141 public:
142  // ===================================================================== //
143  // Feel free to add custom code below this line, it will be preserved by
144  // the code generator.
145  //
146  // Just remember to:
147  // - Close the class declaration with };
148  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
149  // - Close the include guard with #endif
150  // ===================================================================== //
151  // --(BEGIN CUSTOM CODE)--
152 
153  /// Convenience method for accessing the UsdShadeNodeDefAPI functionality
154  /// for this prim.
155  /// One can also construct a UsdShadeNodeDefAPI directly from a UsdPrim.
156  USDLUX_API
158 };
159 
161 
162 #endif
virtual USDLUX_API ~UsdLuxPluginLight()
Destructor.
UsdLuxPluginLight(const UsdPrim &prim=UsdPrim())
Definition: pluginLight.h:59
static USDLUX_API UsdLuxPluginLight Get(const UsdStagePtr &stage, const SdfPath &path)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
static USDLUX_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
#define USDLUX_API
Definition: api.h:23
Represents a concrete typed schema.
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Definition: path.h:273
UsdSchemaKind
Definition: common.h:112
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDLUX_API UsdSchemaKind _GetSchemaKind() const override
static const UsdSchemaKind schemaKind
Definition: pluginLight.h:53
UsdLuxPluginLight(const UsdSchemaBase &schemaObj)
Definition: pluginLight.h:67
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: type.h:47
static USDLUX_API UsdLuxPluginLight Define(const UsdStagePtr &stage, const SdfPath &path)
USDLUX_API UsdShadeNodeDefAPI GetNodeDefAPI() const