All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
writeJob.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_WRITE_JOB_H
25 #define PXRUSDMAYA_WRITE_JOB_H
26 
28 
29 #include "usdMaya/chaser.h"
30 #include "usdMaya/util.h"
32 
33 #include "pxr/pxr.h"
34 
35 #include "pxr/base/tf/hashmap.h"
36 
37 #include <maya/MObjectHandle.h>
38 
39 #include <string>
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
44 
45 class UsdMaya_WriteJob
46 {
47 public:
48  UsdMaya_WriteJob(const UsdMayaJobExportArgs & iArgs);
49 
50  ~UsdMaya_WriteJob();
51 
57  bool Write(const std::string& fileName, bool append);
58 
59 private:
62  bool _BeginWriting(const std::string& fileName, bool append);
63 
68  bool _WriteFrame(double iFrame);
69 
72  bool _FinishWriting();
73 
75  TfToken _WriteVariants(const UsdPrim &usdRootPrim);
76 
78  void _CreatePackage() const;
79 
80  void _PerFrameCallback(double iFrame);
81  void _PostCallback();
82 
83  bool _CheckNameClashes(const SdfPath &path, const MDagPath &dagPath);
84 
85  // Name of the created/appended USD file
86  std::string _fileName;
87 
88  // Name of destination packaged archive.
89  std::string _packageName;
90 
91  // Name of current layer since it should be restored after looping over them
92  MString mCurrentRenderLayerName;
93 
94  // List of renderLayerObjects. Currently used for variants
95  MObjectArray mRenderLayerObjs;
96 
97  UsdMayaUtil::MDagPathMap<SdfPath> mDagPathToUsdPathMap;
98 
99  // Currently only used if stripNamespaces is on, to ensure we don't have clashes
100  TfHashMap<SdfPath, MDagPath, SdfPath::Hash> mUsdPathToDagPathMap;
101 
102  UsdMayaChaserRefPtrVector mChasers;
103 
104  UsdMayaWriteJobContext mJobCtx;
105 
106  std::unique_ptr<UsdMaya_ModelKindProcessor> _modelKindProcessor;
107 };
108 
109 
110 PXR_NAMESPACE_CLOSE_SCOPE
111 
112 #endif
Provides basic functionality and access to shared data for UsdMayaPrimWriters.
std::map< MDagPath, V, _CmpDag > MDagPathMap
Mapping of DAG paths to an arbitrary type.
Definition: util.h:97
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
This class encapsulates all of the logic for writing model kinds from UsdMaya_WriteJob.