AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Export.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 #include "AL/usdmaya/fileio/ExportParams.h"
18 #include "AL/usdmaya/fileio/translators/TranslatorBase.h"
19 
20 #include "maya/MPxCommand.h"
21 
22 #include "pxr/pxr.h"
23 #include "AL/usdmaya/utils/ForwardDeclares.h"
24 #include "AL/maya/utils/Api.h"
25 #include "AL/maya/utils/MayaHelperMacros.h"
26 
27 PXR_NAMESPACE_USING_DIRECTIVE
28 
29 
30 namespace AL {
31 namespace usdmaya {
32 namespace fileio {
33 
34 //----------------------------------------------------------------------------------------------------------------------
49 //----------------------------------------------------------------------------------------------------------------------
50 class Export
51 {
52 public:
53 
56  Export(const ExporterParams& params);
57 
59  ~Export();
60 
61 private:
62 
63  enum ReferenceType
64  {
65  kNoReference,
66  kShapeReference,
67  kTransformReference,
68  };
69 
70  void exportSceneHierarchy(MDagPath path, SdfPath& defaultPrim);
71  void exportShapesCommonProc(MDagPath shapePath, MFnTransform& fnTransform, SdfPath& usdPath, ReferenceType refType);
72  void exportShapesOnlyUVProc(MDagPath shapePath, MFnTransform& fnTransform, SdfPath& usdPath);
73  UsdPrim exportMeshUV(MDagPath path, const SdfPath& usdPath);
74  UsdPrim exportAssembly(MDagPath path, const SdfPath& usdPath);
75  UsdPrim exportPluginLocatorNode(MDagPath path, const SdfPath& usdPath);
76  UsdPrim exportPluginShape(MDagPath path, const SdfPath& usdPath);
77  void exportIkChain(MDagPath effectorPath, const SdfPath& usdPath);
78  void exportGeometryConstraint(MDagPath effectorPath, const SdfPath& usdPath);
79  void copyTransformParams(UsdPrim prim, MFnTransform& fnTransform);
80  SdfPath determineUsdPath(MDagPath path, const SdfPath& usdPath, ReferenceType refType);
81  void addReferences(MDagPath shapePath, MFnTransform& fnTransform, SdfPath& usdPath,
82  const SdfPath& instancePath, ReferenceType refType);
83  inline bool isPrimDefined(SdfPath &usdPath);
84  struct Impl;
85  void doExport();
86  const ExporterParams& m_params;
87  Impl* m_impl;
88  translators::TranslatorManufacture m_translatorManufacture;
89 
90 };
91 
92 //----------------------------------------------------------------------------------------------------------------------
95 //----------------------------------------------------------------------------------------------------------------------
97  : public MPxCommand
98 {
99 public:
100  AL_MAYA_DECLARE_COMMAND();
101 
103  ExportCommand();
104 
106  ~ExportCommand();
107 
108 private:
109  MStatus doIt(const MArgList& args);
110  MStatus redoIt();
111  MStatus undoIt();
112  bool isUndoable() const { return true; };
113  ExporterParams m_params;
114 };
115 
116 //----------------------------------------------------------------------------------------------------------------------
117 } // fileio
118 } // usdmaya
119 } // AL
120 //----------------------------------------------------------------------------------------------------------------------
parameters for the exporter. These parameters are constructed by any command or file translator that ...
Definition: ExportParams.h:35
A class that wraps up the entire export process.
Definition: Export.h:50
Export(const ExporterParams &params)
The constructor performs the export from Maya to USD based on the input parameters.
A thin MEL command layer that just wraps the AL::usdmaya::fileio::Export process. ...
Definition: Export.h:96
Forms a registry of all plug-in translator types registered.
Definition: TranslatorBase.h:246