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

    Inserting items into dropbox to TreeView

    Cinema 4D SDK
    2
    4
    651
    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.
    • S
      simonator420
      last edited by

      Hi,
      could you please help with adding options to dropbox in column material in treeview?

      Thank you!

      Bez názvu-1.png

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

        Hi @simonator420 for this purpose you have to define GetDropDownMenu and SetDropDownMenu.

        GetDropDownMenu is called by Cinema 4D to retrieve the content of the menu to display from the menuInfo dictionary. For more information about this dictionary please have a look at TreeViewDropDownMenuInfo Dict.
        SetDropDownMenu is called by Cinema 4D when the user select a value from the dropdown.

        Find bellow an implementation example:

            def GetDropDownMenu(self, root, userdata, obj: Entry, lColumn, menuInfo):
                menuInfo["entry"] = 1001 # Select teh second entry
                menuInfo["menu"][1000] = "First Entry"
                menuInfo["menu"][1001] = "Second Entry"
                menuInfo["menu"][1002] = "ThirdEntry"
                menuInfo["state"] = int(menuInfo["state"])  # Workaround to not have warning in Cinema 4D. Will be fixed in the next C4D version.
        
            def SetDropDownMenu(self, root, userdata, obj, lColumn, entry):
                print(f"User selected the entry with the ID: {entry}")
        

        Finally note that due to an issue that will be fixed in the upcoming version of Cinema 4D, even if you do not change the state, you need to override it to an int value otherwise it will print an error in the console (this is not blocking but still).

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        S 1 Reply Last reply Reply Quote 1
        • S
          simonator420
          last edited by

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

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • First post
              Last post