aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveGlobals.h
blob: 8a1cfb6c949f59979b6f57daaeba45476e58380c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#ifndef _SHAVEGLOBALS_H_
#define _SHAVEGLOBALS_H_

// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include <maya/MDagPathArray.h>
#include <maya/MPxNode.h>

#define	DRA_OPTIONAL	0

#include "shaveConstant.h"
#include "shaveSDK.h"

#define _FILEVERSION 1
#define kStringLength   512

#if MAYA_API_VERSION < 20180000
class MDataBlock;
class MDataHandle;
class MDGContext;
class MDGModifier;
class MPlug;
#endif

class shaveGlobals : public MPxNode
{
public:
	typedef enum
	{
		kFrames,
		kSeconds
	} RibTimeUnits;

	enum ShadowQuality
	{
		kLowShadowQuality		= 1,
		kMediumShadowQuality	= 2,
		kHighShadowQuality		= 3
	};

	typedef struct
	{
		bool						composite2d;
		bool						doCompositing;
		bool						doHairShadows;
		bool						enableInstanceGeometry;
		bool						fastBrush;
		float						gravity;
		int							glinst;
		MString						hairFileNamePrefix;
		bool						keepHairRenderFiles;
		bool						liveMode;
		int							maxThreads;
		shaveConstant::RenderMode	normalRenderMode;
		MString						occlusionObjects;
		short						renderQuality;
		float						shadowDensity;
		bool						shadowMatte;
		bool						shadowMatteIncludeBackfacing;
		MString						statFileDir;
		bool						threadPerProcessor;
		unsigned int				tileMemoryLimit;
		unsigned int				transparencyDepth;
		bool						useAllLights;
		bool						useDeepShadows;
		bool						useDRA;
		bool						useNativeIllumination;
		bool						verbose;
		bool						visibleInReflections;
		int							voxelResolution;
		float						voxelScaling;

		struct
		{
			bool					binary;
			bool					compress;
			MString					filePreamble;
			bool					keepRibFiles;
            MString                 libOverride;
			bool					normals;
			bool					opacities;
			short					primitiveType;
			bool					rootPositions;
			bool					rootTipColors;
			RibTimeUnits			timeUnits;
			bool					uvCoords;
			MString					uvSet;
			bool					vertexColors;
			bool					wCoords;

			struct
			{
				bool				enable;
				short				inheritSettings;
				bool				restoreFrame;
				float				shutterCloseOffset;
				float				shutterOpenOffset;
				short				timeBasis;
			} blur;

			struct
			{
				bool				enable;
				bool				fullPaths;
				short				resolution;
			} voxels;
		} rib;

		bool cameraVis;
		bool lightVis;
		bool giVis;

		//
		// Semi-Deprecated
		//
		float						shadowHairRatio;
		bool						useGeomShadows;
	} Globals;

	shaveGlobals();
	virtual			~shaveGlobals() {};
	static void*	creator();

	bool			deleteMe(MDGModifier& dgMod);
	static MStatus	initialize();
	void*			getAddress();
	static MObject	getDefaultNode();
	static MStatus	getGlobals();
	static MStatus	getGlobals(Globals& globals);
	int				getNodeVersion() const			{ return mNodeVersion; }

#if MAYA_API_VERSION >= 201600
	virtual SchedulingType	schedulingType() const { return kUntrusted; }
#endif

	MStatus			shouldSave(const MPlug& plug, bool& saveIt);

#if MAYA_API_VERSION >= 2018000
	virtual bool	getInternalValue(
						const MPlug &plug,
						MDataHandle &hdl
					);

	virtual bool	setInternalValue(
						const MPlug &plug,
						const MDataHandle &hdl
					);
#else
	virtual	bool	getInternalValueInContext(
						const MPlug& plug,
						MDataHandle& hdl,
						MDGContext& context
					);

	virtual	bool	setInternalValueInContext(
						const MPlug& plug,
						const MDataHandle& hdl,
						MDGContext& context
					);
#endif

    virtual	MStatus	setDependentsDirty(
						const MPlug& dirty,
						MPlugArray& affected
					);

	static MTypeId			id;
	static const MString	nodeTypeName;
	static const MString	defaultNodeName;
	static const int		kNodeVersion;

	//
	//	Attributes
	//
	static MObject aAddress;
	static MObject aComposite2d;
	static MObject aDisplayGuides;
	static MObject aDisplayGuideThick;
	static MObject aDisplaySegmentLimit;
	static MObject aDoCompositing;
	static MObject aDoHairShadows;
	static MObject aEnableInstanceGeometry;
	static MObject aGravity;
	static MObject aGlInst;
	static MObject aHairFilename;
	static MObject aHairOcclusionObjects;
	static MObject aHideHair;
	static MObject aInfo1;
	static MObject aInfo2;
	static MObject aKeepHairRenderFiles;
	static MObject aLiveMode;
	static MObject aLiveModeRecord;
	static MObject aLiveModePlayback;
	static MObject aMaxThreads;
	static MObject aNativeIllumination;
	static MObject aNodeVersion;
	static MObject aNormalRenderMode;
	static MObject aPrimCameraVis;
	static MObject aPrimGiVis;
	static MObject aPrimLightVis;
	static MObject aRenderQuality;
	static MObject aRibBinary;
	static MObject aRibBlurEnable;
	static MObject aRibBlurInheritSettings;
	static MObject aRibBlurRestoreFrame;
	static MObject aRibBlurShutterCloseOffset;
	static MObject aRibBlurShutterOpenOffset;
	static MObject aRibBlurTimeBasis;
	static MObject aRibCompress;
	static MObject aRibKeepRibFiles;
    static MObject aRibLibOverride;
	static MObject aRibNormals;
	static MObject aRibOpacities;
	static MObject aRibPrimitiveType;
	static MObject aRibRootPositions;
	static MObject aRibRootTipColors;
	static MObject aRibStuff;
	static MObject aRibTimeUnits;
	static MObject aRibVertexColors;
	static MObject aRibUVs;
	static MObject aRibUVSet;
	static MObject aRibWCoords;
	static MObject aRibVoxelEnable;
	static MObject aRibVoxelFullPaths;
	static MObject aRibVoxelResolution;
	static MObject aShadowMatte;
	static MObject aShadowMatteIncludeBackfacing;
	static MObject aShadowDensity;
	static MObject aStatFileDir;
	static MObject aThreadPerProcessor;
	static MObject aTileMemoryLimit;
	static MObject aTransparencyDepth;
	static MObject aUseAllLights;
	static MObject aUseDRA;
	static MObject aVerbose;
	static MObject aVisibleInReflections;
	static MObject aVoxelResolution;
	static MObject aVoxelScaling;

	//default dra file name, 
	//artist can edit it to resolve confilt when rendering 
	//multiple scenes on same machine -- dub|23-09-2010
	static MObject aVrayDraFile;

	static MObject displayHairRatioAttr;
	static MObject displayHiarDoXparency;	
	static MObject displayDoFallbackAttr;
	static MObject displayFallbackRatioAttr;


	//
	// Semi-Deprecated Attributes
	//
	// (Functionality present but hidden in case we change our minds.)
	//
	static MObject aShadowHairRatio;
	static MObject aUseGeomForShadows;


	//
	// Fully Deprecated Attributes
	//
	static MObject aActiveShaveNode;
	static MObject aCurrentShaveNode;
	static MObject aDisplayDensity;
	static MObject aDisplayHairDoSsao;	
	static MObject aFastBrush;
	static MObject aGenerateHairGeometry;
	static MObject aInstanceRenderMode;
	static MObject aMREnableIrradiance;
	static MObject aMRIrradiance;
	static MObject aMROcclusionCollection;
	static MObject aMRSafeMode;
	static MObject aMRSatelliteSupport;
	static MObject aMRUseRenderGlobalsCallbacks;
	static MObject aPrmanCurvesSupported;
	static MObject aRibBlurUseMayaDefaults;
	static MObject aRibUseRenderGlobalsCallbacks;
	static MObject aShadowAntiAlias;
	static MObject aShadowQuality;
	static MObject aShaveLightList;
	static MObject aShavePrmanMode;
	static MObject aShaveShadowFuzz;
	static MObject aShaveShadowRes;
	static MObject aShaveShadowSamples;
	static MObject aTileCount;
	static MObject aTrigger;
	static MObject aUseDeepShadows;

protected:
	static MObject	getDefaultNodeInternal();
	MStatus			getGlobalsInternal();
	MStatus			getGlobalsInternal(Globals& globals);
	void			hideHair();

	bool						mHideHair;
	int							mNodeVersion;
	shaveConstant::RenderMode	mNormalRenderMode;
};


extern bool		doHairShadowsGlob;
extern bool		doShaveCompsGlob;
extern bool		doShaveComp2dGlob;
extern bool		enableInstanceGeometryGlob;
extern float	gravityGlob;
extern int		glisntGlob;
extern MString	hairFileNameGlob;
extern bool		keepHairRenderFilesGlob;
extern bool		nativeIlluminationGlob;
extern bool		liveModeGlob;
extern bool		displayGuidesGlob;
extern float	guideThickGlob;
extern bool		doFallbackGlob;
//extern bool		hideHairGlob;
extern float	displayRatioGlob;
extern float    fallbackRatioGlob;
extern float	displaySegmentLimitGlob;
extern bool		doHairXparencyGlob;
extern bool		liveModeRecord;
extern bool		liveModePlayback;
extern int		maxThreadsGlob;
extern short	renderQualityGlob;
extern bool		shadowRender;
extern MString	shaveSceneObjectsGlob;
extern float	shaveShadowDensityGlob;
extern bool		shaveShadowMatteGlob;
extern MString	tmpDirGlob;
extern bool		threadPerProcessorGlob;
extern bool		useAllLightsGlob;
extern bool		useDeepShadowsGlob;
extern bool		useDRAGlob;
extern bool		visibleInReflectionsGlob;
extern int		voxelResolutionGlob;

//
// Semi-Deprecated
//
extern float	shaveShadowHairRatioGlob;
extern bool		shaveUseGeomShadowsGlob;

//
// These is the raw render mode.  Normally you should not use this
// directly but use the mode returned by a call to the getRenderMode()
// method of an instance of shaveRenderer.
//
extern shaveConstant::RenderMode normalRenderModeGlob;


short buildh(char*);
short buildk(short);
#endif