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

    GetDefaultValue Not Working in C4D 2024

    Cinema 4D SDK
    python
    2
    3
    504
    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

      The GetDefaultValue of GraphNode doesn't seem to retrieve values from the node in 2024 the same way it did in 2023.
      How can I correctly obtain these values in the 2024 version?

      Thanks in advance!

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

        Hi @Easan this function have been modified in C++ and we did not had the time to adapt it in Python. However rest assured this is in our top priority for the next release.

        With that said you can still retrieve the value using GetValue("value"). Find bellow and example, but first create a node material and select a port and run the example.

        import c4d
        import maxon
        
        
        def main():
            mat = doc.GetActiveMaterial()
            nodeMaterial = mat.GetNodeMaterialReference()
            nodespaceId = c4d.GetActiveNodeSpaceId()
            nimbusRef = mat.GetNimbusRef(nodespaceId)
            graph = nimbusRef.GetGraph()
           
            for port in maxon.GraphModelHelper.GetSelectedNodes(graph, maxon.NODE_KIND.PORT_MASK):
                print(port.GetValue("value"))
        
        
        if __name__ == "__main__":
            main()
        

        However this have some limitation since in some case when no value is available None will be returned. This is going to be fixed in the next version.
        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

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

          @m_adam
          I'm looking forward to the next version update.
          Thank you for your response.

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