Seperators in GetSubContainer



  • Hi again!

    I am still messing around with custom menus. Is it possible to add any kind of seperator inside a submenu?
    Trying to insert a seperator inside GetSubContainer doesn't do anything.

    I am trying to do something like the redshift menu has.
    0_1548258425232_redshift_menu.png

    Or do the seperators here mean that the grouped entries are seperate commandData Plugins?

    A workaround might be to add disabled entries that display a line by naming them "----------&d&"
    Is there documentation on stuff like &d& or [name]&i[iconID]&? Finding these nuggets of wisdom by chance in random forums is not a very efficient way to figure out stuff.


  • Global Moderator

    Hi @Boony2000

    In a GetSubContainer, to insert a separator use InsData(0, "") The ID used should always be 0. As described in ShowPopupDialog Example.

    Which give us

        def GetSubContainer(self, doc, submenu) :
            menuItems = [["name1"], ["name2", "hasIcon"], ["name3"]]
    
            for i, data in enumerate(menuItems) :
                if len(data) > 1:
                    submenu.SetString(i+1000, data[0] + "&i" + str(c4d.IDM_KEY_NEXT) + "&")
                    submenu.InsData(0, "")
                else:
                    submenu.SetString(i+1000, data[0])
    
            return True
    

    Cheers,
    Maxime.