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

    New Condition Naming in Attribute Manager

    Cinema 4D SDK
    c++ r25
    2
    3
    313
    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.
    • D
      d_schmidt
      last edited by

      Hello, I noticed there seemed to be a new 'name' feature with the Condition object.
      Screenshot 2025-01-14 at 4.23.52 PM.png
      Is it possible to make use of it in a plugin?

      'Condition' is just the object's Name, but I can't figure out how 'distance' is set.

      Dan

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @d_schmidt
        last edited by ferdinand

        Hey @d_schmidt,

        Thank you for reaching out to us. That feature has existed since Pyro was introduced but at the same time it is also an internal feature, i.e., a feature of which we publish the components, but which we do not support in public usage. To realize a node which supports name additions, you must register it with the flag OBJECT_CUSTOM_NAME_ADDITION:

        RegisterObjectPlugin(ID_MY_PLUGIN, GeLoadString(IDS_MY_PLUGIN), otherFlags | OBJECT_CUSTOM_NAME_ADDITION, MyPlugin::Alloc, "omyplugin"_s, nullptr, 0);
        

        Reading or writing to the custom name is then realised via the node message MSG_GETCUSTOM_NAME_ADDITION. I am showing the write access in C++:

        Bool MyPlugin::Message(GeListNode* node, Int32 type, void* data)
        {
          ...
          switch (type)
          {
            // Something, for example the Object Manager, wants to know the addition to the name. The 
            // message data is just an empty string. The plugin should return the addition to the name.
            case MSG_GETCUSTOM_NAME_ADDITION:
            {
              *reinterpret_cast<String*>(data) = "Hello World"_s;
              break;
            }
            default:
              break;
          }
          ...
        }
        

        And since nothing is safe from @m_adam 😄 , I just found out that he wrapped the reading part for Python (cannot see the writing part handled in Python). Since you cannot cast arbitrary data in Python, we must use a dictionary as the data container.

        13edcda9-b011-4ceb-9dd5-01cb8f93b781-image.png

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 1
        • D
          d_schmidt
          last edited by

          Thank you so much! I couldn't ask for a more thorough response.

          Dan

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