Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Finding cloned objects in cloned document

    SDK Help
    0
    2
    253
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post