-
Notifications
You must be signed in to change notification settings - Fork 7
/
brushToolCommand.cpp
executable file
·136 lines (109 loc) · 2.95 KB
/
brushToolCommand.cpp
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
#include "brushContext.h"
#include "brushContextCommand.h"
#include "brushToolCommand.h"
#include <maya/MArgList.h>
brushToolCommand::brushToolCommand()
{
radius=50;
inten=1.0;
lockbase=true;
brushModeVal = 0; // comb
setCommandString("curveBrushToolCmd");
}
brushToolCommand::~brushToolCommand()
{}
void* brushToolCommand::creator()
{
return new brushToolCommand;
}
MStatus brushToolCommand::doIt(const MArgList& args)
{
return MS::kSuccess;
}
MStatus brushToolCommand::parseArgs(const MArgList& args)
{
MArgDatabase argData(syntax(), args);
MStatus status;
if (argData.isFlagSet(radiusFlag))
{
double tmp;
status=argData.getFlagArgument(radiusFlag, 0, tmp);
if (!status) {
status.perror("radius flag parsing failed");
return status;
}
radius=(float)tmp;
}
if (argData.isFlagSet(lockBaseFlag))
{
status=argData.getFlagArgument(lockBaseFlag, 0,lockbase);
if (!status) {
status.perror("lockbase flag parsing failed");
return status;
}
}
if (argData.isFlagSet(intensityFlag))
{
status=argData.getFlagArgument(intensityFlag, 0,inten);
if (!status) {
status.perror("intensity flag parsing failed");
return status;
}
}
if (argData.isFlagSet(brushModeFlag))
{
status=argData.getFlagArgument(brushModeFlag, 0,brushModeVal);
if (!status) {
status.perror("brush mode flag parsing failed");
return status;
}
}
return MS::kSuccess;
}
bool brushToolCommand::isUndoable() const
{
return true;
}
MStatus brushToolCommand::cancel()
{
return MS::kSuccess;
}
MStatus brushToolCommand::undoIt()
{
return MS::kSuccess;
}
MStatus brushToolCommand::finalize()
{
MArgList command;
command.addArg(commandString());
command.addArg(MString(radiusFlag));
command.addArg(radius);
command.addArg(MString(intensityFlag));
command.addArg(inten);
command.addArg(MString(lockBaseFlag));
command.addArg(lockbase);
command.addArg(MString(brushModeFlag));
command.addArg(brushModeVal);
return MPxToolCommand::doFinalize( command );
}
MSyntax brushToolCommand::newSyntax()
{
MSyntax syntax;
syntax.addFlag(radiusFlag, radiusLongFlag, MSyntax::kDouble);
syntax.addFlag(intensityFlag, intensityLongFlag, MSyntax::kDouble);
syntax.addFlag(lockBaseFlag, lockBaseLongFlag, MSyntax::kBoolean);
syntax.addFlag(brushModeFlag, brushModeLongFlag, MSyntax::kLong);
return syntax;
}
void brushToolCommand::setRadius(float newRadius)
{
radius = newRadius;
}
void brushToolCommand::setInten(double intensity)
{
inten=intensity;
}
void brushToolCommand::setBrushMode(int brushMode)
{
brushModeVal = brushMode;
}