-
Notifications
You must be signed in to change notification settings - Fork 60
/
Input.h
97 lines (72 loc) · 2.4 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
95
96
97
#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 setUnlockNormals(bool unlockNormals);
void setMatPerFace(bool matPerFace);
void setAllowFacetSet(bool allowFacetSet);
void setPreserveScale(bool preserveScale);
void setInputName(HAPI_AttributeOwner owner, int count, const MPlug &plug);
void setInputTransform(MDataHandle &dataHandle);
virtual void setInputGeo(MDataBlock &dataBlock, const MPlug &plug) = 0;
virtual void setInputComponents(MDataBlock &dataBlock,
const MPlug &geoPlug,
const MPlug &compPlug,
const MPlug &primGroupPlug,
const MPlug &pointGroupPlug);
protected:
void setTransformNodeId(HAPI_NodeId nodeId) { myTransformNodeId = nodeId; };
void setGeometryNodeId(HAPI_NodeId nodeId) { myGeometryNodeId = nodeId; };
bool myUnlockNormals;
bool myMatPerFace;
bool myAllowFacetSet;
bool myPreserveScale;
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