THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/05/2005 at 06:26, xxxxxxxx wrote:
Cinema 4D Version:
Platform: Windows ;
Language(s) : C++ ;
Only one instance of my plug (tagData) is allowed per doc.
Is there a way to find out if there exist more instances of it ?
On 06/05/2005 at 08:28, xxxxxxxx wrote:
you could check each tag on an object, and count them
should work for checking if it's your tag.
On 06/05/2005 at 09:30, xxxxxxxx wrote:
Seems the only way to do this is to get your BaseDocument, go through the object hierarchy, and check each object for the tag (skipping the one that should contain the tag).
BaseDocument* doc = GetActiveDocument();
BaseObject* obj = doc->GetFirstObject();
BaseObject* myObj; // contains valid tag
void CheckFormyTag(obj, myObj);
void CheckFormyTag(BaseObject* obj, BaseObject* myObj)
for (obj; obj; obj = obj->GetNext())
if (!obj->GetTag(ID_MYTAG_PLUGIN)) continue;
if (obj == myObj) continue;
// Otherwise, there is another of your tags on another object
ETA: You could temporarily remove the valid-tag object before doing this check and reinsert afterwards - making certain to retain its parent for proper reinsertion. Then you wouldn't need to send it through the recursive function and check each object against it.
On 06/05/2005 at 14:59, xxxxxxxx wrote:
I will try and let you know.