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 USDLUX_GENERATED_VOLUMELIGHTAPI_H
25 #define USDLUX_GENERATED_VOLUMELIGHTAPI_H
26 
27 /// \file usdLux/volumeLightAPI.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usdLux/api.h"
31 #include "pxr/usd/usd/apiSchemaBase.h"
32 #include "pxr/usd/usd/prim.h"
33 #include "pxr/usd/usd/stage.h"
34 #include "pxr/usd/usdLux/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 
45 PXR_NAMESPACE_OPEN_SCOPE
46 
47 class SdfAssetPath;
48 
49 // -------------------------------------------------------------------------- //
50 // VOLUMELIGHTAPI                                                             //
51 // -------------------------------------------------------------------------- //
52 
53 /// \class UsdLuxVolumeLightAPI
54 ///
55 /// This is the preferred API schema to apply to
56 /// \ref UsdVolVolume "Volume" type prims when adding light behaviors to a
57 /// volume. At its base, this API schema has the built-in behavior of applying
58 /// LightAPI to the volume and overriding the default materialSyncMode to allow
59 /// the emission/glow of the bound material to affect the color of the light.
60 /// But, it additionally serves as a hook for plugins to attach additional
61 /// properties to "volume lights" through the creation of API schemas which are
62 /// authored to auto-apply to VolumeLightAPI.
63 /// \see \ref Usd_AutoAppliedAPISchemas
64 ///
65 ///
66 /// For any described attribute \em Fallback \em Value or \em Allowed \em Values below
67 /// that are text/tokens, the actual token is published and defined in \ref UsdLuxTokens.
68 /// So to set an attribute to the value "rightHanded", use UsdLuxTokens->rightHanded
69 /// as the value.
70 ///
71 class UsdLuxVolumeLightAPI : public UsdAPISchemaBase
72 {
73 public:
74     /// Compile time constant representing what kind of schema this class is.
75     ///
76     /// \sa UsdSchemaKind
77     static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
78 
79     /// Construct a UsdLuxVolumeLightAPI on UsdPrim \p prim .
80     /// Equivalent to UsdLuxVolumeLightAPI::Get(prim.GetStage(), prim.GetPath())
81     /// for a \em valid \p prim, but will not immediately throw an error for
82     /// an invalid \p prim
83     explicit UsdLuxVolumeLightAPI(const UsdPrim& prim=UsdPrim())
UsdAPISchemaBase(prim)84         : UsdAPISchemaBase(prim)
85     {
86     }
87 
88     /// Construct a UsdLuxVolumeLightAPI on the prim held by \p schemaObj .
89     /// Should be preferred over UsdLuxVolumeLightAPI(schemaObj.GetPrim()),
90     /// as it preserves SchemaBase state.
UsdLuxVolumeLightAPI(const UsdSchemaBase & schemaObj)91     explicit UsdLuxVolumeLightAPI(const UsdSchemaBase& schemaObj)
92         : UsdAPISchemaBase(schemaObj)
93     {
94     }
95 
96     /// Destructor.
97     USDLUX_API
98     virtual ~UsdLuxVolumeLightAPI();
99 
100     /// Return a vector of names of all pre-declared attributes for this schema
101     /// class and all its ancestor classes.  Does not include attributes that
102     /// may be authored by custom/extended methods of the schemas involved.
103     USDLUX_API
104     static const TfTokenVector &
105     GetSchemaAttributeNames(bool includeInherited=true);
106 
107     /// Return a UsdLuxVolumeLightAPI holding the prim adhering to this
108     /// schema at \p path on \p stage.  If no prim exists at \p path on
109     /// \p stage, or if the prim at that path does not adhere to this schema,
110     /// return an invalid schema object.  This is shorthand for the following:
111     ///
112     /// \code
113     /// UsdLuxVolumeLightAPI(stage->GetPrimAtPath(path));
114     /// \endcode
115     ///
116     USDLUX_API
117     static UsdLuxVolumeLightAPI
118     Get(const UsdStagePtr &stage, const SdfPath &path);
119 
120 
121     /// Returns true if this <b>single-apply</b> API schema can be applied to
122     /// the given \p prim. If this schema can not be a applied to the prim,
123     /// this returns false and, if provided, populates \p whyNot with the
124     /// reason it can not be applied.
125     ///
126     /// Note that if CanApply returns false, that does not necessarily imply
127     /// that calling Apply will fail. Callers are expected to call CanApply
128     /// before calling Apply if they want to ensure that it is valid to
129     /// apply a schema.
130     ///
131     /// \sa UsdPrim::GetAppliedSchemas()
132     /// \sa UsdPrim::HasAPI()
133     /// \sa UsdPrim::CanApplyAPI()
134     /// \sa UsdPrim::ApplyAPI()
135     /// \sa UsdPrim::RemoveAPI()
136     ///
137     USDLUX_API
138     static bool
139     CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
140 
141     /// Applies this <b>single-apply</b> API schema to the given \p prim.
142     /// This information is stored by adding "VolumeLightAPI" to the
143     /// token-valued, listOp metadata \em apiSchemas on the prim.
144     ///
145     /// \return A valid UsdLuxVolumeLightAPI object is returned upon success.
146     /// An invalid (or empty) UsdLuxVolumeLightAPI object is returned upon
147     /// failure. See \ref UsdPrim::ApplyAPI() for conditions
148     /// resulting in failure.
149     ///
150     /// \sa UsdPrim::GetAppliedSchemas()
151     /// \sa UsdPrim::HasAPI()
152     /// \sa UsdPrim::CanApplyAPI()
153     /// \sa UsdPrim::ApplyAPI()
154     /// \sa UsdPrim::RemoveAPI()
155     ///
156     USDLUX_API
157     static UsdLuxVolumeLightAPI
158     Apply(const UsdPrim &prim);
159 
160 protected:
161     /// Returns the kind of schema this class belongs to.
162     ///
163     /// \sa UsdSchemaKind
164     USDLUX_API
165     UsdSchemaKind _GetSchemaKind() const override;
166 
167 private:
168     // needs to invoke _GetStaticTfType.
169     friend class UsdSchemaRegistry;
170     USDLUX_API
171     static const TfType &_GetStaticTfType();
172 
173     static bool _IsTypedSchema();
174 
175     // override SchemaBase virtuals.
176     USDLUX_API
177     const TfType &_GetTfType() const override;
178 
179 public:
180     // ===================================================================== //
181     // Feel free to add custom code below this line, it will be preserved by
182     // the code generator.
183     //
184     // Just remember to:
185     //  - Close the class declaration with };
186     //  - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
187     //  - Close the include guard with #endif
188     // ===================================================================== //
189     // --(BEGIN CUSTOM CODE)--
190 };
191 
192 PXR_NAMESPACE_CLOSE_SCOPE
193 
194 #endif
195