aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveBrushCtx.cpp
blob: 7dc451871af9127c797e2d81da453c47293e972c (plain) (blame)
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
// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include <iostream>
using namespace std;

#include <maya/MPxContext.h>
#include <maya/MString.h>

#include "shaveBrushCtx.h"
#include "shaveSDK.h"

const MString	shaveBrushCtx::mCtxTypeName = "shaveBrush";


shaveBrushCtx::shaveBrushCtx()
:   mBrushMode(kBrushTranslate)
{
	setTitleString("Shave Brush Tool");
	setImage("shaveBrush.xpm", MPxContext::kImage1);
}


shaveBrushCtx::~shaveBrushCtx()
{
}


MStatus shaveBrushCtx::strokeBegin(
	VERT& eyePoint, VERT& viewDir, VERT& upDir, VERT& screenPos, VERT& worldPos
)
{
	SHAVEsculpt_setup(
		mBrushMode,
		eyePoint,
		viewDir,
		upDir,
		screenPos,
		worldPos
	);

	return MS::kSuccess;
}


MStatus shaveBrushCtx::strokeDrag(
	VERT& screenPos, VERT& worldPos, VERT& screenDelta, VERT& worldDelta
)
{
	SHAVEsculpt_iterate(screenPos, worldPos, screenDelta, worldDelta);

	return MS::kSuccess;
}


MStatus shaveBrushCtx::strokeEnd()
{
	SHAVEsculpt_finish();

	return MS::kSuccess;
}