On 20/04/2017 at 06:15, xxxxxxxx wrote:
Hi,
C4D doesn't make use of copy constructors, instead you use either CopyTo() or (more suited in your case) GetClone(). I suggest to also peek into the C4DAtom manual.
So basically:
BaseDocument *myDoc = hh->GetDocument().GetClone();
if (myDoc == nullptr) // never forget nullptr checks
// handle error
// have fun with the cloned doc
For the other part of the question, I'd actually suggest to create a new thread, but as we are here, a few notes/ideas on that as well:
In order to identify the object in the new doc, there are several approaches, depending on your needs.
One could be to only clone the needed object into a new scene, instead of cloning the entire scene. In this case IsolateObjects() could help immensely.
Another approach could be the use the GeMarker system, although I have to admit, I never used it, especially not across multiple documents.
There are a few threads on this topic though:
Unique identification of scene elements?
UniqueObjectId,GetMarkerStampEx,GetMarker
Also BaseList2D manual contains a few words on this topic.
Or you could use "custom markers" by for example writing your plugin ID (some value with plugin ID as ID) into the BaseContainer of the object(s) you want to identify. In this case you should remove the entry from the original scene, when you are done (not only, because you will need it, but also for good house keeping).
As I said, just a few ideas, if you have further issues with this, please let us discuss it in a new thread.