All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
jobArgs.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_JOB_ARGS_H
25 #define PXRUSDMAYA_JOB_ARGS_H
26 
28 
29 #include "usdMaya/api.h"
30 #include "usdMaya/util.h"
31 
32 #include "pxr/pxr.h"
33 
34 #include "pxr/base/tf/staticTokens.h"
35 #include "pxr/base/tf/token.h"
36 
37 #include "pxr/usd/sdf/path.h"
38 
39 #include <maya/MString.h>
40 
41 #include <map>
42 #include <ostream>
43 #include <set>
44 #include <string>
45 #include <vector>
46 
47 
48 PXR_NAMESPACE_OPEN_SCOPE
49 
50 
51 #define PXRUSDMAYA_TRANSLATOR_TOKENS \
52  ((UsdFileExtensionDefault, "usd")) \
53  ((UsdFileExtensionASCII, "usda")) \
54  ((UsdFileExtensionCrate, "usdc")) \
55  ((UsdFileExtensionPackage, "usdz")) \
56  ((UsdReadableFileFilter, "*.usd *.usda *.usdc")) \
57  ((UsdWritableFileFilter, "*.usd *.usda *.usdc *.usdz"))
58 
60  UsdMayaTranslatorTokens,
61  PXRUSDMAYA_API,
62  PXRUSDMAYA_TRANSLATOR_TOKENS);
63 
64 #define PXRUSDMAYA_JOB_EXPORT_ARGS_TOKENS \
65  /* Dictionary keys */ \
66  (chaser) \
67  (chaserArgs) \
68  (compatibility) \
69  (defaultCameras) \
70  (defaultMeshScheme) \
71  (eulerFilter) \
72  (exportCollectionBasedBindings) \
73  (exportColorSets) \
74  (exportDisplayColor) \
75  (exportInstances) \
76  (exportMaterialCollections) \
77  (exportReferenceObjects) \
78  (exportRefsAsInstanceable) \
79  (exportSkels) \
80  (exportSkin) \
81  (exportUVs) \
82  (exportVisibility) \
83  (kind) \
84  (materialCollectionsPath) \
85  (materialsScopeName) \
86  (melPerFrameCallback) \
87  (melPostCallback) \
88  (mergeTransformAndShape) \
89  (normalizeNurbs) \
90  (parentScope) \
91  (pythonPerFrameCallback) \
92  (pythonPostCallback) \
93  (renderableOnly) \
94  (renderLayerMode) \
95  (shadingMode) \
96  (stripNamespaces) \
97  (verbose) \
98  /* Special "none" token */ \
99  (none) \
100  /* renderLayerMode values */ \
101  (defaultLayer) \
102  (currentLayer) \
103  (modelingVariant) \
104  /* exportSkels/exportSkin values */ \
105  ((auto_, "auto")) \
106  ((explicit_, "explicit")) \
107  /* compatibility values */ \
108  (appleArKit)
109 
111  UsdMayaJobExportArgsTokens,
112  PXRUSDMAYA_API,
113  PXRUSDMAYA_JOB_EXPORT_ARGS_TOKENS);
114 
115 #define PXRUSDMAYA_JOB_IMPORT_ARGS_TOKENS \
116  /* Dictionary keys */ \
117  (apiSchema) \
118  (assemblyRep) \
119  (excludePrimvar) \
120  (metadata) \
121  (shadingMode) \
122  (useAsAnimationCache) \
123  /* assemblyRep values */ \
124  (Collapsed) \
125  (Full) \
126  (Import) \
127  ((Unloaded, ""))
128 
130  UsdMayaJobImportArgsTokens,
131  PXRUSDMAYA_API,
132  PXRUSDMAYA_JOB_IMPORT_ARGS_TOKENS);
133 
134 
135 struct UsdMayaJobExportArgs
136 {
137  const TfToken compatibility;
138  const TfToken defaultMeshScheme;
139  const bool eulerFilter;
140  const bool excludeInvisible;
141 
147  const bool exportCollectionBasedBindings;
148  const bool exportColorSets;
149  const bool exportDefaultCameras;
150  const bool exportDisplayColor;
151  const bool exportInstances;
152  const bool exportMaterialCollections;
153  const bool exportMeshUVs;
154  const bool exportNurbsExplicitUV;
155  const bool exportReferenceObjects;
156  const bool exportRefsAsInstanceable;
157  const TfToken exportSkels;
158  const TfToken exportSkin;
159  const bool exportVisibility;
160 
164  const SdfPath materialCollectionsPath;
165 
168  const TfToken materialsScopeName;
169 
172  const bool mergeTransformAndShape;
173  const bool normalizeNurbs;
174  const bool stripNamespaces;
175 
178  const SdfPath parentScope;
179  const TfToken renderLayerMode;
180  const TfToken rootKind;
181  const TfToken shadingMode;
182  const bool verbose;
183 
184  typedef std::map<std::string, std::string> ChaserArgs;
185  const std::vector<std::string> chaserNames;
186  const std::map< std::string, ChaserArgs > allChaserArgs;
187 
188  const std::string melPerFrameCallback;
189  const std::string melPostCallback;
190  const std::string pythonPerFrameCallback;
191  const std::string pythonPostCallback;
192 
193  const UsdMayaUtil::MDagPathSet dagPaths;
198  const std::vector<double> timeSamples;
199 
200  // This path is provided when dealing with variants
201  // where a _BaseModel_ root path is used instead of
202  // the model path. This to allow a proper internal reference.
203  SdfPath usdModelRootOverridePath; // XXX can we make this const?
204 
211  PXRUSDMAYA_API
212  static UsdMayaJobExportArgs CreateFromDictionary(
213  const VtDictionary& userArgs,
214  const UsdMayaUtil::MDagPathSet& dagPaths,
215  const std::vector<double>& timeSamples = std::vector<double>());
216 
218  PXRUSDMAYA_API
219  static const VtDictionary& GetDefaultDictionary();
220 
224  PXRUSDMAYA_API
225  void AddFilteredTypeName(const MString& typeName);
226 
227  const std::set<unsigned int>& GetFilteredTypeIds() const {
228  return _filteredTypeIds;
229  }
230 
231  void ClearFilteredTypeIds() {
232  _filteredTypeIds.clear();
233  }
234 
235 private:
236  PXRUSDMAYA_API
237  UsdMayaJobExportArgs(
238  const VtDictionary& userArgs,
239  const UsdMayaUtil::MDagPathSet& dagPaths,
240  const std::vector<double>& timeSamples = std::vector<double>());
241 
242  // Maya type ids to avoid exporting; these are
243  // EXACT types, though the only exposed way to modify this,
244  // AddFilteredTypeName, will also add all inherited types
245  // (so if you exclude "constraint", it will also exclude
246  // "parentConstraint")
247  std::set<unsigned int> _filteredTypeIds;
248 };
249 
250 PXRUSDMAYA_API
251 std::ostream& operator <<(
252  std::ostream& out,
253  const UsdMayaJobExportArgs& exportArgs);
254 
255 
256 struct UsdMayaJobImportArgs
257 {
258  const TfToken assemblyRep;
259  const TfToken::Set excludePrimvarNames;
260  const TfToken::Set includeAPINames;
261  const TfToken::Set includeMetadataKeys;
262  TfToken shadingMode; // XXX can we make this const?
263  const bool useAsAnimationCache;
264 
265  const bool importWithProxyShapes;
273  const GfInterval timeInterval;
274 
281  PXRUSDMAYA_API
282  static UsdMayaJobImportArgs CreateFromDictionary(
283  const VtDictionary& userArgs,
284  const bool importWithProxyShapes = false,
285  const GfInterval& timeInterval = GfInterval::GetFullInterval());
286 
288  PXRUSDMAYA_API
289  static const VtDictionary& GetDefaultDictionary();
290 
291 private:
292  PXRUSDMAYA_API
293  UsdMayaJobImportArgs(
294  const VtDictionary& userArgs,
295  const bool importWithProxyShapes,
296  const GfInterval& timeInterval);
297 };
298 
299 PXRUSDMAYA_API
300 std::ostream& operator <<(
301  std::ostream& out,
302  const UsdMayaJobImportArgs& importArgs);
303 
304 
305 PXR_NAMESPACE_CLOSE_SCOPE
306 
307 
308 #endif
A map with string keys and VtValue values.
Definition: dictionary.h:61
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:89
std::set< TfToken, TfTokenFastArbitraryLessThan > Set
Predefined type for set of tokens, for when faster lookup is desired, without paying the memory or in...
Definition: token.h:185
PXRUSDMAYA_API std::string stripNamespaces(const std::string &nodeName, const int nsDepth=-1)
Strip nsDepth namespaces from nodeName.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
Definition: staticTokens.h:118
A basic mathematical interval class.
Definition: interval.h:50
static GfInterval GetFullInterval()
Returns the full interval (-inf, inf).
Definition: interval.h:346
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
std::set< MDagPath, _CmpDag > MDagPathSet
Set of DAG paths.
Definition: util.h:89