ShowPopupDialog

On 28/11/2013 at 11:01, xxxxxxxx wrote:

Hey,

I try to create a PopUp Menu like the default from cinema - with more menus around the mouse position

i get a single menu item but can`t get a second menu item. has one a short example ?

Thanks

On 28/11/2013 at 13:42, xxxxxxxx wrote:

post your code, there is an extensive example in the sdk under gui.ShowPopUpDialog()

On 28/11/2013 at 13:53, xxxxxxxx wrote:

i get a popup with one menu

menu = c4d.BaseContainer()
  
functionsmenu = c4d.BaseContainer()
functionsmenu.SetString(1, 'men');
functionsmenu2 = c4d.BaseContainer()
functionsmenu2.SetString(1, 'men 2');
  
  
menu.SetContainer(IDM_FUNCTIONSMENU, functionsmenu) 
menu.SetContainer(IDM_GROUPMENU, functionsmenu2)      
  
result = gui.ShowPopupDialog(cd=None, bc=menu, x=c4d.MOUSEPOS, y=c4d.MOUSEPOS, flags=c4d.POPUP_CENTERVERT|c4d.POPUP_EXECUTECOMMANDS)
  

On 28/11/2013 at 15:01, xxxxxxxx wrote:

The documentation shows to use BaseContainer.InsData(), not any of the setter methods.

Best,
-Niklas

On 28/11/2013 at 15:55, xxxxxxxx wrote:

the example show it with SetStrings 
http://www.maxonexchange.de/sdk/CINEMA4DPYTHONSDK/help/modules/c4d.gui/index.html?highlight=popup#c4d.gui.ShowPopupDialog

my problem is not to add a submenu - my problem is i like to add more than the one menu at the time - like the cinema default popup menu

On 29/11/2013 at 04:10, xxxxxxxx wrote:

your code is technically correct, on which c4d version are you ? for me the code does run just fine 
in r14/15 . are you sure that your container ids are properly set / unique ?

On 29/11/2013 at 04:25, xxxxxxxx wrote:

i use R15 -

right is the menu i get - it work - but is not what i want 🙂

_<_img src="http://hantmade.com/wp-content/uploads/c4d_plugincafe.png" height="443" width="453" border="0" /_>_

On 29/11/2013 at 05:35, xxxxxxxx wrote:

hm,

I am not quite sure what you mean with 'what I want'. here is a small and recursive example 
building a menu tree.

import c4d
import random
from c4d import gui
#Welcome to the world of Python
  
  
def main() :
    cid, menu =  getMenueContainer(c4d.FIRST_POPUP_ID, 0, 3, 8) 
    result = gui.ShowPopupDialog(None, menu, c4d.MOUSEPOS, c4d.MOUSEPOS, 
                                 c4d.POPUP_CENTERVERT|c4d.POPUP_EXECUTECOMMANDS)
  
def getMenueContainer(cid, curdepth, maxdepth, maxitems, root = c4d.BaseContainer()) :
    """
    """
    if curdepth <= maxdepth:
        children = []
        for i in xrange(random.randint(1, maxitems)) :
            item = c4d.BaseContainer()
            item.SetString(1, 'Item_{0}'.format(i))
            cid, item = getMenueContainer(cid, curdepth + 1, maxdepth, maxitems, item)
            cid += 1
            root.SetContainer(cid, item)
    return cid, root
    
  
if __name__=='__main__':
    main()

On 29/11/2013 at 05:38, xxxxxxxx wrote:

Hey Littledevil,

thanks for that code - sorry for my bad description

I don`t mean to get a tree menu i like to get a menu with more than one menus - a round that mouse position - like the default popup menu in cinema (get it with "v")

On 29/11/2013 at 05:52, xxxxxxxx wrote:

Ah ok. You are talking about the pie menus. Unfortunately they are not exposed in python 
(and I think they aren't in cpp too). You would have to write your own system and open 
several borderless GeDialogs simultaneously and then render the 'button content' into these
dialogs with a GeUserArea (for example nikklas button thingy class). Has always been on my
'would be fun to do' list, but i never managed to get to it, so I am not sure if it is possible.