1 /* 2 Copyright (c) 2008-2009 NetAllied Systems GmbH 3 4 This file is part of COLLADAMax. 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 10 Based on the 3dsMax COLLADASW Tools: 11 Copyright (c) 2005-2006 Autodesk Media Entertainment 12 13 Licensed under the MIT Open Source License, 14 for details please see LICENSE file or the website 15 http://www.opensource.org/licenses/mit-license.php 16 */ 17 18 19 #ifndef __COLLADAMAX_OPTIONS_H__ 20 #define __COLLADAMAX_OPTIONS_H__ 21 22 #include "COLLADAMaxPrerequisites.h" 23 24 #include "maxtypes.h" 25 26 namespace COLLADAMax 27 { 28 29 30 /** A class that stores all the options available for the export. 31 */ 32 33 class Options 34 { 35 36 public: 37 static const String CONFIGURATION_FILE_NAME; 38 static const String CONFIGURATION_HEADER_NAME; 39 40 static const String OPTION_NORMALS_NAME; 41 static const String OPTION_TRIANGULAT_NAME; 42 static const String OPTION_XREFS_NAME; 43 static const String OPTION_TANGENTS_NAME; 44 static const String OPTION_ANIMATIONS_NAME; 45 static const String OPTION_SAMPLEANIMATIONS_NAME; 46 static const String OPTION_CREATECLIP_NAME; 47 static const String OPTION_BAKEMATRICES_NAME; 48 static const String OPTION_RELATIVEPATHS_NAME; 49 static const String OPTION_CHECKIFANIMATIONISANIMATED_NAME; 50 static const String OPTION_ANIMATIONSTART_NAME; 51 static const String OPTION_ANIMATIONEND_NAME; 52 static const String OPTION_COPY_IMAGES_NAME; 53 static const String OPTION_EXPORT_USERDEFINED_PROPERTIES_NAME; 54 55 56 private: 57 // options dialog state 58 Interface* mMaxInterface; 59 bool mNormals; //!< export normals 60 bool mTriangulate; //!< convert Editable Polygons to triangles 61 bool mIncludeXrefs; //!< export external references 62 bool mTangents; //!< export tangents and binormals 63 bool mAnimations; //!< export animations; 64 bool mSampleAnimation; //!< export sampled animation 65 bool mCreateClip; //!< create one animation clip with all the animations of the scene 66 bool mLayersAsClips; //!< export each animation layer as a unique animation, and create a clip for each layer 67 bool mBakeMatrices; //!< export transforms as matrices 68 bool mRelativePaths; //!< export relative paths 69 bool mCopyImages; //!< copy images 70 String mImageDirectory; //!< The directory of the copied images, relative to the output file 71 bool importUnits; //!< import assets in their units 72 bool importUpAxis; //!< import assets in their up-axis 73 bool mCheckIfAnimationIsAnimated; //!< export animations only if it is really animated (time consuming) 74 TimeValue mAnimationStart; //!< start sample TimeValue(frame * GetTicksPerFrame) 75 TimeValue mAnimationEnd; //!< end sample TimeValue (frame * GetTicksPerFrame) 76 bool mSelectionOnly; //!< export only selected nodes/objects 77 String mXRefOutputDir; //!< The directory where all the xref scenes should be exported to 78 79 bool mExportUserDefinedProperties; //!< export user defined properties 80 81 82 public: 83 /** Constructor*/ 84 Options(Interface* maxInterface); 85 86 /** Destructor*/ ~Options()87 ~Options() 88 {} 89 90 // Displays the exporter options dialog to allow the user to change the options. 91 //bool ShowDialog(bool exporter); 92 93 /** Returns if the normals are exported */ getExportNormals()94 bool getExportNormals() const 95 { 96 return mNormals; 97 } 98 99 /** Returns, if the editable polygons are exported as triangles.*/ getExportEPolyAsTriangles()100 bool getExportEPolyAsTriangles() const { return mTriangulate; } 101 102 /** Returns, if XRef are exported.*/ getIncludeXRefs()103 bool getIncludeXRefs() const { return mIncludeXrefs; } 104 105 /** Returns, if tangents are exported.*/ getExportTangents()106 bool getExportTangents() const { return mTangents; } 107 108 /** Returns, if animations are exported.*/ getExportAnimations()109 bool getExportAnimations() const { return mAnimations; } 110 111 /** Returns, if animations are sampled.*/ getSampleAnimation()112 bool getSampleAnimation() const { return mSampleAnimation; } 113 114 /** Returns, if an animation clip is exported.*/ getExportAnimClip()115 bool getExportAnimClip() const { return mCreateClip; } 116 117 /** Returns, if animation layers should be exported as animations clips.*/ getExportLayersAsClips()118 bool getExportLayersAsClips() const { return mLayersAsClips; } 119 120 /** Returns, if the transformations are exported as matrices.*/ getBakeMatrices()121 bool getBakeMatrices() const { return mBakeMatrices; } 122 123 /** Returns, if paths are exported as relative paths.*/ getExportRelativePaths()124 bool getExportRelativePaths() const { return mRelativePaths; } 125 126 /** Returns, if images should be copied.*/ getCopyImages()127 bool getCopyImages() const { return mCopyImages; } 128 129 /** The directory of the copied images, relative to the output file.*/ getImageDirectory()130 String getImageDirectory() const { return mImageDirectory; } 131 132 133 /** Returns, if animations are checked if they are really animated*/ getCheckIfAnimationsIsAnimated()134 bool getCheckIfAnimationsIsAnimated() const { return mCheckIfAnimationIsAnimated;} 135 136 137 /** Returns if only the selected parts are exported.*/ getExportSelected()138 bool getExportSelected() const { return mSelectionOnly; } 139 140 /** Returns the animation start time.*/ getAnimationStart()141 TimeValue getAnimationStart() const { return mAnimationStart; } 142 143 /** Returns the animation end time.*/ getAnimationEnd()144 TimeValue getAnimationEnd() const { return mAnimationEnd; } 145 146 /** Returns the directory where the XRef files should be exported to.*/ getXRefOutputDir()147 const String& getXRefOutputDir() const { return mXRefOutputDir; } 148 149 /** Change the animation start/end for sampling*/ setAnimBounds(int start,int end)150 void setAnimBounds(int start, int end) { mAnimationStart = start; mAnimationEnd = end; } 151 152 /** Returns if user defined properties are exported.*/ getExportUserDefinedProperties()153 bool getExportUserDefinedProperties() const { return mExportUserDefinedProperties; } 154 155 bool ShowDialog(); 156 157 INT_PTR ExportOptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 158 static INT_PTR CALLBACK ExportOptionsDlgProcS(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 159 160 161 /** Save the export options to an .ini file, located in the APP_PLUGCFG_DIR directory*/ 162 void SaveOptions(); 163 164 void LoadOptions(); 165 166 }; 167 168 } 169 170 171 #endif //__COLLADAMAX_OPTIONS_H__ 172