AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LayerCommands.h
1 #pragma once
2 #include "AL/usdmaya/Common.h"
3 
4 #include "maya/MDGModifier.h"
5 #include "maya/MObject.h"
6 #include "maya/MPxCommand.h"
7 
8 #include "pxr/usd/usd/stage.h"
9 
10 namespace AL {
11 namespace usdmaya {
12 namespace cmds {
13 //----------------------------------------------------------------------------------------------------------------------
16 //----------------------------------------------------------------------------------------------------------------------
18  : public MPxCommand
19 {
20 public:
21 
25  static MSyntax setUpCommonSyntax();
26 
30  nodes::ProxyShape* getShapeNode(const MArgDatabase& args);
31 
35  UsdStageRefPtr getShapeNodeStage(const MArgDatabase& args);
36 
40  MArgDatabase makeDatabase(const MArgList& args);
41 
46  MObject getSelectedNode(const MArgDatabase& args, const MTypeId typeId);
47 };
48 
49 //----------------------------------------------------------------------------------------------------------------------
52 //----------------------------------------------------------------------------------------------------------------------
54  : public LayerCommandBase
55 {
56 public:
57  AL_MAYA_DECLARE_COMMAND();
58 private:
59  bool isUndoable() const override;
60  MStatus doIt(const MArgList& args) override;
61 };
62 
63 //----------------------------------------------------------------------------------------------------------------------
66 //----------------------------------------------------------------------------------------------------------------------
68  : public LayerCommandBase
69 {
70  UsdStageRefPtr m_stage;
71  SdfLayerHandle m_rootLayer;
72  MString m_layerName;
73  MString m_filePath;
74  MObject m_layerNode;
75  nodes::Layer* m_newLayer;
76  nodes::Layer* m_parentLayer;
77  nodes::ProxyShape* m_shape;
78  bool m_isOpening;
79 
80 public:
81  AL_MAYA_DECLARE_COMMAND();
82 private:
83  bool isUndoable() const override;
84  MStatus undoIt() override;
85  MStatus redoIt() override;
86  MStatus doIt(const MArgList& args) override;
87 };
88 
89 //----------------------------------------------------------------------------------------------------------------------
92 //----------------------------------------------------------------------------------------------------------------------
93 class LayerSave
94  : public LayerCommandBase
95 {
96 public:
97  AL_MAYA_DECLARE_COMMAND();
98 private:
99  bool isUndoable() const override;
100  MStatus doIt(const MArgList& args) override;
101 };
102 
103 //----------------------------------------------------------------------------------------------------------------------
106 //----------------------------------------------------------------------------------------------------------------------
108  : public LayerCommandBase
109 {
110 public:
111  AL_MAYA_DECLARE_COMMAND();
112 private:
113  bool isUndoable() const override;
114  MStatus doIt(const MArgList& args) override;
115 };
116 
117 //----------------------------------------------------------------------------------------------------------------------
120 //----------------------------------------------------------------------------------------------------------------------
122  : public LayerCommandBase
123 {
124  LayerCurrentEditTarget(): m_usdLayer(nullptr){}
125  UsdEditTarget previous;
126  UsdEditTarget next;
127  UsdStageRefPtr stage;
128  nodes::Layer* m_usdLayer;
129  bool isQuery;
130  bool previouslyAnEditTarget;
131 public:
132  AL_MAYA_DECLARE_COMMAND();
133 private:
134  bool isUndoable() const override;
135  MStatus doIt(const MArgList& args) override;
136  MStatus undoIt() override;
137  MStatus redoIt() override;
138  PcpNodeRef determineEditTargetMapping(UsdStageRefPtr stage, const MArgDatabase& args, SdfLayerHandle editTargetLayer) const;
139 };
140 
141 //----------------------------------------------------------------------------------------------------------------------
144 //----------------------------------------------------------------------------------------------------------------------
146  : public LayerCommandBase
147 {
148  SdfLayerHandle m_layer;
149  bool m_muted;
150 public:
151  AL_MAYA_DECLARE_COMMAND();
152 private:
153  bool isUndoable() const override;
154  MStatus doIt(const MArgList& args) override;
155  MStatus undoIt() override;
156  MStatus redoIt() override;
157 };
158 
162 
163 //----------------------------------------------------------------------------------------------------------------------
164 } // cmds
165 } // usdmaya
166 } // AL
167 //----------------------------------------------------------------------------------------------------------------------
MObject getSelectedNode(const MArgDatabase &args, const MTypeId typeId)
hunt for the first node of the specified type found in the selection list object args ...
Given some selected proxy shape node, return the layer names.
Definition: LayerCommands.h:53
nodes::ProxyShape * getShapeNode(const MArgDatabase &args)
find the proxy shape node from a valid pre-parsed arg database
A custom proxy shape node that attaches itself to a USD file, and then renders it. The stage is held internally as a member variable, and it will be composed based on a change to the "filePath" attribute.
Definition: ProxyShape.h:33
void constructLayerCommandGuis()
function called on startup to generate the menu & option boxes for the layer commands ...
Get / Set whether the layer is currently muted.
Definition: LayerCommands.h:145
Export a layer to the given filename.
Definition: LayerCommands.h:107
static MSyntax setUpCommonSyntax()
sets up some core/common command params for all the layer commands. Just specifies that selection can...
Helper class.
Definition: LayerCommands.h:17
MArgDatabase makeDatabase(const MArgList &args)
construct the arg data base from an args list. If any errors are found during parsing, an error will be thrown
UsdStageRefPtr getShapeNodeStage(const MArgDatabase &args)
get the USD stage
Save the specified layer.
Definition: LayerCommands.h:93
The layer node stores a reference to an SdfLayer.
Definition: Layer.h:20
Given some selected proxy shape node, create a new sub layer for the current edit target...
Definition: LayerCommands.h:67
Get / Set the current edit target for the stage.
Definition: LayerCommands.h:121