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     const ClassDesc *SelectedMeshRenderer() { return m_pSelectedMeshRenderer; }
00096 
00097     abool m_bCheckFrustum, m_bMultiThreadRender, m_bHighlightBrushArea;
00098     aint m_iFastBrushLevel;
00099     abool m_bFocusWhenEmpty, m_bFocusWhenNotEmpty, m_bZoomWhileFocus;
00100     abool m_bPickBothSide;
00101     abool m_bUseVideoMemory, m_bRemoveLevels, m_bRemoveOctree, m_bCreateUVs, m_bSmoothUV, m_bSmoothPos; 
00102     abool m_bEnableCreasing, m_bPreserveBorders, m_bPreserveHardEdges, m_bCreaseHardEdges;
00103     aenum m_iBoundaryRule;
00104     aenum m_eDefaultMaterial;
00105     abool m_bDisableLODChange;
00106     abool m_bNoPaintUndo;
00107     aenum m_eSoloLayerVisibility;
00108 
00109     aint m_fMinPenPressure, m_fMaxPenPressure;
00110     aint m_iGridSize, m_iGridSteps;
00111     aint m_iDoubleClickTime;
00112     abool m_bWireOnShaded;
00113     abool m_bShowPickedFace;
00114     aint m_iWireLevel;
00115     aenum m_eImportAutofocus;
00116     bool m_bFlatLighting;
00117     bool m_bFacetedShading;
00118     bool m_bLighting;
00119     abool m_bDisplayCreaseNormals; 
00120 
00121     afloatr m_fCameraDollySensitivity;
00122     afloatr m_fCameraTrackSensitivity;
00123     afloatr m_fCameraRotateSensitivity;
00124     
00125     abool m_bOptimizeMeshes;
00126     abool m_bShowLayerMask;
00127     abool m_bUseDraftRender, m_bShowFrozenVertices;
00128     aint m_iPointRenderRarity;
00129     aint m_iDraftRenderMinFaceCount;
00130     abool m_bHUDProjectedSubdiv, m_bHUDSelected, m_bHUDVisible, m_bHUDFPS, m_bHUDRendered;
00131     aint m_iHUDProjectedXSubdivisionLevel;
00132     aint m_iMinutesToAlarm, m_iBuildUpRate;
00133     afloatr m_fPressureTreshold;
00134     afloatr m_fStencilRotateSensitivity;
00135     abool m_bForceVidmemRender;
00136     abool m_bUseLocalYForCameraRotation;
00137     aenum m_iCameraControlMode;
00138     afloatr m_fRollArea;
00139 
00140     abool m_bSaveIndicator, m_bSelectPicked, m_bLocalFocus;
00141 
00142     aint m_iMirrorPlanes;
00143     Store<mudbox::Vector> m_aMirrorPlaneNormals;
00144     Store<mudbox::Vector> m_aMirrorPlanePositions;
00145     abool m_bMirrorLocal;
00146 
00147     abool m_bUseQtFileDialog;
00148     afloatr m_fSmartFocus;
00149     acolor m_cViewportCenter, m_cViewportTop, m_cViewportBottom, m_cViewportFlat, m_cGrid, m_cGridAxis, m_cLocked;
00150     acolor m_cSelection, m_cMask, m_cActiveLayer, m_cInactiveLayer, m_cLayerMask;
00151     acolor m_cSceneInfoBg, m_cFalloffCurve, m_cFalloffHull, m_cFalloffFill;
00152     aenum m_eUnitLinear;
00153     aenum m_eFaceSelectionMode, m_eObjectSelectionMode;
00154     float m_aLinearUnitRates[4];
00155     astring m_sDefaultObjDir, m_sDefaultMudDir, m_sDefaultStampDir, m_sDefaultStencilDir, m_sDefaultIconDir,
00156             m_sDefaultImagePlaneDir, m_sDefaultTextureLayerDir, m_sDefaultPSDDir, m_sDefaultSaveScreenDir;
00157     astring m_sLogPath, m_sTempPath, m_sSettingsPath, m_sDataPath;
00158     astring m_sTexturePath; 
00159     astring m_sMayaInstallPath; 
00160 #ifdef WantSendToMax
00161 #ifdef WIN32
00162     astring m_sMaxInstallPath;
00163 #endif
00164 #endif
00165     abool m_bPathsChanged;
00166     abool m_bExpertHidesSouth, m_bExpertHidesEast, m_bExpertHidesMenu, m_bExpertHidesStatus;
00167     aint m_iDragBoxSize;
00168     abool m_bShowLearningMovies;
00169     abool m_bShowWelcomeDialog;
00170     abool m_bShowViewCube;
00171     abool m_bHUDInfoMessage;
00172     abool m_bHUDHelpMessage;
00173     aenum m_iHelpType;
00174     astring m_sHelpLocation;
00175     abool m_bCompressFiles;
00176     abool m_bOBJThumbnail;
00177     abool m_bMUDContainsView, m_bMUDContainsBrush;
00178     abool m_bCull, m_bCreateBackup;
00179     abool m_bShowTileInfo;
00180 
00181     aenum m_bRenderSelectedPerFace;
00182     // map extraction
00183     //struct MapExtraction
00184     //{
00185         aint m_iMapWidth;
00186         aint m_iMapHeight;
00187         astring m_sOutputDir;
00188         abool m_bExtractNormal;
00189         abool m_bExtractDisplacement;
00190         abool m_bSmoothNormals;
00191         aint m_iSmoothLevel;
00192         aint m_iNormalSpace;
00193         afloat m_fRayTravel;
00194         aint m_eRayCenter;
00195         abool m_bPickBothSides;
00196         aint m_iEdgeBleed;
00197         aint m_iNormalFormat;
00198         aint m_iDisplacementFormat;
00199         aint m_iSubdivLow;
00200         astring m_sNormalFileName;
00201         astring m_sDisplacementFileName;
00202         abool m_bSkipEmptyMaps;
00203         aint m_iExtUDim;
00204         aint m_iUStart;
00205         abool m_bSelectedFacesOnly;
00206         astring m_sLowObjectName;
00207         astring m_sHighObjectName;
00208         abool m_bInvertTangent;
00209         abool m_bInvertBinormal;
00210         afloat m_fAreaTreshold;
00211     //} m_cMapExtraction;
00212 
00214     //struct DisplacementPreferences
00215     //{
00216         astring m_sTileRange;
00217         afloat m_fMiddleValue;
00218         aint m_iFirstTileIndex, m_iDispUDim;
00219         aint m_iMaskChannel, m_iNegativeDisplacementChannel, m_iPositiveDisplacementChannel;
00220         aint m_iXSubdivisionLevel;
00221         astring m_sObjectName;
00222         astring m_sDisplacementFileMask;
00223         astring m_sMaskFileMask;
00224 //  } m_cDisplacement;
00225 
00226     aenum m_eTextureRatio;
00227     afloat m_fTextureRatio;
00228 
00229     aenum m_eTiffCompression;
00230 
00231     avoid m_lExpertModeLabel;
00232     abool m_bMultisampling;
00233     astring m_sNextCommand;
00234 
00235     Store<Attribute *> m_aPluginAttributes;
00236 
00237     aenum m_eMeshRenderers;
00238 
00240     afloatr m_fPaintBleedDistance;
00241     afloatr m_fPaintBrushOffset;
00242     abool m_bFastDryBrush;
00243     astring m_sExportFilter;
00244 
00245     abool m_bHideEULANag;
00246 
00248     aint m_movieWidth;
00249     aint m_movieHeight;
00250     aint m_movieRecordFps;
00251     aint m_moviePlaybackFps;
00252     abool m_moviePauseWhenIdle;
00253     abool m_movieUses3dView;
00254 
00256     astring m_sPaintLayerFormat;
00257     aint m_iPaintLayerSize;
00258 
00260     AttributeLocale m_langui;
00261     AttributeLocale m_langhelp;
00262     AttributeLocale m_locale;
00263 
00265     abool m_bUseGigatexelEngine;
00266     afloatr m_fPaintBufferMemoryBudget;
00267     abool m_bLoadProxyTextures;
00268 
00270     astring m_sUILayoutPath;
00271     abool m_bLockUILayout;
00272 
00273     // Interaction Mode Preferences
00274     aenum m_eInteractionModeSelected;
00275 
00276     // Controls use of two channel textures.  Two channel textures (GL_LUMINANCE_ALPHA) save on GPU
00277     // memory.  Typically we'd always want to use two channel textures, however we're having regressions
00278     // on some AMD video cards.  Until we have those regressions addressed we'll default to four channel
00279     // for now.  This attribute is not retroactive, any textures that are already four channel will not
00280     // be turned into two channels.
00281     //
00282     // The number of channels used is internal only.  The user only sees four channel textures.
00283     abool m_bUseTwoChannelTextures;
00284 
00285     abool m_bDisplayCurvePoints;
00286 
00287     bool m_bLoadingPaths;
00288 
00298     class MBDLL_DECL Integer
00299     {
00300     public:
00301         Integer( 
00302             const QString &sName, 
00303             const QString &sCategory, 
00304             const QString &sNameTr, 
00305             const QString &sCategoryTr, 
00306             unsigned int iDefaultValue, 
00307             bool bVisible = true 
00308             );
00309         operator unsigned int( void ) const;
00310         aint *m_pAttribute;
00311     };
00313     class MBDLL_DECL Bool
00314     {
00315     public:
00316         Bool( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, bool bDefaultValue, bool bVisible = true );
00317         operator bool( void ) const;
00318         abool *m_pAttribute;
00319     };
00321     class MBDLL_DECL Float
00322     {
00323     public:
00324         Float( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, float fDefaultValue, float fMinimum, float fMaximum, bool bVisible = true );
00325         operator float( void ) const;
00326         afloatr *m_pAttribute;
00327     };
00329     class MBDLL_DECL String
00330     {
00331     public:
00332         String( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, const QString &sDefaultValue, bool bVisible = true );
00333         operator QString( void ) const;
00334         astring *m_pAttribute;
00335     };
00337     class MBDLL_DECL Color
00338     {
00339     public:
00340         Color( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, const mudbox::Color &cDefaultValue, bool bVisible = true );
00341         operator mudbox::Color( void ) const;
00342         acolor *m_pAttribute;
00343     };
00345     class MBDLL_DECL Vector
00346     {
00347     public:
00348         Vector( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, const mudbox::Vector &vDefaultValue, bool bVisible = true );
00349         operator mudbox::Vector( void ) const;
00350         avector *m_pAttribute;
00351     };
00353     class MBDLL_DECL Enum
00354     {
00355     public:
00356         Enum( const QString &sName, const QString &sCategory, const QString &sNameTr, const QString &sCategoryTr, int iDefaultValue, bool bVisible = true );
00357         operator int( void ) const;
00358         aenum *m_pAttribute;
00359     };
00360 
00361     private:
00362         QDir m_PreferencesPath;
00363         ClassDesc *m_pSelectedMeshRenderer;
00364 };
00365 
00366 }; // end of namespace mudbox