Cloning a document?



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

    On 29/10/2012 at 03:11, xxxxxxxx wrote:

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

    ---------
    Hi,
    Is there a simple way to get a clone of a BaseDocument?

    I'm writing a plugin that the parses the active document and exports it to an external format. In some cases, this requires me to modify the document, and therefore I would like to work with a clone of the active document instead.

    Best regards
    /Filip



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

    On 29/10/2012 at 05:01, xxxxxxxx wrote:

    Since BaseDocument is ultimately derived from C4DAtom you should be able to do:

      
    BaseDocument *cloned_doc = current_doc->GetClone(COPYFLAGS_0, NULL);   
    

    You'd need to try this to see if it works though.



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

    On 29/10/2012 at 06:14, xxxxxxxx wrote:

    Thanks, I'll try that.

    /Filip



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

    On 30/10/2012 at 01:27, xxxxxxxx wrote:

    Tried it and it seems to work fine. Thanks for the help! A follow up question:

    According to the docs, I own the BaseDocument returned by GetClone(). Right now, I'm freeing the document with BaseDocument::Free(cloned_document), is that the right way to do it?

    Best regards
    /Filip



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

    On 30/10/2012 at 02:01, xxxxxxxx wrote:

    That would be how I would do it, yes.



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

    On 30/10/2012 at 08:25, xxxxxxxx wrote:

    OK, thanks!

    /Filip


Log in to reply