forked from sideeffects/HoudiniEngineForMaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Asset.h
117 lines (89 loc) · 3.04 KB
/
Asset.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
#ifndef __Asset_h__
#define __Asset_h__
#include <maya/MObjectArray.h>
#include <maya/MObject.h>
#include <maya/MString.h>
#include <maya/MTime.h>
#include <maya/MFnDependencyNode.h>
#include <HAPI/HAPI.h>
#include "OutputObject.h"
#include <vector>
class Inputs;
class OutputMaterial;
class Asset {
public:
Asset(
const MString &otlFilePath,
const MString &assetName,
const MObject &node
);
~Asset();
bool isValid() const;
MString getOTLFilePath() const;
MString getAssetName() const;
OutputObject* findObjectByName(MString name);
OutputObject* findObjectById(int id);
HAPI_AssetInfo getAssetInfo() { return myAssetInfo; }
HAPI_NodeInfo getNodeInfo() { return myNodeInfo; }
MString getRelativePath(HAPI_NodeId id);
void resetSimulation();
MString getCookMessages();
MTime getTime() const;
void setTime(
const MTime &mayaTime
);
void setInputs(const MPlug& plug, MDataBlock& data);
MStatus compute(
const MPlug& plug,
MDataBlock& data,
bool splitGeosByGroup,
bool cookTemplatedGeos,
bool useInstancerNode,
bool &needToSyncOutputs
);
void getParmValues(
MDataBlock &dataBlock,
const MFnDependencyNode &nodeFn,
const std::vector<MObject>* attrs
);
void setParmValues(
MDataBlock &dataBlock,
const MFnDependencyNode &nodeFn,
const std::vector<MObject>* attrs
);
private:
void update();
void computeInstancerObjects(
const MPlug& plug,
MDataBlock& data,
MIntArray &instancedObjIds,
MStringArray &instancedObjNames,
bool &needToSyncOutputs
);
void computeGeometryObjects(
const MPlug& plug,
MDataBlock& data,
const MIntArray &instancedObjIds,
const MStringArray &instancedObjNames,
bool &needToSyncOutputs
);
void computeMaterial(
const MPlug& plug,
MDataBlock& data,
bool &needToSyncOutputs
);
private:
typedef std::vector<HAPI_ObjectInfo> ObjectInfos;
typedef std::vector<OutputObject*> OutputObjects;
typedef std::vector<OutputMaterial*> OutputMaterials;
MTime myTime;
HAPI_AssetInfo myAssetInfo;
bool myIsObjSubnet;
HAPI_NodeInfo myNodeInfo;
ObjectInfos myObjectInfos;
MObject myNode; //The Maya asset node
Inputs* myAssetInputs;
OutputObjects myObjects; //the OutputObject class contains a 1 to 1 map with HAPI_ObjectInfos.
OutputMaterials myMaterials;
};
#endif