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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to Set Void Type Attributes in GraphNode?

    Cinema 4D SDK
    python 2023 2024
    3
    6
    796
    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.
    • E
      Easan
      last edited by

      Hi,
      I'm currently working with GraphNode in my project and have successfully used methods like

      node.SetValue(maxon.NODE.BASE.NAME, maxon.String("some name"))
      

      to set parameters.

      However, I'm struggling with attributes that are of void type. Specifically, I need to set maxon.NODE.BASE.SOLOPORT. Could someone please guide me on how to properly set void type attributes like this?

      Any help or examples would be greatly appreciated!

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

        Hello @Easan,

        Thank you for reaching out to us. The TLDR is, you cannot do that.

        What is void?

        In C++, void is a special type that represents the absence of a type. It is commonly used in two scenarios:

        • Function Return Type: If a function is not returning any value, you can use void as its return type.
        • Pointer Type: void can also be used to create a void pointer, which can point to a variable of any type.

        The first case will just translate into a function which returns None in Python, i.e., Python's way of saying that function has no return type. The second case is not translatable to Python. The idea of void pointers is to transport arbitrary data, something that does not come easily in C++ as it is statically typed opposed to Python.

        And void pointers is not translatable to Python, as Python does not (really) have the concept of casting. Methods which take or return a void pointer are usually not ported to Python or are at least heavily modified in their functionality. In the context of messages (which heavily make use of void pointers) you will run into messages which have been ported to Python which make use of void pointers. But that void pointer part is then simply not being used/ported.

        What means void in the context of attributes?

        A somewhat special case are maxon attributes which are void, such as SOLOPORT as shown here in the C++ docs:
        45110f2c-f9f1-445e-bc69-5d1af3c461f4-image.png

        I cannot unpack in all detail what maxon attributes are, but briefly speaking, they are global identifiers which play a huge role in DataDescription's and are with that somewhat the maxon API counterpart to DescID in the classic API DescID & Description pair.

        Attributes which are of type void and used in data descriptions are primarily used for two things:

        1. The values of an enum are expressed as attributes of type void. See NODE::BASE::CATEGORY for an example.
        2. Node commands are expressed as void attributes, SOLOPORT is an example for that.

        So, any attribute of type void ist not meant to write a value but merely exists for its identifiers. Node commands currently cannot be executed from Python. You have to find the command with DataDescriptionDefinitionDatabaseInterface::FindNodeMessage and then have to deal with the abstract delegate for the node command via DescriptionMessageFunction.

        Python is currently missing several layers of implementation to do that. So, very long story short: You cannot solo nodes in Python (which I assume was what you were trying to do).

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        E 1 Reply Last reply Reply Quote 0
        • E
          Easan
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • E
            Easan @ferdinand
            last edited by

            @ferdinand OK, I understand what you mean. Thanks for your response.

            1 Reply Last reply Reply Quote 0
            • M
              m_adam
              last edited by m_adam

              Hi if you want to define which node is soled you can use the method NimbusInterface.SetPath.
              The nimbus ref can be retrieved by calling BaseList2D.GetNimbusRef on the owner of the graph (most likely the material or the scene node capsule).
              Then the Path Node can be retrieved from any GraphNode with the method GraphNode.GetPath.

              You may find this topic interesting Unsolo a Node?

              Cheers,
              Maxime.

              MAXON SDK Specialist

              Development Blog, MAXON Registered Developer

              E 1 Reply Last reply Reply Quote 0
              • E
                Easan @m_adam
                last edited by

                @m_adam Thank you for providing an alternative method to set parameters.❤

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