All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
readJob.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXRUSDMAYA_READ_JOB_H
25 #define PXRUSDMAYA_READ_JOB_H
26 
28 
29 #include "usdMaya/jobArgs.h"
31 
32 #include "pxr/pxr.h"
33 
34 #include "pxr/usd/usd/prim.h"
35 #include "pxr/usd/usd/primRange.h"
36 
37 #include <maya/MDagModifier.h>
38 #include <maya/MDagPath.h>
39 
40 #include <map>
41 #include <string>
42 #include <vector>
43 
44 PXR_NAMESPACE_OPEN_SCOPE
45 
46 
47 
48 class UsdMaya_ReadJob
49 {
50 public:
51  UsdMaya_ReadJob(
52  const std::string& iFileName,
53  const std::string& iPrimPath,
54  const std::map<std::string, std::string>& iVariants,
55  const UsdMayaJobImportArgs & iArgs);
56 
57  ~UsdMaya_ReadJob();
58 
61  bool Read(std::vector<MDagPath>* addedDagPaths);
62 
65  bool Redo();
66 
68  bool Undo();
69 
70  // Getters/Setters
71  void SetMayaRootDagPath(const MDagPath &mayaRootDagPath);
72 
73 private:
74  // XXX: Activating the 'Expanded' representation of a USD reference
75  // assembly node is very much like performing a regular UsdMaya_ReadJob but with
76  // a few key differences (e.g. creating proxy shapes at collapse points).
77  // These private helper methods cover the functionality of a regular
78  // usdImport, and an 'Expanded' representation-style import, respectively.
79  // It would be great if we could combine these into a single traversal at
80  // some point.
81  bool _DoImport(UsdPrimRange& range, const UsdPrim& usdRootPrim);
82  bool _DoImportWithProxies(UsdPrimRange& range);
83 
84  // These are helper methods for the proxy import method.
85  bool _ProcessProxyPrims(
86  const std::vector<UsdPrim>& proxyPrims,
87  const UsdPrim& pxrGeomRoot,
88  const std::vector<std::string>& collapsePointPathStrings);
89  bool _ProcessSubAssemblyPrims(const std::vector<UsdPrim>& subAssemblyPrims);
90  bool _ProcessCameraPrims(const std::vector<UsdPrim>& cameraPrims);
91 
92  // Data
93  UsdMayaJobImportArgs mArgs;
94  std::string mFileName;
95  std::string mPrimPath;
96  std::map<std::string,std::string> mVariants;
97  MDagModifier mDagModifierUndo;
98  bool mDagModifierSeeded;
99  UsdMayaPrimReaderContext::ObjectRegistry mNewNodeRegistry;
100  MDagPath mMayaRootDagPath;
101 };
102 
103 
104 PXR_NAMESPACE_CLOSE_SCOPE
105 
106 
107 #endif
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
An forward-iterable range that traverses a subtree of prims rooted at a given prim in depth-first ord...
Definition: primRange.h:118