-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathSeamsEasyNode.h
154 lines (122 loc) · 3.09 KB
/
SeamsEasyNode.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
#pragma once
#include "SSeamMesh.h"
#include <maya/MPxNode.h>
#include <maya/MItMeshPolygon.h>
#include <maya/MItMeshEdge.h>
#include <maya/MItMeshVertex.h>
#include <maya/MDagPath.h>
#include <maya/MNodeMessage.h>
#include <maya/MObjectArray.h>
#include <maya/MCallbackIdArray.h>
#include <set>
#include <map>
#include <deque>
class OffsetParams {
public:
OffsetParams() {
distance = depth = 0 ;
stitch = false;
index = 0;
};
OffsetParams(float setDistance, float setDepth, bool setStitch, unsigned int setIndex) {
distance = setDistance;
depth = setDepth;
stitch = setStitch;
index = setIndex;
};
OffsetParams(const OffsetParams ¶ms) {
distance = params.distance;
depth = params.depth;
stitch = params.stitch;
index = params.index;
}
OffsetParams& operator=(const OffsetParams& params) {
distance = params.distance;
depth = params.depth;
stitch = params.stitch;
index = params.index;
return *this;
}
bool operator< (const OffsetParams &op2) const{
float value1, value2;
switch (compare){
case kDepth:
value1 = depth;
value2 = op2.depth;
break;
case kIndex:
value1 = (float)index;
value2 = (float)op2.index;
break;
default:
value1 = distance;
value2 = op2.distance;
break;
}
return (value1 == value2) ? index < op2.index : value1 < value2;
}
float
distance,
depth;
bool
stitch;
unsigned int
index;
enum Compare{
kDistance,
kDepth,
kIndex
};
static Compare compare;
private:
};
class SeamsEasyNode : public MPxNode{
public:
SeamsEasyNode();
virtual ~SeamsEasyNode();
virtual void postConstructor();
static void *creator();
static MStatus initialize();
virtual MStatus setDependentsDirty(const MPlug &plug, MPlugArray &otherPlugs);
virtual MStatus compute(const MPlug &plug, MDataBlock &dataBlock);
float remap(const float srcMin, const float srcMax, const float trgMin, const float trgMax, float value);
static void attrChanged(MNodeMessage::AttributeMessage msg, MPlug &plug, MPlug &otherPlug, void *data);
static MTypeId id;
// Seam attributes
static MObject aOutMesh;
static MObject aOutStitchLines;
static MObject aInMesh;
static MObject aSelectedEdges;
static MObject aExtrudeAllBoundaries;
static MObject aExtrudeThickness;
static MObject aExtrudeDivisions;
static MObject aGap;
static MObject aProfileMode;
static MObject aOffset;
static MObject aOffsetDistance;
static MObject aOffsetDepth;
static MObject aOffsetStitch;
static MObject aDistanceMultiplier;
static MObject aDepthMultiplier;
static MObject aProfileWidth;
static MObject aProfileDepth;
static MObject aProfileSubdivs;
static MObject aProfileCurve;
static MObject aHardEdgeAngle;
private:
MObject
m_sourceMesh,
m_component;
SSeamMesh
m_baseMesh,
m_profileMesh;
std::map <unsigned int, MIntArray> m_loopEdges;
MCallbackIdArray callbackIds;
bool
dirtyMesh,
dirtyBaseMesh,
dirtyProfileMesh,
dirtyComponent,
dirtyExtrude,
dirtyProfile;
};