How to find an object quickly?
-
Hi,
If there are multiple objects with the same name and the same type in the object manager, what is the unique identification of each object.
Thanks for any help! -
Try
BaseObject.GetGUID()
. -
This post is deleted! -
@Cairyn
Thanks,useful!
Is there a way to directly obtain the object using this uniquely identified ID? -
@chuanzhen Not that I know of, since these are not links from some internal cache. You may need to write your own function to traverse the tree and compare manually.
Unless some Maxon person knows a better way. -
@Cairyn
It seems I should try some other solutions.Thanks for your help. -
Hi @chuanzhen thanks for reaching out us.
With regard to your question, I warmly recommend also thinking of using FindUniqueID and looking at the section BaseList2D Manual::Unique ID or to make good use of BaseLink.
Finally with regard to get the object, either you traverse and compare again the unique ID or, by keeping your BaseLink list updated when add/deletion operations take place, you can look into the list and retrieve desired C4DAtom.
Cheers, R
-
Considering that a UniqueID has to be registered with Maxon, this may not be the way to identify arbitrary objects within the object tree?
Seems to depend on the actual usecase. What is the final purpose here? -
Hi @Cairyn,
@Cairyn said in How to find an object quickly?:
Considering that a UniqueID has to be registered with Maxon, this may not be the way to identify arbitrary objects within the object tree?
Seems to depend on the actual usecase. What is the final purpose here?This only does apply to the case when one wants to add custom markers. Nodes are being automatically marked with
MAXON_CREATOR_ID
upon instantiation by Cinema 4D. The advantage ofFindUniqueID
is that it is a member ofC4DAtom
, i.e., far more versatile thanBaseObject.GetGUID
. I have usedMAXON_CREATOR_ID
in some of my posting here on Plugin Café and there were also a few threads covering it on the old forum; looking at these might clarify the usage.Cheers,
Ferdinand -
@r_gigante Thanks for your help!