Load/Save Presets?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2007 at 09:06, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.111 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi,

    I want a function to load and save the data of all parameters of my expression tag. All Sliders and Spline Curves and so on.

    Is there a way for storing all the parameters I want to be saved in a NodeData() object and save it to / load it from a file?

    Thanks for help.

    Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2007 at 12:42, xxxxxxxx wrote:

    Anything defined in the resource as descriptions for the plugin tag is loaded/saved automatically. You do not EVER need to load and save these yourself - probably not recommended either.

    Anything not defined there, such as class variables, should be loaded/saved using Read()/Write()/CopyTo() (when you use one of these methods, all three must be defined in the plugin Data - your TagData derived class).

    If any variables depend on other tags/objects/etc., you'll want to set them by checking for the MSG_MULTI_DOCUMENTIMPORTED message in Message() for your tag. This guarantees that the entire document has been loaded for proper referencing.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2007 at 15:00, xxxxxxxx wrote:

    I know that all settings are stored in the scene. But I want to be able to store his settings to a file, so he can archive his favourite settings. Like presets.

    Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2007 at 15:39, xxxxxxxx wrote:

    Oh, that's more explanatory! :)

    For something like presets, you'll have to devise a file format and use a BaseFile and its methods or write a text file (fprintf/fscanf?). Possibly a hard-named file (I use, for instance, ipptool.prf for my tool settings) or you can open a file dialog so that the user can load from/save into a particular file.

    How to read/write the presets depends upon which way you go: BaseFile or C/C++ methods. For the C4D types, you'll need to convert for the latter method (write 1/0 or TRUE/FALSE for bools and so on). If you need some example code, I can provide it but you should be able to get the hang of it. Try a single variable first for read and write to test the veracity. Once that is established, fill out all of the reading/writing to be done.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2007 at 17:45, xxxxxxxx wrote:

    Hi,

    yeah, some example code would be great!

    I had hoped for some possibility to write the complete contents of a PluginData or BaseContainer class into a file. That way, I would just have to copy the settings that should be saved to a separate BaseContainer and write a kinda BaseContainer File.

    Regards,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/09/2007 at 18:26, xxxxxxxx wrote:

    Unfortunately, there is no WriteContainer/ReadContainer. ;)

    These methods do exist in the HyperFile but have not tried this approach. This may suffice for your requirements.

    Otherwise, this is my entire plugin preferences load and save methods; a bit much, but it show everything needed. Note that the BaseFile* is passed in from the dialog so you'll want to either do similar or AutoAlloc the BaseFile and Filename::Select to get the file to open for read/write. Also note that this file tracks the version so as to ignore newer settings.

    // CMD: Load Settings from Prefs file  
    //*---------------------------------------------------------------------------*  
    BOOL Settings::LoadSettings(BaseFile* baseFile, BOOL loadDefault)  
    //*---------------------------------------------------------------------------*  
    {  
         // Load either Default or User-Selected Preferences  
         Filename     baseFilename;  
         if (!loadDefault)  
         {  
              baseFilename = GeGetPluginPath();  
              if (!baseFilename.FileSelect(0, 0, &GeLoadString;(IPPS_LOADPREFS_DLG))) return TRUE;  
         }  
         else baseFilename = prefs_Filename;  
      
         baseFile->Close();  
         // Open file  
         if (!baseFile->Open(baseFilename, GE_READ, FILE_NODIALOG))     return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_OPENFILE_TEXT), baseFilename.GetString());  
      
         Filename     ppath;  
         LONG          longv;  
         UCHAR          version[3];  
      
         // Read interPoser Pro Preferences Version  
         baseFile->ReadBytes(&version;[0], 3);  
         // v0.4.3  
         // General  
         // - Read BOOL autoPrefs  
         if (!baseFile->ReadBool(&autoPrefs;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read Real objScaling  
         if (!baseFile->ReadReal(&objScaling;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read Real infiniteLightRadius  
         if (!baseFile->ReadReal(&infiniteLightRadius;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
      
         // Scene  
         // - Read BOOL includeCameras  
         if (!baseFile->ReadBool(&includeCameras;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read BOOL includeLights  
         if (!baseFile->ReadBool(&includeLights;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read BOOL includeGround  
         if (!baseFile->ReadBool(&includeGround;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
      
         // Dials  
         // - Read BOOL overrideMorphEdit  
         if (!baseFile->ReadBool(&overrideMorphEdit;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read Real morphEditMin  
         if (!baseFile->ReadReal(&morphEditMin;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read Real morphEditMax  
         if (!baseFile->ReadReal(&morphEditMax;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read Real morphEditStep  
         if (!baseFile->ReadReal(&morphEditStep;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
      
         // Materials  
         // - Read BOOL useTMin  
         if (!baseFile->ReadBool(&useTMin;))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read BOOL useReflection  
         if (!baseFile->ReadBool(&useReflection;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read BOOL useSpecularMode  
         if (!baseFile->ReadBool(&useSpecularMode;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read BOOL useIllumModel  
         if (!baseFile->ReadBool(&useIllumModel;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read LONG specularMode  
         if (!baseFile->ReadLong(&specularMode;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read LONG illumModel  
         if (!baseFile->ReadLong(&illumModel;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Read ChannelSampling Sampling[6]  
         for (INT i = 0; i < 6; ++i)  
         {  
              if (!baseFile->ReadBool(&(Sampling _.use)))                return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadLong(&(Sampling _.sampling)))           return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadReal(&(Sampling _.blurOffset)))           return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadReal(&(Sampling _.blurScale)))           return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         // Read BOOL useDisplacement  
         if (!baseFile->ReadBool(&useDisplacement;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read BOOL heightAbsolute  
         if (!baseFile->ReadBool(&heightAbsolute;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read LONG displacementType  
         if (!baseFile->ReadLong((LONG* )&displacementType;))               return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read LONG subdivisionLevel  
         if (!baseFile->ReadLong((LONG* )&subdivisionLevel;))               return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read BOOL roundGeometry  
         if (!baseFile->ReadBool(&roundGeometry;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read BOOL roundContour  
         if (!baseFile->ReadBool(&roundContour;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read BOOL mapRoundedGeometry  
         if (!baseFile->ReadBool(&mapRoundedGeometry;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read BOOL mapResultingGeometry  
         if (!baseFile->ReadBool(&mapResultingGeometry;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read BOOL keepOriginalEdges  
         if (!baseFile->ReadBool(&keepOriginalEdges;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // Read BOOL bestDistribution  
         if (!baseFile->ReadBool(&bestDistribution;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
      
         // - Read Filename Project path and verify  
         if (!baseFile->ReadFilename(&ppath;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
    // v1.1.5:     Consider migration from R9.6/PPC to R10UB  
    #ifdef     C4D_R10UB  
         if (GeFExist(ppath, FALSE) || GeFExist(ppath, TRUE))          ProjectPath =     ppath;  
         // Check for no '/' path separators  
         else if (!ppath.GetString().FindFirst('/', &longv;))  
         {  
              String     p =     ppath.GetString();  
              // MacOS C4D R10 - change ':' to '/'  
              while (p.FindFirst(':', &longv;))     p[longv] = '/';  
              if (p[0] == '/')     ppath =               Filename(String("/Volumes")+p);  
              else                    ppath =               Filename(String("/Volumes/")+p);  
              if (GeFExist(ppath, FALSE) || GeFExist(ppath, TRUE))     ProjectPath =     ppath;  
              //else                                                                 MessageDialog("Project: "+ppath.GetString()+" was not found!");  
         }  
         //else if (ppath.Content())                                             MessageDialog("Project: "+ppath.GetString()+" was not found!");  
    #else  
         if (GeFExist(ppath, FALSE) || GeFExist(ppath, TRUE))          ProjectPath =     ppath;  
         //else if (ppath.Content())                                             MessageDialog("Project: "+ppath.GetString()+" was not found!");  
    #endif  
      
         // RuntimeExplorer  
         // - Read Normal/Selected Color values  
         if (!baseFile->ReadVector(&colorsExplorer;[0]))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->ReadVector(&colorsExplorer;[1]))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->ReadVector(&colorsExplorer;[2]))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->ReadVector(&colorsExplorer;[3]))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->ReadVector(&colorsExplorer;[4]))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->ReadVector(&colorsExplorer;[5]))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         // - Get Runtimes  
         // -- Read LONG number of Runtimes  
         if (!baseFile->ReadLong(&longv;))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         if (longv)  
         {  
              bDelete(firstIPPRuntime);  
              firstIPPRuntime =          bNew IPPRuntime[longv];  
              if (!firstIPPRuntime)     return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_MEMORY_TEXT), "Settings.LoadSettings.firstIPPRuntime");  
              lastIPPRuntime =          firstIPPRuntime + longv;  
              Bool     boolean;  
              // -- Read Filename Runtime paths from file  
              for (IPPRuntime* rt = firstIPPRuntime; rt != lastIPPRuntime; ++rt)  
              {  
                   if (!baseFile->ReadBool(&boolean;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
                   if (!baseFile->ReadFilename(&ppath;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
    // v1.1.5:     Consider migration from R9.6/PPC to R10UB  
    #ifdef     C4D_R10UB  
                   if (GeFExist(ppath, TRUE))  
                   {  
                        rt->enable =     boolean;  
                        rt->path =          ppath;  
                        GePrint("Runtime: "+ppath.GetString()+" Exists");  
                   }  
                   // Check for no '/' path separators  
                   else if (!ppath.GetString().FindFirst('/', &longv;))  
                   {  
                        String     p =     ppath.GetString();  
                        // MacOS C4D R10 - change ':' to '/'  
                        while (p.FindFirst(':', &longv;))     p[longv] = '/';  
                        if (p[0] == '/')     ppath =               Filename(String("/Volumes")+p);  
                        else                    ppath =               Filename(String("/Volumes/")+p);  
                        if (GeFExist(ppath, TRUE))  
                        {  
                             rt->enable =          boolean;  
                             rt->path =               ppath;  
                        }  
                        else                                                       MessageDialog("Runtime: "+ppath.GetString()+" not added!");  
                   }  
                   else                                                            MessageDialog("Runtime: "+ppath.GetString()+" not added!");  
    #else  
                   // Verify existence  
                   if (GeFExist(ppath, TRUE))  
                   {  
                        rt->enable =     boolean;  
                        rt->path =          ppath;  
                   }  
                   else                                                            MessageDialog("Runtime: "+ppath.GetString()+" not added!");  
    #endif  
              }  
         }  
         // - Read String lastRTEFolder  
         if (!baseFile->ReadString(&lastRTI;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
      
         if (CheckInterPoserVersion(&version;[0], 0, 4, 7) >= 0)  
         {  
              // Read BOOL imageSearch  
              if (!baseFile->ReadBool(&imageSearch;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // Read BOOL useMasterSlaves  
              if (!baseFile->ReadBool(&useMasterSlaves;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 4, 8) >= 0)  
         {  
              // Read BOOL clearSelection  
              if (!baseFile->ReadBool(&clearSelection;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // Read BOOL storeUndoLoad  
              if (!baseFile->ReadBool(&storeUndoLoad;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 4, 9) >= 0)  
         {  
              // Dials  
              // - Read BOOL overrideParmEdit  
              if (!baseFile->ReadBool(&overrideParmEdit;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real parmEditMin  
              if (!baseFile->ReadReal(&parmEditMin;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real parmEditMax  
              if (!baseFile->ReadReal(&parmEditMax;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real parmEditStep  
              if (!baseFile->ReadReal(&parmEditStep;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 5, 8) >= 0)  
         {  
              // - Read BOOL logging  
              if (!baseFile->ReadBool(&logging;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 6, 2) >= 0)  
         {  
              // Dials  
              // - Read BOOL overrideTransEdit  
              if (!baseFile->ReadBool(&overrideTransEdit;))               return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real transEditMin  
              if (!baseFile->ReadReal(&transEditMin;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real transEditMax  
              if (!baseFile->ReadReal(&transEditMax;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real transEditStep  
              if (!baseFile->ReadReal(&transEditStep;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 6, 3) >= 0)  
         {  
              // Scene  
              // - Read BOOL groupCameras  
              if (!baseFile->ReadBool(&groupCameras;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL groupLights  
              if (!baseFile->ReadBool(&groupLights;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 6, 7) >= 0)  
         {  
              // Dialog  
              // - Read BOOL explorerFold  
              if (!baseFile->ReadBool(&explorerFold;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL actionsFold  
              if (!baseFile->ReadBool(&actionsFold;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL prefsGeneralFold  
              if (!baseFile->ReadBool(&prefsGeneralFold;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL prefsSceneFold  
              if (!baseFile->ReadBool(&prefsSceneFold;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL prefsDialsFold  
              if (!baseFile->ReadBool(&prefsDialsFold;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL prefsMatFold  
              if (!baseFile->ReadBool(&prefsMatFold;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
      
              // Materials  
              // - Read BOOL useLuminance  
              if (!baseFile->ReadBool(&useLuminance;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real illumDiffuseFalloff  
              if (!baseFile->ReadReal(&illumDiffuseFalloff;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real illumDiffuseLevel  
              if (!baseFile->ReadReal(&illumDiffuseLevel;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real illumRoughness  
              if (!baseFile->ReadReal(&illumRoughness;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read LONG texturePreviewSize  
              if (!baseFile->ReadLong((LONG* )&texturePreviewSize;))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Luminance ChannelSampling Sampling[CHANNELSAMPLING_LUMINANCE]  
              if (!baseFile->ReadBool(&(Sampling[CHANNELSAMPLING_LUMINANCE].use)))               return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadLong(&(Sampling[CHANNELSAMPLING_LUMINANCE].sampling)))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadReal(&(Sampling[CHANNELSAMPLING_LUMINANCE].blurOffset)))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadReal(&(Sampling[CHANNELSAMPLING_LUMINANCE].blurScale)))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 6, 8) >= 0)  
         {  
              // - Read BOOL handSpreadLimits  
              if (!baseFile->ReadBool(&handSpreadLimits;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 7, 2) >= 0)  
         {  
              // - Read Filename externalApp  
              if (!baseFile->ReadFilename(&externalApp;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 0, 7, 9) >= 0)  
         {  
              // - Read BOOL ignoreMatCase  
              if (!baseFile->ReadBool(&ignoreMatCase;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 1, 1, 3) >= 0)  
         {  
              // - Read BOOL hideBanner  
              if (!baseFile->ReadBool(&hideBanner;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 1, 3, 3) >= 0)  
         {  
              // - Read Vector ikColor  
              if (!baseFile->ReadVector(&ikColor;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read LONG ikDisplay  
              if (!baseFile->ReadLong(&ikDisplay;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read LONG ikOrient  
              if (!baseFile->ReadLong(&ikOrient;))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real ikRadius  
              if (!baseFile->ReadReal(&ikRadius;))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Real ikAspect  
              if (!baseFile->ReadReal(&ikAspect;))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 1, 4, 0) >= 0)  
         {  
              // - Read BOOL newStyleApply  
              if (!baseFile->ReadBool(&new;StyleApply))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL autoSave  
              if (!baseFile->ReadBool(&autoSave;))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read LONG numRecentContent  
              if (!baseFile->ReadLong(&numRecentContent;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read LONG numRecentScene  
              if (!baseFile->ReadLong(&numRecentScene;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // Dialog  
              // - Read BOOL recentFold  
              if (!baseFile->ReadBool(&recentFold;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read BOOL favoritesFold  
              if (!baseFile->ReadBool(&favoritesFold;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 1, 4, 3) >= 0)  
         {  
              // - Read BOOL autoThumbWidth  
              if (!baseFile->ReadBool(&autoThumbWidth;))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 1, 4, 4) >= 0)  
         {  
              // - Read BOOL autoThumbWidthFave  
              if (!baseFile->ReadBool(&autoThumbWidthFave;))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              // - Read Favorites Normal/Selected Color values  
              if (!baseFile->ReadVector(&colorsFavorites;[0]))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadVector(&colorsFavorites;[1]))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadVector(&colorsFavorites;[2]))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->ReadVector(&colorsFavorites;[3]))                    return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         if (CheckInterPoserVersion(&version;[0], 1, 5, 5) >= 0)  
         {  
              // - Read BOOL pngMethod  
              if (!baseFile->ReadBool(&pngMethod;))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_READFILE_TEXT), baseFilename.GetString());  
         }  
         // add new version values here (skip if they don't exist)  
      
         baseFile->Close();  
         return TRUE;  
    }  
    // CMD: Save Settings to Prefs file  
    //*---------------------------------------------------------------------------*  
    BOOL Settings::SaveSettings(BaseFile* baseFile, const Filename& baseFilename, LONG rtCount, RuntimeItem* firstRTI, RuntimeItem* selected)  
    //*---------------------------------------------------------------------------*  
    {  
         baseFile->Close();  
         // Open prefs.txt and write out Settings and Runtimes  
         if (!baseFile->Open(baseFilename, GE_WRITE, FILE_NODIALOG))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_OPENFILE_TEXT), baseFilename.GetString());  
           
         // - Write UCHAR version[3]  
         if (!baseFile->WriteBytes(&INTERPOSERPRO;_VERSION[0], 3))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // v0.4.3  
         // General  
         // - Write BOOL autoPrefs  
         if (!baseFile->WriteBool(autoPrefs))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real objScaling  
         if (!baseFile->WriteReal(objScaling))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real infiniteLightRadius  
         if (!baseFile->WriteReal(infiniteLightRadius))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // Scene  
         // - Write BOOL includeCameras  
         if (!baseFile->WriteBool(includeCameras))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL includeLights  
         if (!baseFile->WriteBool(includeLights))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL includeGround  
         if (!baseFile->WriteBool(includeGround))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // Dials  
         // - Write BOOL overrideMorphEdit  
         if (!baseFile->WriteBool(overrideMorphEdit))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real morphEditMin  
         if (!baseFile->WriteReal(morphEditMin))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real morphEditMax  
         if (!baseFile->WriteReal(morphEditMax))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real morphEditStep  
         if (!baseFile->WriteReal(morphEditStep))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // Materials  
         // - Write BOOL useTMin  
         if (!baseFile->WriteBool(useTMin))                                        return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL useReflection  
         if (!baseFile->WriteBool(useReflection))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL useSpecularMode  
         if (!baseFile->WriteBool(useSpecularMode))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL useIllumModel  
         if (!baseFile->WriteBool(useIllumModel))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG specularMode  
         if (!baseFile->WriteLong(specularMode))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG illumModel  
         if (!baseFile->WriteLong(illumModel))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write ChannelSampling Sampling[6]  
         for (INT i = 0; i < 6; ++i)  
         {  
              if (!baseFile->WriteBool(Sampling _.use))                          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->WriteLong(Sampling _.sampling))                     return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->WriteReal(Sampling _.blurOffset))                return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->WriteReal(Sampling _.blurScale))                return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         }  
         // Displacement  
         // - Write BOOL useDisplacement  
         if (!baseFile->WriteBool(useDisplacement))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL heightAbsolute  
         if (!baseFile->WriteBool(heightAbsolute))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG displacementType  
         if (!baseFile->WriteLong(displacementType))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG subdivisionLevel  
         if (!baseFile->WriteLong(subdivisionLevel))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL roundGeometry  
         if (!baseFile->WriteBool(roundGeometry))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL roundContour  
         if (!baseFile->WriteBool(roundContour))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL mapRoundedGeometry  
         if (!baseFile->WriteBool(mapRoundedGeometry))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL mapResultingGeometry  
         if (!baseFile->WriteBool(mapResultingGeometry))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL keepOriginalEdges  
         if (!baseFile->WriteBool(keepOriginalEdges))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL bestDistribution  
         if (!baseFile->WriteBool(bestDistribution))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // - Write Filename Project path  
         if (!baseFile->WriteFilename(ProjectPath))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // Runtime Explorer  
         // - Write Normal/Selected Color values  
         if (!baseFile->WriteVector(colorsExplorer[0]))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsExplorer[1]))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsExplorer[2]))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsExplorer[3]))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsExplorer[4]))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsExplorer[5]))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG RuntimeExplorer Count  
         if (!baseFile->WriteLong(rtCount))                                        return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write RuntimeExplorer paths  
         for (RuntimeItem* rt = firstRTI; rt; rt = rt->GetNext())  
         {  
              // - Write BOOL rt->flag&checked;  
              if (!baseFile->WriteBool(rt->GetBit(RTFLAGS_CHECKED)))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
              if (!baseFile->WriteFilename(rt->GetFilename()))               return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), rt->GetFilename().GetString());  
         }  
         if (selected)  
         {  
              // - Write String lastRTEFolder  
              if (!baseFile->WriteString(selected->GetPathString()))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         }  
         else if (!baseFile->WriteString(String("")))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.4.7  
         // - Write BOOL imageSearch  
         if (!baseFile->WriteBool(imageSearch))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteBool(useMasterSlaves))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // v0.4.8  
         if (!baseFile->WriteBool(clearSelection))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteBool(storeUndoLoad))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.4.9  
         // Dials  
         // - Write BOOL overrideParmEdit  
         if (!baseFile->WriteBool(overrideParmEdit))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real parmEditMin  
         if (!baseFile->WriteReal(parmEditMin))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real parmEditMax  
         if (!baseFile->WriteReal(parmEditMax))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real parmEditStep  
         if (!baseFile->WriteReal(parmEditStep))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.5.8   
         // - Write BOOL logging  
         if (!baseFile->WriteBool(logging))                                        return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.6.1  
         // Dials  
         // - Write BOOL overrideTransEdit  
         if (!baseFile->WriteBool(overrideTransEdit))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real transEditMin  
         if (!baseFile->WriteReal(transEditMin))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real transEditMax  
         if (!baseFile->WriteReal(transEditMax))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real transEditStep  
         if (!baseFile->WriteReal(transEditStep))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.6.3  
         // - Write BOOL groupCameras  
         if (!baseFile->WriteBool(groupCameras))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL groupLights  
         if (!baseFile->WriteBool(groupLights))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.6.7  
         // Dialog  
         // - Write BOOL explorerFold  
         if (!baseFile->WriteBool(explorerFold))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL actionsFold  
         if (!baseFile->WriteBool(actionsFold))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL prefsGeneralFold  
         if (!baseFile->WriteBool(prefsGeneralFold))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL prefsSceneFold  
         if (!baseFile->WriteBool(prefsSceneFold))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL prefsDialsFold  
         if (!baseFile->WriteBool(prefsDialsFold))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL prefsMatFold  
         if (!baseFile->WriteBool(prefsMatFold))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // Materials  
         // - Write BOOL useLuminance  
         if (!baseFile->WriteBool(useLuminance))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real illumDiffuseFalloff  
         if (!baseFile->WriteReal(illumDiffuseFalloff))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real illumDiffuseLevel  
         if (!baseFile->WriteReal(illumDiffuseLevel))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real illumRoughness  
         if (!baseFile->WriteReal(illumRoughness))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG texturePreviewSize  
         if (!baseFile->WriteLong(texturePreviewSize))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Luminance ChannelSampling Sampling[CHANNELSAMPLING_LUMINANCE]  
         if (!baseFile->WriteBool(Sampling[CHANNELSAMPLING_LUMINANCE].use))               return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteLong(Sampling[CHANNELSAMPLING_LUMINANCE].sampling))          return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteReal(Sampling[CHANNELSAMPLING_LUMINANCE].blurOffset))     return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteReal(Sampling[CHANNELSAMPLING_LUMINANCE].blurScale))     return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.6.8  
         // - Write BOOL handSpreadLimits  
         if (!baseFile->WriteBool(handSpreadLimits))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.7.2  
         // - Write Filename externalApp  
         if (!baseFile->WriteFilename(externalApp))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v0.7.9  
         // - Write BOOL ignoreMatCase  
         if (!baseFile->WriteBool(ignoreMatCase))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v1.1.3  
         // - Write BOOL hideBanner  
         if (!baseFile->WriteBool(hideBanner))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v1.3.3  
         // - Write Vector ikColor  
         if (!baseFile->WriteVector(ikColor))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG ikDisplay  
         if (!baseFile->WriteLong(ikDisplay))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG ikOrient  
         if (!baseFile->WriteLong(ikOrient))                                        return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real ikRadius  
         if (!baseFile->WriteReal(ikRadius))                                        return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Real ikAspect  
         if (!baseFile->WriteReal(ikAspect))                                        return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v1.4.0  
         // - Write BOOL newStyleApply  
         if (!baseFile->WriteBool(newStyleApply))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL autoSave  
         if (!baseFile->WriteBool(autoSave))                                        return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG numRecentContent  
         if (!baseFile->WriteLong(numRecentContent))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write LONG numRecentScene  
         if (!baseFile->WriteLong(numRecentScene))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL recentFold  
         if (!baseFile->WriteBool(recentFold))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write BOOL favoritesFold  
         if (!baseFile->WriteBool(favoritesFold))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v1.4.3  
         // - Write BOOL autoThumbWidth  
         if (!baseFile->WriteBool(autoThumbWidth))                              return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v1.4.4  
         // - Write BOOL autoThumbWidthFave  
         if (!baseFile->WriteBool(autoThumbWidthFave))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         // - Write Favorites Normal/Selected Color values  
         if (!baseFile->WriteVector(colorsFavorites[0]))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsFavorites[1]))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsFavorites[2]))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
         if (!baseFile->WriteVector(colorsFavorites[3]))                         return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         // v1.5.5  
         // - Write BOOL pngMethod  
         if (!baseFile->WriteBool(pngMethod))                                   return ErrorException::Throw(EE_DIALOG, GeLoadString(IPPERR_WRITEFILE_TEXT), baseFilename.GetString());  
      
         baseFile->Close();  
         return TRUE;  
    }
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/09/2007 at 07:02, xxxxxxxx wrote:

    Hi,

    OK, I made certain progress. Here are my SavePreset() and LoadPreset() functions (shortened a bit).

    First, there's SavePreset() :

    static Bool SavePreset(BaseTag *tag, Filename fn)  
    {  
         BaseFile* PresetFile;  
         PresetFile = BaseFile::Alloc(); if (!PresetFile) return FALSE;  
         if (PresetFile->Open(fn, GE_WRITE, FILE_DIALOG, GE_MOTOROLA, MACTYPE_CINEMA, MACCREATOR_CINEMA))  
         {  
              // Main Settings  
              PresetFile->WriteBool(tag->GetData().GetBool(SCOOBYCAMEXP_ENABLED));  
              PresetFile->WriteReal(tag->GetData().GetReal(SCOOBYCAMEXP_MAINFACTOR));  
              PresetFile->Close();  
              return TRUE;  
         }  
         else  
         {  
              return FALSE;  
         }  
           
    }
    

    The LoadPreset() looks almost similar:

    static Bool LoadPreset(BaseTag *tag, Filename fn)  
    {  
         BaseFile* PresetFile;  
         PresetFile = BaseFile::Alloc(); if (!PresetFile) return FALSE;  
         if (PresetFile->Open(fn, GE_READ, FILE_IGNOREOPEN, GE_MOTOROLA, MACTYPE_CINEMA, MACCREATOR_CINEMA))  
         {  
              BaseContainer *data = tag->GetDataInstance();  
              Bool BoolData;  
              Real RealData;  
      
              PresetFile->ReadBool(&BoolData;); data->SetBool(SCOOBYCAMEXP_ENABLED, BoolData);  
              PresetFile->ReadReal(&RealData;); data->SetReal(SCOOBYCAMEXP_MAINFACTOR, RealData);  
      
              PresetFile->Close();  
         }  
    }  
    

    For Bool, Real and Vector data this works perfectly. But now I have TWO questions:

    1. Isn't it a clumsy way to use those BoolData and RealData variables in the LoadPreset() function? Isn't there a more elegant solution to read the value and derectly put it into the BaseTag data?

    2. How can I read and write a spline from the BaseTag's data? For example, I have such a Spline data:

    SC_TargetBlendCurve = (SplineData* ) tag->GetDataInstance()->GetCustomDataType(SCOOBYCAMEXP_TARGET_BLENDSPLINE, CUSTOMDATATYPE_SPLINE);
    

    How can I write SC_TargetBlendCurve into the file and also read it from the file & put it back to the Tag's DataInstance?

    You see, I am still beginner in C++ ;-)

    Thanks a lot for any help!!

    Best regards & Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/09/2007 at 13:38, xxxxxxxx wrote:

    1. There is no way around this. You need to get at the value using a variable as an argument and then set the value using a variable. Since the ReadXXX() methods don't return the value (only success of reading), how else would you go about it? :)

    2. You're going to need to dive into the resource folder and find the Spline resources for this custom data type in order to write that data out and read back in properly. You'll probably need to use a mix of GetDataIntance() and GetParameterI()/SetParameter() to get at the SplineData data.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/09/2007 at 14:01, xxxxxxxx wrote:

    1. OK, I supposed so. I'll survive it ;-)

    2. I know how to access the SplineData, but do I really have to store all spline parameters separately? Is there no way to write a complete SplineData to a file?

    I thought maybe WriteBytes(data, len) would help, but I am not sure if I am right and how to use it.

    Regards,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/09/2007 at 20:49, xxxxxxxx wrote:

    Yes, you really do. ;) If you store the 'data' you won't get much as most of it is stored in BaseContainers - and remember that BaseContainers can contain BaseContainers and other data types not necessarily fully described. Now, you can read/write BaseContainers to a Hyperfile but not using BaseFile or any non-SDK method.

    As noted in the docs, I'd avoid reading/writing byte blocks as much as possible. First, they are not platform-independent. If you are going to support both Windows and MacOS, you'll need to be extremely careful about byte-order (which system saved it and which is reading it?). I've done it in the past with limited success - sometimes the data was not read properly when going between systems.

    Second, something you might want to contemplate considerably, is that the data in the SplineData is not guaranteed never to change. This is Maxon's and they might decide to add/remove/change/reorder data on a whim (for efficiency or new feature, perhaps) in the next release - and then where are you? See why this isn't a good idea? If the data block was yours and you had that control, it'd be more tenable.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/09/2007 at 00:04, xxxxxxxx wrote:

    OK, then I'll do that :-(

    I was worried about how to determine which amount of data I have to read, since I do not know how many points a spline has, before I read them all. But I think, I'll just write the number of points and then read the appropriate number of values from the file.

    Let's see how it works out. If I find a nice function for reading and writing spline data, I will post it here.

    Greetings,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/09/2007 at 00:27, xxxxxxxx wrote:

    Saving the number of points in the spline and reading it in accordingly is a good practice. As you can see in my voluminous code example, this is exacly what I do for other variable numbers of elements. I store the count in a description resource and use that for the loop that reads in variable lengths of data elements.

    The Hyperfile route may work here but it would be prudent to try it to see the results. Nonetheless, the second difficulty noting the volatile nature of the structures involved needs to be considered. Even supported structures like animation data has changed from R8.0 to R9.0 to R10.0 making compatability an issue when even stock plugin support is involved.

    I agree that this requires more work and more consideration (I have 13 builds for one of my plugins which requires numerous preprocessor defines to placate the various methods and changes in the SDK over time). But the thing is not to only consider the current build but future expectations of change. At some point, something seemingly concrete changes (say Polygon* to CPolygon* as a nasty example of required code adaptation). Any parameters that can be described 'independently' so as to provide the least correspondence changes later will prove useful to continued support and easier updates.

    So, basically, by going the more verbose route you should find it easier (believe it or not) to adapt the code to changes in the SDK just by making the appropriate preprocessor defines when you are supporting various versions.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/09/2007 at 15:35, xxxxxxxx wrote:

    I have made myself two nice little functions. I pass to them the BaseFile (already open for writing) and the SplineData.

    This one writes SplineData into the BaseFile:

    static Bool WriteSplineData(BaseFile *bf, SplineData *spd)  
    {  
         Real SplineRound;  
         LONG KnotCount;  
         LONG i;  
         SplineData *sd = (SplineData* ) spd;  
      
         if (!sd || !bf) return FALSE;  
         SplineRound = sd->GetRound();  
         KnotCount = sd->GetKnotCount();  
      
         bf->WriteLong(KnotCount);  
         bf->WriteReal(SplineRound);  
         if (KnotCount > 0)  
         {  
              for (i=1; i<=KnotCount; i++)  
              {  
                   bf->WriteVector(sd->GetKnots() _.vPos);  
              }  
         }  
         return TRUE;  
    }
    

    And this one for reading the data from a BaseFile:

    static Bool ReadSplineData(BaseFile *bf, SplineData *spd)  
    {  
         Real SplineRound;  
         LONG KnotCount;  
         LONG i;  
         Vector VectorData;  
         SplineData *sd = (SplineData* ) spd;  
      
         if (!sd || !bf) return FALSE;  
         bf->ReadLong(&KnotCount;);  
         bf->ReadReal(&SplineRound;);  
      
         sd->DeleteAllPoints();  
         sd->SetRound(SplineRound);  
      
         if (KnotCount > 0)  
         {  
              for (i=1; i<=KnotCount; i++)  
              {  
                   bf->ReadVector(&VectorData;);  
                   sd->InsertKnot(VectorData.x, VectorData.y);  
              }  
         }  
         return TRUE;  
    }
    

    Best regards,
    Jack


Log in to reply