aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveNodeCmd.h
blob: abafa14c858841e383d347496ae9ce7e25405013 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef shaveNodeCmd_h
#define shaveNodeCmd_h

// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include <maya/MArgList.h>
#include <maya/MPxCommand.h>
#include <maya/MSyntax.h>
#include <maya/MString.h>

#if MAYA_API_VERSION < 20180000
class MArgDatabase;
class MDagModifier;
class MDGModifier;
#endif

class shaveHairShape;


class shaveNodeCmd : public MPxCommand
{
public:
					shaveNodeCmd();
	virtual			~shaveNodeCmd();

	static	MStatus	copyInputConnections(
						MDGModifier& dgMod,
						MObject srcNode,
						MObject destNode,
						MObject attr
					);

	static void*	createCmd();
	MStatus			doIt( const MArgList& args );
	bool			isUndoable() const;
	static MSyntax	createSyntax();


	static const MString	commandName;

private:
	void			displayInputConnection(
						MObject node, MObject attr, MString indent
					);

	MStatus			doEditFlags(
						const MArgDatabase& args, shaveHairShape* nodePtr
					);

	MStatus			doQueryFlags(
						const MArgDatabase& args, shaveHairShape* nodePtr
					);

	//	Fills 'curves' with dag paths for all of the curves passed to
	//	the command using the '-curve' flag. If any of the curves are
	//	invalid then 'curves' will be empty and MS::kInvalidParameter will
	//	be returned.
	MStatus			getCurves(const MArgDatabase& args, MDagPathArray& curves);

	MDagPath		getParentTransform(
						const MArgDatabase& args, MDagModifier& dm, MStatus& st
					);

	shaveHairShape*	getShaveNode(const MArgDatabase& args);

	static MVector	interpolate(
						const MVector& p1,
						const MVector& p2,
						const MVector& p3,
						const MVector& p4,
						double u
					);

	MString			stripNode(MString plugName);
};


inline bool shaveNodeCmd::isUndoable() const
{	return false;	}

#endif