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

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

#include "shaveGlobals.h"
#include "shaveIcon.h"
#include "shaveIconCmd.h"


const MString shaveIconCmd::commandName("shaveIcon");

static const char*	kNeedsReloadLong	= "-needsReload";
static const char*	kNeedsReloadShort	= "-nr";


shaveIconCmd::shaveIconCmd()	{}
shaveIconCmd::~shaveIconCmd()	{}


void* shaveIconCmd::createCmd()
{
	return new shaveIconCmd();
}


MSyntax shaveIconCmd::createSyntax()
{
	MSyntax	syntax;

	syntax.enableEdit(false);
	syntax.enableQuery(true);

	syntax.addFlag(kNeedsReloadShort, kNeedsReloadLong, MSyntax::kString);

	return syntax;
}


MStatus shaveIconCmd::doIt(const MArgList& argList)
{
	MStatus 		status;
	MArgDatabase	args(syntax(), argList, &status);

	if (!status) return status;

	shaveGlobals::getGlobals();

	if (args.isFlagSet(kNeedsReloadShort))
	{
		MString	iconFile;

		args.getFlagArgument(kNeedsReloadShort, 0, iconFile);
		setResult(shaveIcon::needsReload(iconFile));
	}

	return status;
}