iRenderPresets.h

Go to the documentation of this file.
00001 
00002 //
00003 //
00004 //  Render Preset Interface
00005 //
00006 //  Created 5/14/2003   Tom Burke
00007 //
00008 
00009 #pragma once
00010 
00011 #include "maxheap.h"
00012 #include "bitarray.h"
00013 #include "tab.h"
00014 #include "strbasic.h"
00015 
00026 #define RENDER_PRESETS_CATEGORY_COUNT               64
00027 #define RENDER_PRESETS_CUSTOM_CATEGORY_INDEX_BEGIN  32
00028 
00029 
00030 // return values
00031 //
00032 #define RENDER_PRESETS_SUCCESS              0
00033 #define RP_ERROR_OBSOLETE_FILE              1
00034 #define RP_ERROR_INCOMPATABLE_FILE          2
00035 #define RP_ERROR_CATEGORY_NOT_COMPATABLE    3
00036 #define RP_ERROR_SAVING_FILE                4
00037 #define RP_ERROR_LOADING_FILE               5
00038 #define RP_ERROR_CANCEL                     6
00039 #define RP_ERROR_FILE_NOT_FOUND             7
00040 
00041 
00042 class RenderPresetsContext: public MaxHeapOperators {
00043 public:
00044     RenderPresetsContext( int version, BitArray categories ) { mVersion = version; mCategories = categories; }
00045     BitArray GetCategories() { return mCategories; }
00046     int       GetVersion() { return mVersion; }
00047 
00048 private:
00049     int      mVersion;
00050     BitArray mCategories;
00051 };
00052 
00057 class IRenderPresetsManager: public MaxHeapOperators {
00058 public:
00059     enum RendererSpecifier
00060     {
00061         kProduction = 0,
00062         kMaterial,
00063         kActiveShade
00064     };
00065 
00066     enum NodeRefAction
00067     {
00068         kUnspecified = -1,
00069         kLoadAll = 0,
00070         kLoadNonNodeRefMakers = 1,
00071         kLoadNone = 2,
00072     };
00073 
00075     virtual ~IRenderPresetsManager() {;}
00076   
00082     virtual int      Save( RendererSpecifier rendSpecifier ) = 0;
00089     virtual int      Save( RendererSpecifier rendSpecifier, const MCHAR * fileName ) = 0;
00095     virtual int      Save( RendererSpecifier rendSpecifier, const MCHAR * fileName, BitArray saveCategories ) = 0;
00096 
00102     virtual int      Load( RendererSpecifier rendSpecifier ) = 0;
00109     virtual int      Load( RendererSpecifier rendSpecifier, const MCHAR * fileName ) = 0;
00118     virtual int      Load( RendererSpecifier rendSpecifier, const MCHAR * fileName, BitArray loadCategories, NodeRefAction nodeRefAction = kUnspecified ) = 0;
00119 
00129     virtual int      IsFileCompatible( RendererSpecifier rendSpecifier, const MCHAR * fileName ) = 0;  
00130 
00131     // Convert between category index and category name for render preset files
00132 
00137     virtual MCHAR *  MapIndexToCategory( const MCHAR * fileName, int catIndex  ) = 0;
00142     virtual int      MapCategoryToIndex( const MCHAR * fileName, const MCHAR* category ) = 0;
00143 
00148     virtual MCHAR *  MapIndexToCategory( RendererSpecifier rendSpecifier, int catIndex  ) = 0;
00153     virtual int      MapCategoryToIndex( RendererSpecifier rendSpecifier, const MCHAR* category ) = 0;
00154 
00157     virtual BitArray LoadCategories( const MCHAR * fileName ) = 0; // list of categories saved in the file
00160     virtual Tab<MCHAR *> LoadCategoryNames( const MCHAR * fileName ) = 0;
00161 
00165     virtual BitArray SaveCategories( RendererSpecifier rendSpecifier ) = 0;
00169     virtual Tab<MCHAR *> SaveCategoryNames( RendererSpecifier rendSpecifier ) = 0;
00170 
00180     virtual RenderPresetsContext * GetContext() = 0;
00181 };
00182