~ubuntu-branches/ubuntu/wily/opencollada/wily

« back to all changes in this revision

Viewing changes to COLLADAMaya/src/COLLADAMayaExportOptions.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
        This file is part of COLLADAMaya.
 
5
 
 
6
    Portions of the code are:
 
7
    Copyright (c) 2005-2007 Feeling Software Inc.
 
8
    Copyright (c) 2005-2007 Sony Computer Entertainment America
 
9
    Copyright (c) 2004-2005 Alias Systems Corp.
 
10
        
 
11
    Licensed under the MIT Open Source License, 
 
12
    for details please see LICENSE file or the website
 
13
    http://www.opensource.org/licenses/mit-license.php
 
14
*/
 
15
 
 
16
#include "COLLADAMayaStableHeaders.h"
 
17
#include "COLLADAMayaExportOptions.h"
 
18
#include "COLLADAMayaSetHelper.h"
 
19
#include "COLLADAMayaAnimationHelper.h"
 
20
 
 
21
namespace COLLADAMaya
 
22
{
 
23
 
 
24
    // Static Members
 
25
 
 
26
    bool ExportOptions::mBakeTransforms = true;
 
27
    bool ExportOptions::mRelativePaths = true;
 
28
    bool ExportOptions::mCopyTextures = false;
 
29
    bool ExportOptions::mExportPolygonMeshes = true;
 
30
    bool ExportOptions::mExportLights  = true;
 
31
    bool ExportOptions::mExportCgfxFileReferences = true;
 
32
    bool ExportOptions::mExportCameras = true;
 
33
    bool ExportOptions::mExportJointsAndSkin = true;
 
34
    bool ExportOptions::mExportMaterialsOnly = false;
 
35
    bool ExportOptions::mExportReferencedMaterials = true;
 
36
    bool ExportOptions::mExportAnimations = true;
 
37
    bool ExportOptions::mRemoveStaticCurves = true;
 
38
    bool ExportOptions::mExportInvisibleNodes = false;
 
39
    bool ExportOptions::mExportDefaultCameras = false;
 
40
    bool ExportOptions::mExportNormals = true;
 
41
    bool ExportOptions::mExportNormalsPerVertex = true;
 
42
    bool ExportOptions::mExportTexCoords = true;
 
43
    bool ExportOptions::mExportVertexColors = true;
 
44
    bool ExportOptions::mExportVertexColorsPerVertex = true;
 
45
    bool ExportOptions::mExportTangents = false;
 
46
    bool ExportOptions::mExportTexTangents = false;
 
47
    bool ExportOptions::mExportCameraAsLookat = true;
 
48
    bool ExportOptions::mExportTriangles = false;
 
49
    bool ExportOptions::mExportXRefs = true;
 
50
    bool ExportOptions::mDereferenceXRefs = false;
 
51
    bool ExportOptions::mCameraXFov = false;
 
52
    bool ExportOptions::mCameraYFov = true;
 
53
    bool ExportOptions::mDoublePrecision = false;
 
54
    bool ExportOptions::mIsSampling = false;
 
55
    bool ExportOptions::mCurveConstrainSampling = false;
 
56
 
 
57
    // Parse the options String
 
58
    void ExportOptions::set ( const MString& optionsString )
 
59
    {
 
60
        // Reset everything to the default value
 
61
        mBakeTransforms = false;
 
62
        mRelativePaths = true;
 
63
 
 
64
        /** True, if the texture files should be copied to the destination folder. */
 
65
        mCopyTextures = false;
 
66
       
 
67
        mIsSampling = false;
 
68
        mCurveConstrainSampling = false;
 
69
        mRemoveStaticCurves = true;
 
70
        mExportCameraAsLookat = false;
 
71
        mExportTriangles = false;
 
72
        
 
73
        mExportPolygonMeshes = true;
 
74
        mExportLights = true;
 
75
        mExportCameras = true;
 
76
        mExportMaterialsOnly = false;
 
77
        mExportReferencedMaterials = true;
 
78
        mExportJointsAndSkin = true;
 
79
        mExportAnimations = true;
 
80
        mExportInvisibleNodes = false;
 
81
        mExportDefaultCameras = false;
 
82
        mExportNormals = true;
 
83
        mExportNormalsPerVertex = true;
 
84
        mExportTexCoords = true;
 
85
        mExportVertexColors = true;
 
86
        mExportVertexColorsPerVertex = true;
 
87
        mExportTangents = false;
 
88
        mExportTexTangents = false;
 
89
        mExportXRefs = true;
 
90
        mDereferenceXRefs = true;
 
91
        mCameraXFov = false;
 
92
        mCameraYFov = true;
 
93
        mDoublePrecision = false;
 
94
        mExportCgfxFileReferences = true;
 
95
 
 
96
        // Parse option String
 
97
        if ( optionsString.length() > 0 )
 
98
        {
 
99
            MStringArray optionList;
 
100
            optionsString.split ( ';', optionList );
 
101
            uint optionCount = optionList.length();
 
102
 
 
103
            for ( uint i = 0; i < optionCount; ++i )
 
104
            {
 
105
                MString& currentOption = optionList[i];
 
106
 
 
107
                // Process option name and values.
 
108
                MStringArray decomposedOption;
 
109
                currentOption.split ( '=', decomposedOption );
 
110
                MString& optionName = decomposedOption[0];
 
111
 
 
112
                // For boolean values, the value is assumed to be true
 
113
                // if omitted.
 
114
                bool value = true;
 
115
 
 
116
                if ( decomposedOption.length() > 1 &&
 
117
                        decomposedOption[1] != "true" &&
 
118
                        decomposedOption[1] != "1" )
 
119
                    value = false;
 
120
 
 
121
                // Process options.
 
122
                if ( optionName == "bakeTransforms" ) mBakeTransforms = value;
 
123
                else if ( optionName == "relativePaths" ) mRelativePaths = value;
 
124
                else if ( optionName == "exportTriangles" ) mExportTriangles = value;
 
125
                else if ( optionName == "cgfxFileReferences" ) mExportCgfxFileReferences = value;
 
126
                else if ( optionName == "copyTextures" ) mCopyTextures = value;
 
127
                else if ( optionName == "exportPolygonMeshes" ) mExportPolygonMeshes = value;
 
128
                else if ( optionName == "exportLights" ) mExportLights = value;
 
129
                else if ( optionName == "exportCameras" ) mExportCameras = value;
 
130
                else if ( optionName == "exportJointsAndSkin" ) mExportJointsAndSkin = value;
 
131
                else if ( optionName == "exportMaterialsOnly" ) mExportMaterialsOnly = value;
 
132
                else if ( optionName == "exportReferencedMaterials" ) mExportReferencedMaterials = value;
 
133
                else if ( optionName == "exportAnimations" ) mExportAnimations = value;
 
134
                else if ( optionName == "exportInvisibleNodes" ) mExportInvisibleNodes = value;
 
135
                else if ( optionName == "exportDefaultCameras" ) mExportDefaultCameras = value;
 
136
                else if ( optionName == "exportNormals" ) mExportNormals = value;
 
137
                else if ( optionName == "exportNormalsPerVertex" ) mExportNormalsPerVertex = value;
 
138
                else if ( optionName == "exportTexCoords" ) mExportTexCoords = value;
 
139
                else if ( optionName == "exportVertexColors" ) mExportVertexColors = value;
 
140
                else if ( optionName == "exportVertexColorsPerVertex" ) mExportVertexColorsPerVertex = value;
 
141
                else if ( optionName == "exportTangents" ) mExportTangents = value;
 
142
                else if ( optionName == "exportTexTangents" ) mExportTexTangents = value;
 
143
                else if ( optionName == "exportCameraAsLookat" ) mExportCameraAsLookat = value;
 
144
                else if ( optionName == "cameraXFov" ) mCameraXFov = value;
 
145
                else if ( optionName == "cameraYFov" ) mCameraYFov = value;
 
146
                else if ( optionName == "doublePrecision" ) mDoublePrecision = value;
 
147
                else if ( optionName == "isSampling" ) mIsSampling = value;
 
148
                else if ( optionName == "curveConstrainSampling" ) mCurveConstrainSampling = value;
 
149
                else if ( optionName == "removeStaticCurves" ) mRemoveStaticCurves = value;
 
150
                else if ( optionName == "exportXRefs" ) mExportXRefs = value;
 
151
                else if ( optionName == "dereferenceXRefs" ) mDereferenceXRefs = value;
 
152
            }
 
153
        }
 
154
 
 
155
        if ( !mIsSampling )
 
156
        {
 
157
            AnimationHelper::generateSamplingFunction();
 
158
        }
 
159
    }
 
160
 
 
161
    bool ExportOptions::bakeTransforms()
 
162
    {
 
163
        return mBakeTransforms;
 
164
    }
 
165
 
 
166
    bool ExportOptions::exportPolygonMeshes()
 
167
    {
 
168
        return mExportPolygonMeshes;
 
169
    }
 
170
 
 
171
    bool ExportOptions::isSampling()
 
172
    {
 
173
        return mIsSampling;
 
174
    }
 
175
 
 
176
    bool ExportOptions::curveConstrainSampling()
 
177
    {
 
178
        return mCurveConstrainSampling;
 
179
    }
 
180
 
 
181
    bool ExportOptions::removeStaticCurves()
 
182
    {
 
183
        return mRemoveStaticCurves;
 
184
    }
 
185
 
 
186
    bool ExportOptions::exportCameraAsLookat()
 
187
    {
 
188
        return mExportCameraAsLookat;
 
189
    }
 
190
 
 
191
    bool ExportOptions::relativePaths()
 
192
    {
 
193
        return mRelativePaths;
 
194
    }
 
195
 
 
196
    bool ExportOptions::exportLights()
 
197
    {
 
198
        return mExportLights;
 
199
    }
 
200
 
 
201
    bool ExportOptions::exportCameras()
 
202
    {
 
203
        return mExportCameras;
 
204
    }
 
205
 
 
206
    bool ExportOptions::exportJointsAndSkin()
 
207
    {
 
208
        return mExportJointsAndSkin;
 
209
    }
 
210
 
 
211
    bool ExportOptions::exportMaterialsOnly ()  
 
212
    {
 
213
        return mExportMaterialsOnly;
 
214
    }
 
215
 
 
216
    bool ExportOptions::exportReferencedMaterials ()  
 
217
    {
 
218
        return mExportReferencedMaterials;
 
219
    }
 
220
 
 
221
    bool ExportOptions::exportAnimations()
 
222
    {
 
223
        return mExportAnimations;
 
224
    }
 
225
 
 
226
    bool ExportOptions::exportTriangles()
 
227
    {
 
228
        return mExportTriangles;
 
229
    }
 
230
 
 
231
    bool ExportOptions::exportInvisibleNodes()
 
232
    {
 
233
        return mExportInvisibleNodes;
 
234
    }
 
235
 
 
236
    bool ExportOptions::exportDefaultCameras()
 
237
    {
 
238
        return mExportDefaultCameras;
 
239
    }
 
240
 
 
241
    bool ExportOptions::exportNormals()
 
242
    {
 
243
        return mExportNormals;
 
244
    }
 
245
 
 
246
    bool ExportOptions::exportNormalsPerVertex()
 
247
    {
 
248
        return mExportNormalsPerVertex;
 
249
    }
 
250
 
 
251
    bool ExportOptions::exportTexCoords()
 
252
    {
 
253
        return mExportTexCoords;
 
254
    }
 
255
 
 
256
    bool ExportOptions::exportVertexColors()
 
257
    {
 
258
        return mExportVertexColors;
 
259
    }
 
260
 
 
261
    bool ExportOptions::exportVertexColorsPerVertex()
 
262
    {
 
263
        return mExportVertexColorsPerVertex;
 
264
    }
 
265
 
 
266
    bool ExportOptions::exportTangents()
 
267
    {
 
268
        return mExportTangents;
 
269
    }
 
270
 
 
271
    bool ExportOptions::exportTexTangents()
 
272
    {
 
273
        return mExportTexTangents;
 
274
    }
 
275
 
 
276
    bool ExportOptions::exportXRefs()
 
277
    {
 
278
        return mExportXRefs;
 
279
    }
 
280
 
 
281
    bool ExportOptions::dereferenceXRefs()
 
282
    {
 
283
        return mDereferenceXRefs;
 
284
    }
 
285
 
 
286
    bool ExportOptions::cameraXFov()
 
287
    {
 
288
        return mCameraXFov;
 
289
    }
 
290
 
 
291
    bool ExportOptions::cameraYFov()
 
292
    {
 
293
        return mCameraYFov;
 
294
    }
 
295
 
 
296
    bool ExportOptions::doublePrecision()
 
297
    {
 
298
        return mDoublePrecision;
 
299
    }
 
300
 
 
301
    bool ExportOptions::copyTextures()
 
302
    {
 
303
        return mCopyTextures;
 
304
    }
 
305
 
 
306
    bool ExportOptions::exportCgfxFileReferences ()
 
307
    {
 
308
        return mExportCgfxFileReferences;
 
309
    }
 
310
 
 
311
}
 
 
b'\\ No newline at end of file'