Object CopyTo()



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

    On 23/06/2004 at 02:47, xxxxxxxx wrote:

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

    ---------
    Two questions about how to copy an object:
    My objects all have an unique identifier they get from an id generator. When I make a copy from my object with ctrl+c/ctrl+v I have to obtain a new id for the generated object. But the CopyTo function is not only called in this case, but also when I change the objects position in the tree, change an attribute, click in the editor, etc. So I took a closer look at the flags of copyto. I only found these flags documented:
    #define COPY_NO_HIERARCHY     (1<<2)
    #define COPY_NO_ANIMATION     (1<<3)
    #define COPY_NO_BITS       (1<<4)
    #define COPY_NO_BRANCHES     (1<<7)
    #define COPY_NO_INTERNALS     (1<<8)
    #define COPY_DOCUMENT       (1<<10)
    Are there others which are not documented? For example if I change the objects position in the tree, the bits 1, 3, 8 and 9 are set, no idea what bit 1 and 9 indicate...
    So back to my problem, when I make a copy of the object, then I see that no bit is set in flags, flags = 0. Is that a reliable method to detect that a copy of the object have been generated? I tried to compare the names of source and destination, but unfortunally the name of the copy is set after copyto, so I cannot use it.
    And the second thing, if I copy my object with ctrlC/V and have a texture tag on them with a material, then also a copy of the material is created! But this only happends with my own materials ( MaterialData ), but not with the cinema material.



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

    On 23/06/2004 at 03:51, xxxxxxxx wrote:

    Some of those extra copies might be for the undo buffer. As far as I know there's no way to detect that directly. The recommended way to keep track of objects is through BaseLinks. So you should keep a map from BaseLinks to IDs, instead of storing the ID in the object. When an object gets copied, the BaseLinks will only point to one of the copies, so then you can insert new IDs as needed.



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

    On 23/06/2004 at 04:08, xxxxxxxx wrote:

    Hm, I'll think about it, it would be a bigger change in our project. What about that also the attached materials are copied? Any idea why this happens?


Log in to reply