AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ProxyShapeCommands.h
1 //
2 // Copyright 2017 Animal Logic
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.//
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #pragma once
17 
18 #include "../Api.h"
19 
20 #include "AL/usdmaya/fileio/ImportParams.h"
21 #include "AL/usdmaya/nodes/ProxyShape.h"
22 
23 #include <map>
24 
25 #include "maya/MPxCommand.h"
26 #include "maya/MDagModifier.h"
27 #include "maya/MObject.h"
28 #include "maya/MObjectArray.h"
29 #include "maya/MSelectionList.h"
30 
31 #include "pxr/pxr.h"
32 #include "pxr/usd/usd/stage.h"
33 
34 PXR_NAMESPACE_USING_DIRECTIVE
35 
36 namespace AL {
37 namespace usdmaya {
38 namespace cmds {
39 
40 //----------------------------------------------------------------------------------------------------------------------
44 //----------------------------------------------------------------------------------------------------------------------
46  : public MPxCommand
47 {
48 public:
49 
52  static MSyntax setUpCommonSyntax();
53 
57  MDagPath getShapePath(const MArgDatabase& args);
58 
62  nodes::ProxyShape* getShapeNode(const MArgDatabase& args);
63 
67  UsdStageRefPtr getShapeNodeStage(const MArgDatabase& args);
68 
72  MArgDatabase makeDatabase(const MArgList& args);
73 };
74 
75 //----------------------------------------------------------------------------------------------------------------------
78 //----------------------------------------------------------------------------------------------------------------------
80  : public MPxCommand
81 {
82  MDagModifier m_modifier;
83  MDagModifier m_modifier2;
84  MObjectArray m_parentTransforms;
85  MObject m_shape;
86  MString m_proxy_name;
87  bool m_createdParent = true;
88 public:
89  AL_MAYA_DECLARE_COMMAND();
90 private:
91  bool isUndoable() const override;
92  MStatus undoIt() override;
93  MStatus redoIt() override;
94  MStatus doIt(const MArgList& args) override;
95 };
96 
97 //----------------------------------------------------------------------------------------------------------------------
100 //----------------------------------------------------------------------------------------------------------------------
102  : public ProxyShapeCommandBase
103 {
104 public:
105  AL_MAYA_DECLARE_COMMAND();
106 private:
107  bool isUndoable() const override;
108  MStatus doIt(const MArgList& args) override;
109 };
110 
111 //----------------------------------------------------------------------------------------------------------------------
115 //----------------------------------------------------------------------------------------------------------------------
117  : public ProxyShapeCommandBase
118 {
119  MDagModifier m_modifier;
120  MDagModifier m_modifier2;
121 public:
122  AL_MAYA_DECLARE_COMMAND();
123 private:
124  bool isUndoable() const override;
125  MStatus undoIt() override;
126  MStatus redoIt() override;
127  MStatus doIt(const MArgList& args) override;
128 };
129 
130 //----------------------------------------------------------------------------------------------------------------------
134 //----------------------------------------------------------------------------------------------------------------------
136  : public ProxyShapeCommandBase
137 {
138  MDagModifier m_modifier;
139 public:
140  AL_MAYA_DECLARE_COMMAND();
141 private:
142  bool isUndoable() const override;
143  MStatus undoIt() override;
144  MStatus redoIt() override;
145  MStatus doIt(const MArgList& args) override;
146 };
147 
148 //----------------------------------------------------------------------------------------------------------------------
152 //----------------------------------------------------------------------------------------------------------------------
154  : public ProxyShapeCommandBase
155 {
156  MDagModifier m_modifier;
157  SdfPath m_path;
158  MDagPath m_transformPath;
159  fileio::ImporterParams m_importParams;
160  MObjectArray m_nodesToKill;
161  bool m_asProxyShape;
162 
163  MObject makePrimTansforms(
164  nodes::ProxyShape* shapeNode,
165  UsdPrim usdPrim);
166 
167  MObject makeUsdTransformChain(
168  std::map<std::string, MObject>& mapped,
169  const UsdPrim& usdPrim,
170  const MPlug& outStage,
171  const MPlug& outTime,
172  const MObject& parentXForm);
173 public:
174  AL_MAYA_DECLARE_COMMAND();
175 private:
176  bool isUndoable() const override;
177  MStatus undoIt() override;
178  MStatus redoIt() override;
179  MStatus doIt(const MArgList& args) override;
180 };
181 
182 //----------------------------------------------------------------------------------------------------------------------
185 //----------------------------------------------------------------------------------------------------------------------
187  : public ProxyShapeCommandBase
188 {
189 public:
190  AL_MAYA_DECLARE_COMMAND();
191 private:
192  bool isUndoable() const override;
193  MStatus doIt(const MArgList& args) override;
194 };
195 
196 //----------------------------------------------------------------------------------------------------------------------
199 //----------------------------------------------------------------------------------------------------------------------
201  : public ProxyShapeCommandBase
202 {
203  SdfPath m_resyncPrimPath;
204  UsdPrim m_resyncPrim;
205  nodes::ProxyShape* m_shapeNode;
206  bool m_runPrePrimChanged;
207  bool m_runPostPrimChanged;
208 public:
209  AL_MAYA_DECLARE_COMMAND();
210 private:
211  bool isUndoable() const override;
212  MStatus doIt(const MArgList& args) override;
213  MStatus redoIt() override;
214 };
215 
216 //----------------------------------------------------------------------------------------------------------------------
219 //----------------------------------------------------------------------------------------------------------------------
221  : public ProxyShapeCommandBase
222 {
223  nodes::SelectionUndoHelper* m_helper;
224 public:
225  ProxyShapeSelect () : m_helper(0) {}
226  ~ProxyShapeSelect() { delete m_helper; }
227  AL_MAYA_DECLARE_COMMAND();
228 private:
229  bool isUndoable() const override;
230  MStatus doIt(const MArgList& args) override;
231  MStatus undoIt() override;
232  MStatus redoIt() override;
233  MStatus _redoIt(bool isInternal);
234 };
235 
236 //----------------------------------------------------------------------------------------------------------------------
239 //----------------------------------------------------------------------------------------------------------------------
241  : public ProxyShapeCommandBase
242 {
243  nodes::ProxyShape* m_proxy;
244 public:
246  AL_MAYA_DECLARE_COMMAND();
247 private:
248  bool isUndoable() const override;
249  MStatus doIt(const MArgList& args) override;
250  MStatus undoIt() override;
251  MStatus redoIt() override;
252 };
253 
254 //----------------------------------------------------------------------------------------------------------------------
257 //----------------------------------------------------------------------------------------------------------------------
259  : public ProxyShapeCommandBase
260 {
261  nodes::ProxyShape* m_proxy;
262  nodes::SelectionList m_previous;
263  nodes::SelectionList m_new;
264 public:
265  AL_MAYA_DECLARE_COMMAND();
266 private:
267  bool isUndoable() const override;
268  MStatus doIt(const MArgList& args) override;
269  MStatus undoIt() override;
270  MStatus redoIt() override;
271 };
272 
273 
274 //----------------------------------------------------------------------------------------------------------------------
277 //----------------------------------------------------------------------------------------------------------------------
279  : public ProxyShapeCommandBase
280 {
282 
283  nodes::ProxyShape* m_proxy;
284  SdfPathVector m_importPaths;
285  SdfPathVector m_teardownPaths;
286 
287 public:
288  AL_MAYA_DECLARE_COMMAND();
289 private:
290  bool isUndoable() const override;
291  MStatus doIt(const MArgList& args) override;
292  MStatus redoIt() override;
293 };
294 
295 
299 AL_USDMAYA_PUBLIC
301 
304 AL_USDMAYA_PUBLIC
306 
307 //----------------------------------------------------------------------------------------------------------------------
308 } // cmds
309 } // usdmaya
310 } // AL
311 //----------------------------------------------------------------------------------------------------------------------
MDagPath getShapePath(const MArgDatabase &args)
find the proxy shape node
ProxyShapeResync.
Definition: ProxyShapeCommands.h:200
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:244
parameters for the importer
Definition: ImportParams.h:40
ProxyShapeSelect.
Definition: ProxyShapeCommands.h:240
ProxyShapeSelect.
Definition: ProxyShapeCommands.h:220
Transient aggregate of values that aims to direct the Translation of Prims. Typically an object of th...
Definition: TranslatorContext.h:54
TranslatePrim.
Definition: ProxyShapeCommands.h:278
AL_USDMAYA_PUBLIC void constructProxyShapeCommandGuis()
This function will generate all of the MEL script menus, and the option boxes, for all of the proxy s...
InternalProxyShapeSelect.
Definition: ProxyShapeCommands.h:258
MArgDatabase makeDatabase(const MArgList &args)
construct the arg data base from the arguments maya passed to the MPxCommands doIt method...
ProxyShapeFindLoadable.
Definition: ProxyShapeCommands.h:101
Used as a way to construct a simple selection list that allows for selection highlighting without cre...
Definition: ProxyShape.h:124
static MSyntax setUpCommonSyntax()
sets up some core/common command params - enables specification of selectin list as a command argumen...
Imports a proxy shape into maya.
Definition: ProxyShapeCommands.h:79
ProxyShapePrintRefCountState.
Definition: ProxyShapeCommands.h:186
ProxyShapeImportAllTransforms From a proxy shape, this will import all usdPrims in the stage as AL_us...
Definition: ProxyShapeCommands.h:116
UsdStageRefPtr getShapeNodeStage(const MArgDatabase &args)
get the USD stage
Base class for all proxy shape commands. Sets up some common command syntax, along with a few handy u...
Definition: ProxyShapeCommands.h:45
ProxyShapeImportPrimPathAsMaya A command that will import a portion of a proxyNode as Maya geometry/t...
Definition: ProxyShapeCommands.h:153
A helper class to store the state that is modified during a change to the current selection within a ...
Definition: ProxyShape.h:87
nodes::ProxyShape * getShapeNode(const MArgDatabase &args)
find the proxy shape nodeata base
ProxyShapeRemoveAllTransforms A command that will remove all AL::usdmaya::nodes::Transform nodes from...
Definition: ProxyShapeCommands.h:135
AL_USDMAYA_PUBLIC void constructPickModeCommandGuis()
Construct menu and commands for setting pick modes.