Get type name by Id
-
This sounds like a very basic question, I'm probably skipping a very clear concept, but I can't find the answer anywhere...
How Can I get the type name of a custom object from the type id only?
This is what I'm doing but I'm sure there should be some API call that does the same:
auto baseObject = BaseObject::Alloc( operatorTypeId ); auto name = baseObject->GetTypeName(); BaseObject::Free( baseObject );
-
This post is deleted! -
Hello,
You can access the BasePlugin object that represents a registered plugin type with FindPlugin(). From that object you can access the name:
// find plugin const BasePlugin* const plugin = FindPlugin(pluginId, PLUGINTYPE::ANY); if (plugin == nullptr) return maxon::UnexpectedError(MAXON_SOURCE_LOCATION); // print plugin name const maxon::String name = plugin->GetName(); ApplicationOutput("Plugin Name: @", name);
best wishes,
Sebastian -
And if you are only interested in BaseObjects, there is also GetObjectName().
See BaseObject Manual.
-
@s_bach I've tried GetPlugin but even returning the BasePlugin pointer, GetName() was always empty for my custom baseObjects. Edit: GetName() works, GetTypeName() don't.
But GetObjectName() is perfect for me, thanks!