aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveCallbacks.h
blob: 592a6c99dbfd6e70d2df174b08978c904a4bac9c (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
#ifndef shaveCallbacks_h
#define shaveCallbacks_h
// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include <maya/MMessage.h>

#if MAYA_API_VERSION < 20180000
class MObject;
#endif

class shaveCallbacks
{
public:
	static void endLoad(bool isImport, bool isReference);
	static void mayaExiting(void* clientData = NULL);
	static void	prepareForNewScene(bool firstTime);
	static void	registerCallbacks();
	static void	removeCallbacks();
	static void	setCleanUpMELOnExit(bool cleanUp)
											{ mCleanUpMELOnExit = cleanUp; }
	static void	startLoad();

private:
	//
	// Callback Methods
	//
	static void beforeExport(void* clientData);
	static void afterExport(void* clientData);

	static void beforeImport(void* clientData);
	static void afterImport(void* clientData);

	static void beforeImportReference(void* clientData);
	static void afterImportReference(void* clientData);

	static void afterNew(void* clientData);

	static void beforeOpen(void* clientData);
	static void afterOpen(void* clientData);

	static void beforeReference(void* clientData);
	static void afterReference(void* clientData);

	static void beforeSave(void* clientData);
	static void afterSave(void* clientData);

	static void nodeCreated(MObject& node, void* clientData);
	static void shaveNodeDeleted(MObject& node, void* clientData);

	static void selectionChanged(void* clientData);

	//
	// Utility Methods
	//
	static void	firstHairNode();
	static void	initializeHairNodes();
	static void removeCallback(MCallbackId& id);
	static void unlockShaveGlobals();
	static void updateNodeVersions();

	//
	// Member Variables
	//
	static bool	mCleanUpMELOnExit;

	//
	// Callback IDs
	//
	static MCallbackId	beforeExportID;
	static MCallbackId	afterExportID;

	static MCallbackId	beforeImportID;
	static MCallbackId	afterImportID;

	static MCallbackId	beforeImportRefID;
	static MCallbackId	afterImportRefID;

	static MCallbackId	beforeOpenID;
	static MCallbackId	afterOpenID;

	static MCallbackId	beforeReferenceID;
	static MCallbackId	afterReferenceID;

	static MCallbackId	beforeSaveID;
	static MCallbackId	afterSaveID;

	static MCallbackId	afterNewID;

	static MCallbackId	nodeCreatedID;
	static MCallbackId	shaveNodeDeletedID;

	static MCallbackId	mayaExitingID;
	static MCallbackId	selectionChangedID;
};

#endif