Method to get SUEntityRef from PersistentID

Hello :slight_smile:

I am using SUEntityGetPersistentID to store some entity_pid's in a std::map as values…

Whenever I do a search and find keys that fit my criteria, I would like to get the IDs and retrieve the SUEntityRef using the persistent IDs. (then I can use SUEntityRef in a meaningful way)

Is there currently a method to look up SUEntityRef using the pid? (I looked at entity.h for methods and some other derived classes of SUEntityRef but didn’t see one)

I would like to use the pid’s as I want this to be applicable in different sessions. In case there could be a different approach, I am open to any other suggestions…

Thanks in advance for the help.

These search methods in the Ruby API are attached to the Model object.
Generally the API authors try for parity between the two APIs.

So, in the C API we look at the SUModelRef interface …

SUModelGetInstancePathByPid

SUModelGetEntitiesByPersistentIDs ← deprecated in favor of the following function:

SUModelGetEntitiesOfTypeByPersistentIDs

@esekkin Also please post C API questions in the C SDK subcategory.

EDIT: Thank you for reassigning topic @dezmo !

1 Like

will do! thanks for the pointers :slight_smile: