AL_USDMaya  0.29.4
USD to Maya Bridge
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExportTranslator.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 
18 #include "../Api.h"
19 
20 #include "AL/maya/utils/FileTranslatorBase.h"
21 
22 namespace AL {
23 namespace usdmaya {
24 namespace fileio {
25 
26 //----------------------------------------------------------------------------------------------------------------------
30 //----------------------------------------------------------------------------------------------------------------------
31 AL_MAYA_TRANSLATOR_BEGIN(ExportTranslator, "AL usdmaya export", false, true, "usda", "*.usdc;*.usda;*.usd;*.usdt");
32 
36 
39 
42 
43  // specify the option names (These will uniquely identify the exporter options)
44  static constexpr const char* const kDynamicAttributes = "Dynamic Attributes";
45  static constexpr const char* const kMeshes = "Meshes";
46  static constexpr const char* const kMeshConnects = "Mesh Face Connects";
47  static constexpr const char* const kMeshPoints = "Mesh Points";
48  static constexpr const char* const kMeshNormals = "Mesh Normals";
49  static constexpr const char* const kMeshVertexCreases = "Mesh Vertex Creases";
50  static constexpr const char* const kMeshEdgeCreases = "Mesh Edge Creases";
51  static constexpr const char* const kMeshUvs = "Mesh UVs";
52  static constexpr const char* const kMeshUvOnly = "Mesh UV Only";
53  static constexpr const char* const kMeshColours = "Mesh Colours";
54  static constexpr const char* const kMeshHoles = "Mesh Holes";
55  static constexpr const char* const kCompactionLevel = "Compaction Level";
56  static constexpr const char* const kNurbsCurves = "Nurbs Curves";
57  static constexpr const char* const kDuplicateInstances = "Duplicate Instances";
58  static constexpr const char* const kMergeTransforms = "Merge Transforms";
59  static constexpr const char* const kAnimation = "Animation";
60  static constexpr const char* const kUseTimelineRange = "Use Timeline Range";
61  static constexpr const char* const kFrameMin = "Frame Min";
62  static constexpr const char* const kFrameMax = "Frame Max";
63  static constexpr const char* const kSubSamples = "Sub Samples";
64  static constexpr const char* const kFilterSample = "Filter Sample";
65  static constexpr const char* const kExportAtWhichTime = "Export At Which Time";
66 
67  AL_USDMAYA_PUBLIC
68  static const char* const compactionLevels[];
69 
70  AL_USDMAYA_PUBLIC
71  static const char* const timelineLevel[];
72 
76  static MStatus specifyOptions(AL::maya::utils::FileTranslatorOptions& options)
77  {
78  ExporterParams defaultValues;
79  if(!options.addFrame("AL USD Exporter Options")) return MS::kFailure;
80  if(!options.addBool(kDynamicAttributes, defaultValues.m_dynamicAttributes)) return MS::kFailure;
81  if(!options.addBool(kMeshes, defaultValues.m_meshes)) return MS::kFailure;
82  if(!options.addBool(kMeshConnects, defaultValues.m_meshConnects)) return MS::kFailure;
83  if(!options.addBool(kMeshPoints, defaultValues.m_meshPoints)) return MS::kFailure;
84  if(!options.addBool(kMeshNormals, defaultValues.m_meshNormals)) return MS::kFailure;
85  if(!options.addBool(kMeshVertexCreases, defaultValues.m_meshVertexCreases)) return MS::kFailure;
86  if(!options.addBool(kMeshEdgeCreases, defaultValues.m_meshEdgeCreases)) return MS::kFailure;
87  if(!options.addBool(kMeshUvs, defaultValues.m_meshUvs)) return MS::kFailure;
88  if(!options.addBool(kMeshUvOnly, defaultValues.m_meshUV)) return MS::kFailure;
89  if(!options.addBool(kMeshColours, defaultValues.m_meshColours)) return MS::kFailure;
90  if(!options.addBool(kMeshHoles, defaultValues.m_meshHoles)) return MS::kFailure;
91  if(!options.addEnum(kCompactionLevel, compactionLevels, defaultValues.m_compactionLevel)) return MS::kFailure;
92  if(!options.addBool(kNurbsCurves, defaultValues.m_nurbsCurves)) return MS::kFailure;
93  if(!options.addBool(kDuplicateInstances, defaultValues.m_duplicateInstances)) return MS::kFailure;
94  if(!options.addBool(kMergeTransforms, defaultValues.m_mergeTransforms)) return MS::kFailure;
95  if(!options.addBool(kAnimation, defaultValues.m_animation)) return MS::kFailure;
96  if(!options.addBool(kUseTimelineRange, defaultValues.m_useTimelineRange)) return MS::kFailure;
97  if(!options.addFloat(kFrameMin, defaultValues.m_minFrame)) return MS::kFailure;
98  if(!options.addFloat(kFrameMax, defaultValues.m_maxFrame)) return MS::kFailure;
99  if(!options.addInt(kSubSamples, defaultValues.m_subSamples)) return MS::kFailure;
100  if(!options.addBool(kFilterSample, defaultValues.m_filterSample)) return MS::kFailure;
101  if(!options.addEnum(kExportAtWhichTime, timelineLevel, defaultValues.m_exportAtWhichTime)) return MS::kFailure;
102 
103  return MS::kSuccess;
104  }
105 
106 private:
107  AL_USDMAYA_PUBLIC
108  MStatus writer(const MFileObject& file, const AL::maya::utils::OptionsParser& options, FileAccessMode mode) override;
109 
110 AL_MAYA_TRANSLATOR_END();
111 
112 //----------------------------------------------------------------------------------------------------------------------
113 } // fileio
114 } // usdmaya
115 } // AL
116 //----------------------------------------------------------------------------------------------------------------------
AL_MAYA_TRANSLATOR_BEGIN(ExportTranslator,"AL usdmaya export", false, true,"usda","*.usdc;*.usda;*.usd;*.usdt")
A Maya export plugin that writes out USD files from Maya (this is largely optimised for the needs of ...