forked from sideeffects/HoudiniEngineForMaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInput.h
94 lines (71 loc) · 2.1 KB
/
Input.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
#ifndef __Input_h__
#define __Input_h__
#include <vector>
#include <maya/MCallbackIdArray.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MMessage.h>
#include <maya/MPlug.h>
#include <HAPI/HAPI_Common.h>
class Input;
class Inputs
{
public:
Inputs(HAPI_NodeId nodeId);
~Inputs();
MStatus compute(MDataBlock &dataBlock);
void setNumInputs(int numInputs);
private:
HAPI_NodeId myNodeId;
typedef std::vector<Input*> AssetInputVector;
AssetInputVector myAssetInputs;
};
class Input
{
public:
enum AssetInputType
{
AssetInputType_Invalid,
AssetInputType_Mesh,
AssetInputType_Curve,
AssetInputType_Particle,
};
static Input* createAssetInput(AssetInputType assetInputType);
public:
Input();
virtual ~Input();
virtual AssetInputType assetInputType() const = 0;
HAPI_NodeId transformNodeId() const { return myTransformNodeId; };
HAPI_NodeId geometryNodeId() const { return myGeometryNodeId; };
void setInputName(
HAPI_AttributeOwner owner, int count,
const MPlug &plug
);
void setInputTransform(MDataHandle &dataHandle);
virtual void setInputGeo(
MDataBlock &dataBlock,
const MPlug &plug
) = 0;
protected:
void setTransformNodeId( HAPI_NodeId nodeId )
{
myTransformNodeId = nodeId;
};
void setGeometryNodeId( HAPI_NodeId nodeId )
{
myGeometryNodeId = nodeId;
};
private:
static void nameChangedCallback(
MObject &node, const MString &str, void *clientData
);
void addNameChangedCallback(MObject &node);
void removeNameChangedCallback();
private:
HAPI_NodeId myTransformNodeId;
HAPI_NodeId myGeometryNodeId;
MPlug myGeoPlug;
MCallbackIdArray myNameChangedCallbackIds;
MObject myNameChangedCallbackNode;
};
#endif