AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Import.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/ImportParams.h"
18 #include "AL/usdmaya/fileio/NodeFactory.h"
19 #include "AL/usdmaya/fileio/translators/TranslatorBase.h"
20 
21 #include "maya/MPxCommand.h"
22 
23 #include "pxr/pxr.h"
24 #include <pxr/base/tf/token.h>
25 #include <pxr/base/tf/hashmap.h>
26 #include "AL/usdmaya/utils/ForwardDeclares.h"
27 #include "AL/maya/utils/Api.h"
28 #include "AL/maya/utils/MayaHelperMacros.h"
29 
30 PXR_NAMESPACE_USING_DIRECTIVE
31 
32 
33 namespace AL {
34 namespace usdmaya {
35 namespace fileio {
36 
37 //----------------------------------------------------------------------------------------------------------------------
40 //----------------------------------------------------------------------------------------------------------------------
41 class Import
42 {
43 public:
44 
48  Import(const ImporterParams& params);
49 
51  ~Import();
52 
54  inline operator bool () const
55  { return m_success; }
56 
57 private:
58  void doImport();
59  MObject createShape(translators::TranslatorRefPtr translator, const UsdPrim& prim, MObject parent, bool parentUnmerged);
60  const ImporterParams& m_params;
61  TfHashMap<SdfPath, MObject, SdfPath::Hash> m_instanceObjects;
62  TfToken::HashSet m_nonImportablePrims;
63  bool m_success;
64 };
65 
66 //----------------------------------------------------------------------------------------------------------------------
69 //----------------------------------------------------------------------------------------------------------------------
71  : public MPxCommand
72 {
73 public:
74  AL_MAYA_DECLARE_COMMAND();
75 
77  inline ImportCommand()
78  : m_params() {}
79 
81  inline ~ImportCommand()
82  {}
83 
84 private:
85  MStatus doIt(const MArgList& args);
86  MStatus redoIt();
87  MStatus undoIt();
88  bool isUndoable() const { return true; };
89  ImporterParams m_params;
90 };
91 
92 //----------------------------------------------------------------------------------------------------------------------
93 } // fileio
94 } // usdmaya
95 } // AL
96 //----------------------------------------------------------------------------------------------------------------------
97 
parameters for the importer
Definition: ImportParams.h:40
Import(const ImporterParams &params)
the ctor runs the main import process. Simply pass in a set of parameters that will determine what ma...
~ImportCommand()
dtor
Definition: Import.h:81
ImportCommand()
ctor
Definition: Import.h:77
A command to import a USD file into Maya (partially supporting Animal Logic specific things) ...
Definition: Import.h:70
A class that performs the import of data from USD into Maya.
Definition: Import.h:41