-
Notifications
You must be signed in to change notification settings - Fork 60
/
SubCommand.h
49 lines (38 loc) · 1.29 KB
/
SubCommand.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
#ifndef __SubCommand_h__
#define __SubCommand_h__
#include <maya/MObject.h>
#include <maya/MStatus.h>
#include "util.h"
class AssetNode;
class Asset;
class SubCommand
{
public:
SubCommand();
virtual ~SubCommand();
virtual MStatus doIt();
virtual MStatus redoIt();
virtual MStatus undoIt();
virtual bool isUndoable() const;
};
class SubCommandAsset : public SubCommand
{
public:
SubCommandAsset(const MObject &assetNodeObj);
protected:
AssetNode *getAssetNode() const;
Asset *getAsset() const;
protected:
MObject myAssetNodeObj;
};
#define GET_COMMAND_ASSET_OR_RETURN_FAIL() \
Asset *asset = getAsset(); \
if (!asset) \
{ \
MFnDependencyNode assetNodeFn(myAssetNodeObj); \
DISPLAY_ERROR("^1s: The node contains an invalid asset." \
" Check the OTL file path and asset name.", \
assetNodeFn.name()); \
return MStatus::kFailure; \
}
#endif