Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Get type name by Id

    Cinema 4D SDK
    c++
    3
    5
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • rsodreR
      rsodre
      last edited by

      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 );
      
      I 1 Reply Last reply Reply Quote 0
      • I
        iluxa7k @rsodre
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • S
          s_bach
          last edited by

          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

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 2
          • S
            s_bach
            last edited by

            And if you are only interested in BaseObjects, there is also GetObjectName().

            See BaseObject Manual.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            rsodreR 1 Reply Last reply Reply Quote 3
            • rsodreR
              rsodre @s_bach
              last edited by rsodre

              @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!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post