On 12/10/2014 at 01:17, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 15
Platform: Windows ;
Language(s) : C++ ;
---------
Hi PluginCafe,
I've read a lot about uniquely identifying objects in C4D and came up with this one:
std::string createUniqueObjectId(GeListNode* pObject)
{
if (pObject == nullptr)
return "";
BaseList2D* pBaseList = static_cast<BaseList2D*>(pObject);
UInt32 id1;
UInt32 id2;
pBaseList->GetMarkerStampEx(&id1, &id2);
return std::to_string(id1) + std::to_string(id2);
}
The advantages of a simple string are:
* I can add a human readable postfix to it, e.g. "_" + pObject->Name() or something like that
* I can export this id to any textfile, send it via network and therefore use it in another application as well
The problem is, that the docu says that GetMarkerStampEx is deprecated and GetMarker should be used instead. But I want an id-system that has the same advantages listed above. I'm not interested in an object-oriented marker, that can be compared, because I cannot do this in a text-file or an external application.
Should I ignore the "deprecated" note and go with my code? Do you know a better way of retrieving a simply string that identifies an object uniquely in C4D?
Thanks!
[EDIT]: I want to add that I also search for a way to identify a RayObject uniquely. Right now I'm just using the "link" member of a RayObject to get the original BaseObject. I'm doing this in VIDEOPOST_INNER in a VideoPostData plugin. C4D seems to copy all BaseObject first, so I actually can get my unique ids for them, which is great. But there is a problem with "Instances" because they get a new id every time I render an image. "Arrays" on the other hand work great. That's a bit strange because it seems to me that an Array does exactly the same as an "Instance", it simply duplicates an object and just uses different matrices etc.
So how could I identify a RayObject uniquely? Is it even possible or is this a problem, because they only live for the short time of rendering? But why do most of the objects in the scene keep their id? Is it because C4D has its own dirty/cache-system for the VolumeData-structre and RayObjects in the background?
[EDIT 2]: GetUniqueIP and GetGUID do not fulfill my requirements since they change when rendering to Picture viewer and afterwards to editor view. I have not experimented with them. I take this information from this thread:
https://plugincafe.maxon.net/topic/7582/9505_getguid-fails-when-rendering&KW=GetUniqueIP&PID=37514#37514