AL_USDMaya  0.16.6
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ProxyShapeCommands.h
1 #pragma once
2 #include "AL/usdmaya/fileio/ImportParams.h"
3 
4 #include "maya/MPxCommand.h"
5 #include "maya/MDagModifier.h"
6 #include "maya/MObject.h"
7 #include "maya/MObjectArray.h"
8 
9 #include "pxr/usd/usd/stage.h"
10 
11 #include <map>
12 
13 namespace AL {
14 namespace usdmaya {
15 namespace cmds {
16 
17 //----------------------------------------------------------------------------------------------------------------------
21 //----------------------------------------------------------------------------------------------------------------------
23  : public MPxCommand
24 {
25 public:
26 
29  static MSyntax setUpCommonSyntax();
30 
34  MDagPath getShapePath(const MArgDatabase& args);
35 
39  nodes::ProxyShape* getShapeNode(const MArgDatabase& args);
40 
44  UsdStageRefPtr getShapeNodeStage(const MArgDatabase& args);
45 
49  MArgDatabase makeDatabase(const MArgList& args);
50 };
51 
52 //----------------------------------------------------------------------------------------------------------------------
55 //----------------------------------------------------------------------------------------------------------------------
57  : public MPxCommand
58 {
59  MDagModifier m_modifier;
60  MDagModifier m_modifier2;
61  MObjectArray m_parentTransforms;
62  MObject m_shape;
63 public:
64  AL_MAYA_DECLARE_COMMAND();
65 private:
66  bool isUndoable() const override;
67  MStatus undoIt() override;
68  MStatus redoIt() override;
69  MStatus doIt(const MArgList& args) override;
70 };
71 
72 //----------------------------------------------------------------------------------------------------------------------
75 //----------------------------------------------------------------------------------------------------------------------
77  : public ProxyShapeCommandBase
78 {
79 public:
80  AL_MAYA_DECLARE_COMMAND();
81 private:
82  bool isUndoable() const override;
83  MStatus doIt(const MArgList& args) override;
84 };
85 
86 //----------------------------------------------------------------------------------------------------------------------
90 //----------------------------------------------------------------------------------------------------------------------
92  : public ProxyShapeCommandBase
93 {
94  MDagModifier m_modifier;
95  MDagModifier m_modifier2;
96 public:
97  AL_MAYA_DECLARE_COMMAND();
98 private:
99  bool isUndoable() const override;
100  MStatus undoIt() override;
101  MStatus redoIt() override;
102  MStatus doIt(const MArgList& args) override;
103 };
104 
105 //----------------------------------------------------------------------------------------------------------------------
109 //----------------------------------------------------------------------------------------------------------------------
111  : public ProxyShapeCommandBase
112 {
113  MDagModifier m_modifier;
114 public:
115  AL_MAYA_DECLARE_COMMAND();
116 private:
117  bool isUndoable() const override;
118  MStatus undoIt() override;
119  MStatus redoIt() override;
120  MStatus doIt(const MArgList& args) override;
121 };
122 
123 //----------------------------------------------------------------------------------------------------------------------
127 //----------------------------------------------------------------------------------------------------------------------
129  : public ProxyShapeCommandBase
130 {
131  MDagModifier m_modifier;
132  SdfPath m_path;
133  MDagPath m_transformPath;
134  fileio::ImporterParams m_importParams;
135  MObjectArray m_nodesToKill;
136  bool m_asProxyShape;
137 
138  MObject makePrimTansforms(
139  nodes::ProxyShape* shapeNode,
140  UsdPrim usdPrim);
141 
142  MObject makeUsdTransformChain(
143  std::map<std::string, MObject>& mapped,
144  const UsdPrim& usdPrim,
145  const MPlug& outStage,
146  const MPlug& outTime,
147  const MObject& parentXForm);
148 public:
149  AL_MAYA_DECLARE_COMMAND();
150 private:
151  bool isUndoable() const override;
152  MStatus undoIt() override;
153  MStatus redoIt() override;
154  MStatus doIt(const MArgList& args) override;
155 };
156 
157 //----------------------------------------------------------------------------------------------------------------------
160 //----------------------------------------------------------------------------------------------------------------------
162  : public ProxyShapeCommandBase
163 {
164 public:
165  AL_MAYA_DECLARE_COMMAND();
166 private:
167  bool isUndoable() const override;
168  MStatus doIt(const MArgList& args) override;
169 };
170 
175 
176 //----------------------------------------------------------------------------------------------------------------------
177 } // cmds
178 } // usdmaya
179 } // AL
180 //----------------------------------------------------------------------------------------------------------------------
MDagPath getShapePath(const MArgDatabase &args)
find the proxy shape node
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
parameters for the importer
Definition: ImportParams.h:18
void constructProxyShapeCommandGuis()
This function will generate all of the MEL script menus, and the option boxes, for all of the proxy s...
MArgDatabase makeDatabase(const MArgList &args)
construct the arg data base from the arguments maya passed to the MPxCommands doIt method...
ProxyShapeFindLoadable.
Definition: ProxyShapeCommands.h:76
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:56
ProxyShapePrintRefCountState.
Definition: ProxyShapeCommands.h:161
ProxyShapeImportAllTransforms From a proxy shape, this will import all usdPrims in the stage as AL_us...
Definition: ProxyShapeCommands.h:91
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:22
ProxyShapeImportPrimPathAsMaya A command that will import a portion of a proxyNode as Maya geometry/t...
Definition: ProxyShapeCommands.h:128
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:110