Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

Finding cloned objects in cloned document

 Post Reply Post Reply
Author
Message
adl architetto View Drop Down
Member
Member


Joined: 2016 May 01
Online Status: Offline
Posts: 24
Post Options Post Options   Quote adl architetto Quote  Post ReplyReply Direct Link To This Post Topic: Finding cloned objects in cloned document
    Posted: 2017 Apr 21 at 6:19am

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! 



Edited by adl architetto - 2017 Apr 21 at 6:31am
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Online
Posts: 1268
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Apr 24 at 2:48am
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.

Cheers,
Andreas
SDK Support Engineer
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.094 seconds.