preferences.h

Go to the documentation of this file.
00001 
00002 //**************************************************************************/
00003 // Copyright (c) 2008 Autodesk, Inc.
00004 // All rights reserved.
00005 //
00006 // Use of this software is subject to the terms of the Autodesk license
00007 // agreement provided at the time of installation or download, or which
00008 // otherwise accompanies this software in either electronic or hard copy form.
00009 //
00010 //**************************************************************************/
00011 // DESCRIPTION:
00012 // CREATED: October 2008
00013 //**************************************************************************/
00014 
00015 #include <QtCore/QDir>
00016 #include <QtCore/QCoreApplication>
00017 
00018 namespace mudbox {
00019 
00020 // Remove Linux's system header clashing defines.
00021 #if defined(Bool)
00022 #undef Bool
00023 #endif
00024 
00025 enum TiffCompression
00026 {
00027     eTiffNoCompression      = 0,
00028     eTiffLZWCompression     = 1,
00029     eTiffDeflateCompression = 2
00030 };
00031 
00032 enum LinearUnits
00033 {
00034     eMillimeter,
00035     eCentimeter,
00036     eMeter,
00037     eInch
00038 };
00039 
00040 enum SelectionMode
00041 {
00042     ePaint = 0,
00043     eRectangle,
00044     eLasso
00045 };
00046 
00047 enum InactiveLevelDisplay
00048 {
00049     eNone,
00050     eHide,
00051     eShade
00052 };
00053 
00054 class MBDLL_DECL AttributeLocale : public astring
00055 {
00056     Q_DECLARE_TR_FUNCTIONS(mudbox::AttributeLocale)
00057 
00058 public:
00059     AttributeLocale( Node *pOwner, const QString &sID);
00060     AttributeLocale( Node *pOwner, const QString &sID, const QString& cValue );
00061     virtual ~AttributeLocale();
00062 
00063 public:
00064     virtual AttributeWidget* CreateEditorWidget( QWidget *pParent, int iWidth );
00065 };
00066 
00070 class MBDLL_DECL Preferences : public Node
00071 {
00072     Q_DECLARE_TR_FUNCTIONS(mudbox::Preferences);
00073     DECLARE_CLASS;
00074 public:
00075     Preferences( void );
00076     ~Preferences( void );
00077     void Serialize( Stream & );
00078     void ProcessLine( QString &sSrc, QString &sName, QString &sValue );
00079     void SavePaths( void );
00080     bool LoadPaths( void );
00081     QString FindSettings( QString &sDir );
00082     QString DefaultDataPath() const;
00083 
00084     Attribute *RegisterVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, Attribute::AttributeType eType, const QString &sDefaultValue );
00085     inline afloatr *RegisterFloatVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, float fDefaultValue ) { return (afloatr *)RegisterVariable( sName, sCategory, sNameTr, sCategoryTr, Attribute::typeFloat, QString("%1").arg(fDefaultValue) ); };
00086     inline abool *RegisterBoolVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, bool bDefaultValue ) { return (abool *)RegisterVariable( sName, sCategory, sNameTr, sCategoryTr, Attribute::typeBool, bDefaultValue ? "true" : "false" ); };
00087     inline astring *RegisterStringVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, const QString &sDefaultValue ) { return (astring *)RegisterVariable( sName, sCategory, sNameTr, sCategoryTr, Attribute::typeString, sDefaultValue ); };
00088     inline acolor *RegisterColorVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, const mudbox::Color &cDefaultValue ) { return (acolor *)RegisterVariable( sName, sCategory, sNameTr, sCategoryTr, Attribute::typeColor, QString("%1 %2 %3 %4").arg(cDefaultValue.r).arg(cDefaultValue.g).arg(cDefaultValue.b).arg(cDefaultValue.a) ); };
00089     inline aint *RegisterIntegerVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, int iDefaultValue ) { return (aint *)RegisterVariable( sName, sCategory, sNameTr, sCategoryTr, Attribute::typeInt, QString("%1").arg(iDefaultValue) ); };
00090     inline avector *RegisterVectorVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, const mudbox::Vector &vDefaultValue ) { return (avector *)RegisterVariable( sName, sCategory, sNameTr, sCategoryTr, Attribute::typeVector, QString("%f %f %f").arg(vDefaultValue.x).arg(vDefaultValue.y).arg(vDefaultValue.z ) ); };
00091     inline aenum *RegisterEnumVariable( const QString &sName, const QString &sCategory, const QString& sNameTr, const QString &sCategoryTr, int iDefaultValue ) { return (aenum *)RegisterVariable( sName, sCategory, sNameTr, sCategoryTr, Attribute::typeEnum, QString("%1").arg(iDefaultValue) ); };
00092 
00093     void OnNodeEvent( const Attribute &, NodeEventType );
00094 
00095     abool m_bCheckFrustum, m_bMultiThreadRender, m_bHighlightBrushArea;
00096     aint m_iFastBrushLevel;
00097     abool m_bFocusWhenEmpty, m_bFocusWhenNotEmpty, m_bZoomWhileFocus;
00098     abool m_bPickBothSide;
00099     abool m_bUseVideoMemory, m_bRemoveLevels, m_bRemoveOctree, m_bCreateUVs, m_bSmoothUV, m_bSmoothPos;
00100     aenum m_eDefaultMaterial;
00101     abool m_bDisableLODChange;
00102     abool m_bNoPaintUndo;
00103     aenum m_eSoloLayerVisibility;
00104 
00105     aint m_fMinPenPressure, m_fMaxPenPressure;
00106     aint m_iGridSize, m_iGridSteps;
00107     aint m_iDoubleClickTime;
00108     abool m_bWireOnShaded;
00109     abool m_bShowPickedFace;
00110     aint m_iWireLevel;
00111     aenum m_eImportAutofocus;
00112     bool m_bFlatLighting;
00113     bool m_bFacetedShading;
00114     bool m_bLighting;
00115 
00116     afloatr m_fCameraDollySensitivity;
00117     afloatr m_fCameraTrackSensitivity;
00118     afloatr m_fCameraRotateSensitivity;
00119     
00120     abool m_bOptimizeMeshes;
00121     abool m_bShowLayerMask;
00122     abool m_bUseDraftRender, m_bShowFrozenVertices;
00123     aint m_iPointRenderRarity;
00124     aint m_iDraftRenderMinFaceCount;
00125     abool m_bHUDProjectedSubdiv, m_bHUDSelected, m_bHUDVisible, m_bHUDFPS, m_bHUDRendered;
00126     aint m_iHUDProjectedXSubdivisionLevel;
00127     aint m_iMinutesToAlarm, m_iBuildUpRate;
00128     afloatr m_fPressureTreshold;
00129     afloatr m_fStencilRotateSensitivity;
00130     abool m_bForceVidmemRender;
00131     abool m_bUseLocalYForCameraRotation;
00132     aenum m_iCameraControlMode;
00133     afloatr m_fRollArea;
00134 
00135     abool m_bSaveIndicator, m_bSelectPicked, m_bLocalFocus;
00136 
00137     aint m_iMirrorPlanes;
00138     Store<mudbox::Vector> m_aMirrorPlaneNormals;
00139     Store<mudbox::Vector> m_aMirrorPlanePositions;
00140     abool m_bMirrorLocal;
00141 
00142     abool m_bUseQtFileDialog;
00143     afloatr m_fSmartFocus;
00144     acolor m_cViewportCenter, m_cViewportTop, m_cViewportBottom, m_cViewportFlat, m_cGrid, m_cGridAxis, m_cLocked;
00145     acolor m_cSelection, m_cMask, m_cActiveLayer, m_cInactiveLayer, m_cLayerMask;
00146     acolor m_cSceneInfoBg, m_cFalloffCurve, m_cFalloffHull, m_cFalloffFill;
00147     aenum m_eUnitLinear;
00148     aenum m_eFaceSelectionMode, m_eObjectSelectionMode;
00149     float m_aLinearUnitRates[4];
00150     astring m_sDefaultObjDir, m_sDefaultMudDir, m_sDefaultStampDir, m_sDefaultStencilDir, m_sDefaultIconDir,
00151             m_sDefaultImagePlaneDir, m_sDefaultTextureLayerDir, m_sDefaultPSDDir, m_sDefaultSaveScreenDir;
00152     astring m_sLogPath, m_sTempPath, m_sSettingsPath, m_sDataPath;
00153     astring m_sTexturePath; 
00154     astring m_sMayaInstallPath; 
00155 #ifdef WantSendToMax
00156 #ifdef WIN32
00157     astring m_sMaxInstallPath;
00158 #endif
00159 #endif
00160     abool m_bPathsChanged;
00161     abool m_bExpertHidesSouth, m_bExpertHidesEast, m_bExpertHidesMenu, m_bExpertHidesStatus;
00162     aint m_iDragBoxSize;
00163     abool m_bShowLearningMovies;
00164     abool m_bShowWelcomeDialog;
00165     abool m_bHUDInfoMessage;
00166     abool m_bHUDHelpMessage;
00167     aenum m_iHelpType;
00168     astring m_sHelpLocation;
00169     abool m_bCompressFiles;
00170     abool m_bOBJThumbnail;
00171     abool m_bMUDContainsView, m_bMUDContainsBrush;
00172     abool m_bCull, m_bCreateBackup;
00173     abool m_bShowTileInfo;
00174     // map extraction
00175     //struct MapExtraction
00176     //{
00177         aint m_iMapWidth;
00178         aint m_iMapHeight;
00179         astring m_sOutputDir;
00180         abool m_bExtractNormal;
00181         abool m_bExtractDisplacement;
00182         abool m_bSmoothNormals;
00183         aint m_iSmoothLevel;
00184         aint m_iNormalSpace;
00185         afloat m_fRayTravel;
00186         aint m_eRayCenter;
00187         abool m_bPickBothSides;
00188         aint m_iEdgeBleed;
00189         aint m_iNormalFormat;
00190         aint m_iDisplacementFormat;
00191         aint m_iSubdivLow;
00192         astring m_sNormalFileName;
00193         astring m_sDisplacementFileName;
00194         abool m_bSkipEmptyMaps;
00195         aint m_iExtUDim;
00196         aint m_iUStart;
00197         abool m_bSelectedFacesOnly;
00198         astring m_sLowObjectName;
00199         astring m_sHighObjectName;
00200         abool m_bInvertTangent;
00201         abool m_bInvertBinormal;
00202         afloat m_fAreaTreshold;
00203     //} m_cMapExtraction;
00204 
00206     //struct DisplacementPreferences
00207     //{
00208         astring m_sTileRange;
00209         afloat m_fMiddleValue;
00210         aint m_iFirstTileIndex, m_iDispUDim;
00211         aint m_iMaskChannel, m_iNegativeDisplacementChannel, m_iPositiveDisplacementChannel;
00212         aint m_iXSubdivisionLevel;
00213         astring m_sObjectName;
00214         astring m_sDisplacementFileMask;
00215         astring m_sMaskFileMask;
00216 //  } m_cDisplacement;
00217 
00218     aenum m_eTextureRatio;
00219     afloat m_fTextureRatio;
00220 
00221     aenum m_eTiffCompression;
00222 
00223     avoid m_lExpertModeLabel;
00224     abool m_bMultisampling;
00225     astring m_sNextCommand;
00226 
00227     Store<Attribute *> m_aPluginAttributes;
00228 
00230     afloatr m_fPaintBleedDistance;
00231     afloatr m_fPaintBrushOffset;
00232     abool m_bFastDryBrush;
00233     astring m_sExportFilter;
00234 
00235     abool m_bHideEULANag;
00236 
00238     aint m_movieWidth;
00239     aint m_movieHeight;
00240     aint m_movieRecordFps;
00241     aint m_moviePlaybackFps;
00242     abool m_moviePauseWhenIdle;
00243     abool m_movieUses3dView;
00244 
00246     astring m_sPaintLayerFormat;
00247     aint m_iPaintLayerSize;
00248 
00250     AttributeLocale m_langui;
00251     AttributeLocale m_langhelp;
00252     AttributeLocale m_locale;
00253 
00254     bool m_bLoadingPaths;
00255 
00265     class MBDLL_DECL Integer
00266     {
00267     public:
00268         Integer( 
00269             const QString &sName, 
00270             const QString &sCategory, 
00271             const QString &sNameTr, 
00272             const QString &sCategoryTr, 
00273             unsigned int iDefaultValue 
00274             );
00275         operator unsigned int( void ) const;
00276         aint *m_pAttribute;
00277     };
00279     class MBDLL_DECL Bool
00280     {
00281     public:
00282         Bool( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, bool bDefaultValue );
00283         operator bool( void ) const;
00284         abool *m_pAttribute;
00285     };
00287     class MBDLL_DECL Float
00288     {
00289     public:
00290         Float( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, float fDefaultValue, float fMinimum, float fMaximum );
00291         operator float( void ) const;
00292         afloatr *m_pAttribute;
00293     };
00295     class MBDLL_DECL String
00296     {
00297     public:
00298         String( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, const QString &sDefaultValue );
00299         operator QString( void ) const;
00300         astring *m_pAttribute;
00301     };
00303     class MBDLL_DECL Color
00304     {
00305     public:
00306         Color( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, const mudbox::Color &cDefaultValue );
00307         operator mudbox::Color( void ) const;
00308         acolor *m_pAttribute;
00309     };
00311     class MBDLL_DECL Vector
00312     {
00313     public:
00314         Vector( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, const mudbox::Vector &vDefaultValue );
00315         operator mudbox::Vector( void ) const;
00316         avector *m_pAttribute;
00317     };
00319     class MBDLL_DECL Enum
00320     {
00321     public:
00322         Enum( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, int iDefaultValue );
00323         operator int( void ) const;
00324         aenum *m_pAttribute;
00325     };
00326 
00327     private:
00328         QDir m_PreferencesPath;
00329 };
00330 
00331 }; // end of namespace mudbox