-
Notifications
You must be signed in to change notification settings - Fork 59
/
Asset.h
111 lines (84 loc) · 3.29 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
#ifndef __Asset_h__
#define __Asset_h__
#include <maya/MFnDependencyNode.h>
#include <maya/MObject.h>
#include <maya/MObjectArray.h>
#include <maya/MString.h>
#include <maya/MTime.h>
#include <HAPI/HAPI.h>
#include "AssetNodeOptions.h"
#include "OutputObject.h"
#include <memory>
#include <vector>
class Inputs;
class OutputMaterial;
class ParmNameCache;
class Asset
{
public:
Asset(const MString &otlFilePath, const MString &assetName);
~Asset();
bool isValid() const;
MString getOTLFilePath() const;
MString getAssetName() const;
MString getAssetHelpText() const;
MString getAssetHelpURL() const;
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,
AssetNodeOptions::AccessorDataBlock &options,
bool &needToSyncOutputs,
const bool needToRecomputeOutputData);
void computeMaterial(const MPlug &plug,
MDataBlock &data,
bool bakeTextures,
bool &needToSyncOutputs);
void fillParmNameCache();
void getParmValues(MDataBlock &dataBlock,
const MFnDependencyNode &nodeFn,
const std::vector<MObject> *attrs);
void setParmValues(MDataBlock &dataBlock,
const MFnDependencyNode &nodeFn,
const std::vector<MObject> *attrs,
bool checkMismatch);
MString getAttrNameFromParm(const HAPI_ParmInfo &parmInfo) const;
private:
void update();
void computeInstancerObjects(const MPlug &plug,
MDataBlock &data,
MIntArray &instancedObjIds,
MStringArray &instancedObjNames,
AssetNodeOptions::AccessorDataBlock &options,
bool &needToSyncOutputs,
const bool needToRecomputeOutputData);
void computeGeometryObjects(const MPlug &plug,
MDataBlock &data,
const MIntArray &instancedObjIds,
const MStringArray &instancedObjNames,
AssetNodeOptions::AccessorDataBlock &options,
bool &needToSyncOutputs,
const bool needToRecomputeOutputData);
private:
typedef std::vector<OutputObject *> OutputObjects;
typedef std::vector<OutputMaterial *> OutputMaterials;
MTime myTime;
MString myAssetName;
MString myAssetHelpText;
MString myAssetHelpURL;
HAPI_AssetInfo myAssetInfo;
bool myIsObjSubnet;
HAPI_NodeInfo myNodeInfo;
Inputs *myAssetInputs;
OutputObjects myObjects; // the OutputObject class contains a 1 to 1 map
// with HAPI_ObjectInfos.
OutputMaterials myMaterials;
std::unique_ptr<ParmNameCache> myParmNameCache;
};
#endif