-
Notifications
You must be signed in to change notification settings - Fork 7
/
brushContext.h
executable file
·106 lines (94 loc) · 3.39 KB
/
brushContext.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
#ifndef brushContext_Header__
#define brushContext_Header__
#include <maya/MPxContext.h>
#include <maya/MToolsInfo.h>
#include <maya/MDagPath.h>
#include <maya/MDagPathArray.h>
#include <maya/MPlug.h>
#include <maya/MEvent.h>
#include <maya/MString.h>
#include <maya/MEvent.h>
#include <maya/MStatus.h>
#include <maya/MCursor.h>
#include <maya/M3dView.h>
#include <maya/MGlobal.h>
#include <maya/MColor.h>
#include <maya/MItSelectionList.h>
#include <maya/MFnNurbsCurve.h>
#include <maya/MFnCamera.h>
#include <maya/MPoint.h>
#include <maya/MPointArray.h>
#include <maya/MVector.h>
#include <maya/MVectorArray.h>
#include <maya/MFnDagNode.h>
// openGL is diff per platform
#ifdef WIN32
#include <WindowsX.h>
#include <windows.h>
#include <gl/GLU.h>
#elseif defined(OSMac_MachO_)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#include <GL/glx.h>
#endif
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <map>
class brushContext : public MPxContext
{
public:
brushContext();
void toolOnSetup(MEvent &newEvent);
void toolOffCleanup();
MStatus doEnterRegion ( MEvent &newEvent );
MStatus doPress( MEvent &newEvent );
MStatus doRelease( MEvent &newEvent );
MStatus doDrag( MEvent &newEvent );
MStatus doHold( MEvent &newEvent );
MStatus helpStateHasChanged( MEvent &newEvent );
private:
M3dView view;
MDagPathArray dagPathArray;
float PI;
bool lockBase;
bool interactiveResize;
short int cursorX,cursorY,oldCursorX,oldCursorY;
float Radius;
bool intensitySwitch;
double intensity;
bool firstDraw;
int brushMode;
std::map<unsigned int, MIntArray> cvsInCircle;
float brushMag;
MVector dir3d;
public:
void updateGuidLine(void);
MStatus getSelectedCurves(MDagPathArray &curvePathArray);
MStatus checkCv(MDagPathArray PathArray,std::map<unsigned int,MIntArray> &cvLib );
MStatus updateCurve(MDagPathArray &curvePathArray,std::map<unsigned int,MIntArray> &cvLib);
MStatus updatePosition(MFnNurbsCurve &ptsCurve, int cvNum, double mag, MVector dir3d );
MStatus storePosition();
MStatus restorePosition();
MStatus comb(MDagPathArray &curvePathArray,std::map<unsigned int,MIntArray> &cvLib);
MStatus pullEnds(MDagPathArray &curvePathArray,std::map<unsigned int,MIntArray> &cvLib);
MStatus straighten(MDagPathArray &curvePathArray,std::map<unsigned int,MIntArray> &cvLib);
MStatus scaleCurve(MDagPathArray &curvePathArray,std::map<unsigned int,MIntArray> &cvLib);
// add more brush functions here
void resizeBrush();
void setInteractive(bool interactive);
bool getInteractive(void);
void setRadius(float radius);
float getRadius(void);
void setLockBase(bool lock);
bool getLockBase(void);
void setBrushMode(unsigned int mode);
int getBrushMode(void);
void setIntensity(double nIntensity);
double getIntensity(void);
void resetIntensity();
void getClassName( MString & name ) const;
};
#endif