save basecontainer to file



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

    On 16/09/2004 at 22:55, xxxxxxxx wrote:

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

    ---------
    Is ti possible to write a single basecontainer to a file, and later restore it from the file?
    I dont want to store it in the project file, but in an seperate file.



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

    On 17/09/2004 at 05:17, xxxxxxxx wrote:

    I don´t think so, except you extract the container values and write those down. Why don´t you want to store it in the project file or in the worldcontainer?



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

    On 17/09/2004 at 05:39, xxxxxxxx wrote:

    Hm, thought there maybe is a function which writes the container to a file, internally surely there is one.
    The reason...how to say that in two sentences... I build an import manager, wizard based, independent import modules can be registered there at runtime and processed, with module specific configuration steps. It would be a nice feature if I could record the configuration steps in focus to write them to a file, for kind of import macro. Therefor the module import steps need a generic storage format, exactly what a BaseContainer is.
    Of course I can write my own baseContainer-write-to-file function, but thats some work to do, including some overhead in the container. Thought it is maybe already done somewhere.



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

    On 17/09/2004 at 06:39, xxxxxxxx wrote:

    Have you looked into a PrefsDialogHookClass? This is specifically designed to allow plugins to store preference data (stored in BaseContainers or whatnot).

    In general, BaseContainers are saved to file (i.e. C4D file) by default and already have write/read functions but they are called internally.

    Barring that, you could just as easily use 'system-dependent' read/write routines to your own file, but then, yes, this will require Getting and Setting the data to/from the BaseContainers from/to the file using your own routines.



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

    On 17/09/2004 at 06:52, xxxxxxxx wrote:

    PrefsDialogHookClass reads nice, not for this point, but for some other things we have to do :)
    For the macros, I want to have the possibility to save a macro of the import process I just did, and reload it later, so there will be a bunch of macros with the project.
    Maybe I'll write the macro information into the documents container. Then they'll be stored, but connected to my project. So if I would need the same import process in another project, I cannot use the macro again.
    Well, a write to file function for a basecontainer would be nice....I'll write it on my long list of "class libs I always wanted to write, but never had the time to" :)



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

    On 17/09/2004 at 06:59, xxxxxxxx wrote:

    Quote: _Maybe I'll write the macro information into the documents container. Then they'll be stored, but connected to my project. So if I would need the same import process in another project, I cannot use the macro again.
    >
    > * * *
    _


    That´s why I suggested to store it in the WorldContainer or the PluginWorldContainer. They are saved with Cinema 4D and not connected to any project.

    Best
    Samir



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

    On 17/09/2004 at 07:03, xxxxxxxx wrote:

    but the the problem is, that the macros are connected to cinema. on our target projects, more than one person will work at the same time, so everyone would have to make his own macros.
    bascontainertofile would be the best, independent files everyone can use.



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

    On 17/09/2004 at 07:24, xxxxxxxx wrote:

    I think you can make those library functions quite short if you use this trick... ;-)

        
        
        const LONG UNIQUE_ID = 42;  
        const DUMMY_OBJECT_TYPE = Osphere;
        
        
        
        
        Filename fn;  
        fn.FileSelect(FSTYPE_ANYTHING, GE_SAVE);
        
        
        
        
        {  
          BaseContainer bc;  
          bc.SetString(1000, "Test");
        
        
        
        
          AutoAlloc<BaseDocument> doc; if (!doc) return FALSE;  
          AutoAlloc<BaseObject> obj(DUMMY_OBJECT_TYPE); if (!obj) return FALSE;  
          obj->SetData(bc);
        
        
        
        
          doc->InsertObject(obj, NULL, NULL);  
          WriteHyperFile(doc, obj, fn, UNIQUE_ID);  
          obj->Remove();  
        }
        
        
        
        
        {  
          AutoAlloc<BaseDocument> doc; if (!doc) return FALSE;  
          AutoAlloc<BaseObject> obj(DUMMY_OBJECT_TYPE); if (!obj) return FALSE;
        
        
        
        
          doc->InsertObject(obj, NULL, NULL);  
          ReadHyperFile(doc, obj, fn, UNIQUE_ID, NULL);  
          obj->Remove();  
            
          GePrint(obj->GetData().GetString(1000));  
        }
    


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

    On 20/09/2004 at 06:09, xxxxxxxx wrote:

    =) thats the thing I wanted!


Log in to reply