forked from sideeffects/HoudiniEngineForMaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AssetNode.h
272 lines (225 loc) · 8.8 KB
/
AssetNode.h
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
#ifndef __AssetNode_h__
#define __AssetNode_h__
#include <maya/MPxTransform.h>
#include <maya/MTypeId.h>
#include <vector>
class Asset;
#ifdef WIN32
// Workaround the deprecation warning for MPxNode::internalArrayCount()
#pragma warning( push )
#pragma warning( disable: 4266 )
#endif
class AssetNode: public MPxTransform
{
public:
static void* creator();
static MStatus initialize();
public:
static MString typeName;
static MTypeId typeId;
static void nodeAdded(MObject& node,void *clientData);
static void nodeRemoved(MObject& node,void *clientData);
public:
AssetNode();
virtual ~AssetNode();
virtual void postConstructor();
virtual MStatus compute(const MPlug& plug, MDataBlock& data);
#if MAYA_API_VERSION >= 201800
virtual bool getInternalValue(
const MPlug &plug,
MDataHandle &dataHandle);
virtual bool setInternalValue(
const MPlug &plug,
const MDataHandle &dataHandle);
virtual int internalArrayCount(const MPlug &plug) const;
#else
virtual bool getInternalValueInContext(
const MPlug &plug,
MDataHandle &dataHandle,
MDGContext &ctx);
virtual bool setInternalValueInContext(
const MPlug &plug,
const MDataHandle &dataHandle,
MDGContext &ctx
);
virtual int internalArrayCount(const MPlug &plug, const MDGContext &ctx) const;
#endif
virtual void copyInternalData(MPxNode* node);
virtual MStatus setDependentsDirty(const MPlug& plugBeingDirtied,
MPlugArray& affectedPlugs);
virtual MStatus connectionBroken (
const MPlug & plug,
const MPlug & otherPlug,
bool asSrc
);
virtual MStatus shouldSave(
const MPlug & plug,
bool & isSaving
);
#if MAYA_API_VERSION >= 201600
virtual MStatus preEvaluation(
const MDGContext& context,
const MEvaluationNode& evaluationNode
);
#endif
Asset* getAsset() const;
void rebuildAsset();
void setParmValues(bool onlyDirtyParms = true);
void getParmValues();
int autoSyncId() const
{ return myAutoSyncId; }
private:
Asset* myAsset;
bool isAssetValid() const;
void createAsset();
void destroyAsset();
void setParmValues(MDataBlock& data, bool onlyDirtyParms = true);
void getParmValues(MDataBlock& data);
MString myOTLFilePath;
MString myAssetName;
bool mySetAllParms;
bool myNeedToMarshalInput;
int myAutoSyncId;
typedef std::vector<MObject> MObjectVector;
MObjectVector myDirtyParmAttributes;
public:
static MObject inTime;
static MObject otlFilePath;
static MObject assetName;
static MObject input;
static MObject inputName;
static MObject inputNodeId;
static MObject output;
static MObject outputAssetTransform;
static MObject outputAssetTranslate;
static MObject outputAssetTranslateX;
static MObject outputAssetTranslateY;
static MObject outputAssetTranslateZ;
static MObject outputAssetRotate;
static MObject outputAssetRotateX;
static MObject outputAssetRotateY;
static MObject outputAssetRotateZ;
static MObject outputAssetScale;
static MObject outputAssetScaleX;
static MObject outputAssetScaleY;
static MObject outputAssetScaleZ;
static MObject outputObjects;
static MObject outputObjectName;
static MObject outputObjectTransform;
static MObject outputObjectTranslate;
static MObject outputObjectTranslateX;
static MObject outputObjectTranslateY;
static MObject outputObjectTranslateZ;
static MObject outputObjectRotate;
static MObject outputObjectRotateX;
static MObject outputObjectRotateY;
static MObject outputObjectRotateZ;
static MObject outputObjectScale;
static MObject outputObjectScaleX;
static MObject outputObjectScaleY;
static MObject outputObjectScaleZ;
#if MAYA_API_VERSION >= 201400
static MObject outputObjectFluidFromAsset;
#endif
static MObject outputObjectMetaData;
static MObject outputGeos;
static MObject outputGeoName;
static MObject outputGeoIsTemplated;
static MObject outputGeoIsDisplayGeo;
static MObject outputParts;
static MObject outputPartName;
static MObject outputPartHasMesh;
static MObject outputPartHasParticles;
static MObject outputPartHasInstancer;
static MObject outputPartMesh;
static MObject outputPartMeshCurrentColorSet;
static MObject outputPartMeshCurrentUV;
static MObject outputPartMeshData;
static MObject outputPartParticle;
static MObject outputPartParticleCurrentTime;
static MObject outputPartParticlePositions;
static MObject outputPartParticleArrayData;
static MObject outputPartCurves;
static MObject outputPartCurvesIsBezier;
#if MAYA_API_VERSION >= 201400
static MObject outputPartVolume;
static MObject outputPartVolumeName;
static MObject outputPartVolumeGrid;
static MObject outputPartVolumeRes;
static MObject outputPartVolumeTransform;
static MObject outputPartVolumeTranslate;
static MObject outputPartVolumeTranslateX;
static MObject outputPartVolumeTranslateY;
static MObject outputPartVolumeTranslateZ;
static MObject outputPartVolumeRotate;
static MObject outputPartVolumeRotateX;
static MObject outputPartVolumeRotateY;
static MObject outputPartVolumeRotateZ;
static MObject outputPartVolumeScale;
static MObject outputPartVolumeScaleX;
static MObject outputPartVolumeScaleY;
static MObject outputPartVolumeScaleZ;
#endif
static MObject outputPartInstancer;
static MObject outputPartInstancerArrayData;
static MObject outputPartLockTracking;
static MObject outputPartInstancerParts;
static MObject outputPartInstancerTransform;
static MObject outputPartInstancerTranslate;
static MObject outputPartInstancerTranslateX;
static MObject outputPartInstancerTranslateY;
static MObject outputPartInstancerTranslateZ;
static MObject outputPartInstancerRotate;
static MObject outputPartInstancerRotateX;
static MObject outputPartInstancerRotateY;
static MObject outputPartInstancerRotateZ;
static MObject outputPartInstancerScale;
static MObject outputPartInstancerScaleX;
static MObject outputPartInstancerScaleY;
static MObject outputPartInstancerScaleZ;
static MObject outputPartMaterialIds;
static MObject outputPartExtraAttributes;
static MObject outputPartExtraAttributeName;
static MObject outputPartExtraAttributeOwner;
static MObject outputPartExtraAttributeDataType;
static MObject outputPartExtraAttributeTuple;
static MObject outputPartExtraAttributeData;
static MObject outputPartGroups;
static MObject outputPartGroupName;
static MObject outputPartGroupType;
static MObject outputPartGroupMembers;
static MObject outputVisibility;
static MObject outputIsInstanced;
//static MObject numObjects;
static MObject outputInstancers;
static MObject outputInstancerData;
static MObject outputInstancedObjectNames;
static MObject outputHoudiniInstanceAttribute;
static MObject outputHoudiniNameAttribute;
static MObject outputInstanceTransform;
static MObject outputInstanceTranslate;
static MObject outputInstanceTranslateX;
static MObject outputInstanceTranslateY;
static MObject outputInstanceTranslateZ;
static MObject outputInstanceRotate;
static MObject outputInstanceRotateX;
static MObject outputInstanceRotateY;
static MObject outputInstanceRotateZ;
static MObject outputInstanceScale;
static MObject outputInstanceScaleX;
static MObject outputInstanceScaleY;
static MObject outputInstanceScaleZ;
static MObject outputMaterials;
static MObject outputMaterialPath;
static MObject outputMaterialName;
static MObject outputMaterialNodeId;
static MObject outputMaterialAmbientColor;
static MObject outputMaterialDiffuseColor;
static MObject outputMaterialSpecularColor;
static MObject outputMaterialAlphaColor;
static MObject outputMaterialTexturePath;
};
#ifdef WIN32
#pragma warning( pop )
#endif
#endif