All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usdPreviewSurface.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 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 PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_H
25 #define PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxrUsdPreviewSurface/api.h"
31 
32 #include "pxr/base/tf/staticTokens.h"
33 
34 #include <maya/MDataBlock.h>
35 #include <maya/MObject.h>
36 #include <maya/MPlug.h>
37 #include <maya/MPxNode.h>
38 #include <maya/MStatus.h>
39 #include <maya/MString.h>
40 #include <maya/MTypeId.h>
41 
42 
43 PXR_NAMESPACE_OPEN_SCOPE
44 
45 
46 #define PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_TOKENS \
47  ((MayaTypeName, "pxrUsdPreviewSurface")) \
48  ((ClearcoatAttrName, "clearcoat")) \
49  ((ClearcoatRoughnessAttrName, "clearcoatRoughness")) \
50  ((DiffuseColorAttrName, "diffuseColor")) \
51  ((DisplacementAttrName, "displacement")) \
52  ((EmissiveColorAttrName, "emissiveColor")) \
53  ((IorAttrName, "ior")) \
54  ((MetallicAttrName, "metallic")) \
55  ((NormalAttrName, "normal")) \
56  ((OcclusionAttrName, "occlusion")) \
57  ((OpacityAttrName, "opacity")) \
58  ((RoughnessAttrName, "roughness")) \
59  ((SpecularColorAttrName, "specularColor")) \
60  ((UseSpecularWorkflowAttrName, "useSpecularWorkflow")) \
61  ((OutColorAttrName, "outColor")) \
62  ((OutTransparencyAttrName, "outTransparency"))
63 
65  PxrMayaUsdPreviewSurfaceTokens,
66  PXRUSDPREVIEWSURFACE_API,
67  PXRUSDPREVIEWSURFACE_USD_PREVIEW_SURFACE_TOKENS);
68 
69 
70 class PxrMayaUsdPreviewSurface : public MPxNode
71 {
72  public:
73  PXRUSDPREVIEWSURFACE_API
74  static const MTypeId typeId;
75  PXRUSDPREVIEWSURFACE_API
76  static const MString typeName;
77 
78  PXRUSDPREVIEWSURFACE_API
79  static const MString drawDbClassification;
80  PXRUSDPREVIEWSURFACE_API
81  static const MString fullClassification;
82 
83  // Attributes
84  PXRUSDPREVIEWSURFACE_API
85  static MObject clearcoatAttr;
86  PXRUSDPREVIEWSURFACE_API
87  static MObject clearcoatRoughnessAttr;
88  PXRUSDPREVIEWSURFACE_API
89  static MObject diffuseColorAttr;
90  PXRUSDPREVIEWSURFACE_API
91  static MObject displacementAttr;
92  PXRUSDPREVIEWSURFACE_API
93  static MObject emissiveColorAttr;
94  PXRUSDPREVIEWSURFACE_API
95  static MObject iorAttr;
96  PXRUSDPREVIEWSURFACE_API
97  static MObject metallicAttr;
98  PXRUSDPREVIEWSURFACE_API
99  static MObject normalAttr;
100  PXRUSDPREVIEWSURFACE_API
101  static MObject occlusionAttr;
102  PXRUSDPREVIEWSURFACE_API
103  static MObject opacityAttr;
104  PXRUSDPREVIEWSURFACE_API
105  static MObject roughnessAttr;
106  PXRUSDPREVIEWSURFACE_API
107  static MObject specularColorAttr;
108  PXRUSDPREVIEWSURFACE_API
109  static MObject useSpecularWorkflowAttr;
110 
111  // Output Attributes.
112  PXRUSDPREVIEWSURFACE_API
113  static MObject outColorAttr;
114  PXRUSDPREVIEWSURFACE_API
115  static MObject outTransparencyAttr;
116 
117  PXRUSDPREVIEWSURFACE_API
118  static void* creator();
119 
120  PXRUSDPREVIEWSURFACE_API
121  static MStatus initialize();
122 
123  PXRUSDPREVIEWSURFACE_API
124  void postConstructor() override;
125 
126  PXRUSDPREVIEWSURFACE_API
127  MStatus compute(const MPlug& plug, MDataBlock& dataBlock) override;
128 
129  private:
130  PxrMayaUsdPreviewSurface();
131  ~PxrMayaUsdPreviewSurface() override;
132 
133  PxrMayaUsdPreviewSurface(const PxrMayaUsdPreviewSurface&) = delete;
134  PxrMayaUsdPreviewSurface& operator=(
135  const PxrMayaUsdPreviewSurface&) = delete;
136 };
137 
138 
139 PXR_NAMESPACE_CLOSE_SCOPE
140 
141 
142 #endif
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118