Finding cloned objects in cloned document



  • On 21/04/2017 at 06:19, xxxxxxxx wrote:

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

    ---------
    Hello. In order to use ExecutePasses() i am creating a dummy document and cloning the objects I'm interested in.
    Here's the code for that:

    //BaseDocument * bd, and BaseObject * op are passed from GetVirtualObjects()
      
    //isolate objects and move to new document
    AtomArray * aa = AtomArray::Alloc();
    aa->Append(op);
    BaseDocument * doc = IsolateObjects(bd, *aa);
    

    Now, I'm interested in finding the clone of op in doc. In a related thread Andreas suggested using the unique ids of c4d. But how exactly do I know what is the unique id of the clone?

    Perhaps there is a better, easier way?

    Many thanks!



  • On 24/04/2017 at 02:48, xxxxxxxx wrote:

    Hi,

    not sure you need to think so complex in this case. If it's always as simple as in your above example and there's only one object (and its children) isolated into the new document, it's as simple as calling GetFirstObject() on the new document. But most likely the scenario is a bit more complicated. Then, why not give my suggestion from the other thread a try? Before isolating the object, you write your plugin ID into the object(s) BaseContainer (basically: bc->SetInt32(YOUR_PLUGIN_ID, "whatever, maybe a object index")) and afterwards you remove it again from the original object. That's probably way easier than any marker, unique ID stuff.


Log in to reply