Save Polygons for Melange



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

    On 30/09/2010 at 10:23, xxxxxxxx wrote:

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

    ---------
    I have some questions about this option:
    Edit -> Preferences -> Files -> Save Polygons for Melange
    Does this option perform the same action as doc->Polygonize() ?
    If it works like Polygonize(), then does that mean I don't have to call Polygonize() if this option
    is checked?
    Can I use the C++ SDK to determine if this option is checked?  If so, how?
    Does this option add additional data to the document, or does it convert the entire document into polygons?
    If it adds additional data, how do I access it?
    This is what I trying to do:
    I have "Save Polygons for Melange" checked.
    I create a simple cube primitive.
    I then export the scene, however, there is only one object in my scene, a "Ocube" primitive.
    I don't see any polygons.
    I also try calling doc->Polygonize(), but I still don't see any polygons.
    Where exactly are my polygons?

    Or maybe I totally misunderstand the purpose of this option.
    Is this data only accessible through the Melange library?  Can the C++ SDK access it too?



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

    On 03/11/2010 at 00:28, xxxxxxxx wrote:

    Hello, I was asking the same question , did you find anything ?

    Regards ,

    Mohammad



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

    On 03/11/2010 at 10:46, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Hello, I was asking the same question , did you find anything ?

    Regards ,

    Mohammad

    Sorry, I have no answers for this one yet.  If "Save Polygons for Melange" adds extra or hidden data to the C4D file, then I would
    like to know how to access it.  Because it doesn't seem to be doing anything for me.  The C4D scene data remains unchanged.



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

    On 08/11/2010 at 08:16, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    <ADDRESS>
    I have some questions about this option:Edit -> Preferences -> Files -> Save Polygons for Melange
    Does this option perform the same action as doc->Polygonize() ?If it works like Polygonize(), then does that mean I don't have to call Polygonize() if this optionis checked?

    no, this option means that the polygon caches for all objects will be written to the document too.

    Can I use the C++ SDK to determine if this option is checked?  If so, how?

    BaseContainer *bc = GetWorldContainerInstance();
    GeData ddd;
    if (bc->GetParameter(WPREF_SAVE_CACHES, ddd))
    {
                 Bool melangeSaveFlag = ddd.GetLong();
    }

    Does this option add additional data to the document, or does it convert the entire document into polygons?If it adds additional data, how do I access it?

    it's adding already existing polygon data. the scene will remain untouched. accessing it is kind of complex (there's a deform cache and geometry cache).
    i would recommend that you use the import functionality the commandline example shows. you have to overload the Execute() functions at every object, then you will be called for each object and you can translate it into your object data. you can return true, which means you could "understand" the data and the object is done. in case you can't translate a complex object (e.g. symmetrie object) to one of yours, just return FALSE and you will get a other call of the same object but with simpler data.
    e.g. you don't have some kind of primitive (e.g. torus) in your application, return FALSE in AlienPrimitiveObjectData::Execute() and you will get a call in AlienPolygonObjectData::Execute() which represents the same objects only through polygons.

    This is what I trying to do:I have "Save Polygons for Melange" checked.I create a simple cube primitive.I then export the scene, however, there is only one object in my scene, a "Ocube" primitive.I don't see any polygons.
    I also try calling doc->Polygonize(), but I still don't see any polygons.Where exactly are my polygons?

    because it's the cache for each object and this should no be visible.

    Or maybe I totally misunderstand the purpose of this option.Is this data only accessible through the Melange library?  Can the C++ SDK access it too?
    [/QUOTE]
    you can access it with this:
    BaseObject* GetCache(HierarchyHelp* hh = NULL);
    BaseObject* GetDeformCache(void);
    these functions are available in cinema sdk and melange sdk.

    if you want to use these functions or you just want to know more, please compile the cinema sdk example "ActiveObject" and start it. it' like an enhanced object manager and will show you how the objects and caches are stored in cinema.

    jens



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

    On 09/11/2010 at 15:29, xxxxxxxx wrote:

    e.g. you don't have some kind of primitive (e.g. torus) in your application, return FALSE in
    AlienPrimitiveObjectData::Execute() and you will get a call in AlienPolygonObjectData::Execute()
    which represents the same objects only through polygons.

    Thanks, I wasn't aware of that.
    I made this change:

      
    Bool AlienPrimitiveObjectData::Execute() {
     switch(this->type_id) {  
        case Ocube: return FALSE;  
     }
     return TRUE;  
    }  
    

    Now, I see AlienPolygonObjectData::Execute() is being called, it prints out some poly info.
    However, when I traverse the scene afterwards, there is still a "Ocube" primitive, no polygons found.
    Is there something else I have to do to insert this new data into the scene hierarchy?
    Because, my routines don't collect data in Execute().  Instead, after the C4D file is loaded,
    I traverse the scene, starting with c4ddoc.GetFirstObject().



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

    On 15/11/2010 at 08:18, xxxxxxxx wrote:

    as i said it's a bit tricky, therefore we have invented this Execute() functionality.

    but you could check the following:
    at first the document must be saved with the "save polygons for melange" option, you can check this with BaseDocument::HasCaches()

    then at each object call GetDeformCache() to see if a deform cache object exists.
    if not, try to call GetCache() to see if a cache object is available.

    be aware that returned objects from GetDeformCache() and GetCache() can have a deform cache object again...

    cheers
    jens


Log in to reply