Creating Pop-up Menus



  • Posted in Cineversity but it turns out it is not possible natively. Just wondering if this is possible in Python

    Hi,

    Is there a way to create pop menus?
    Currently, we have V (for the global pop-up with a radial menu)
    and we have P (for plain pop-up for snapping).

    The Customize Menus option only allows editing and not creating own menus.

    Thank you for looking at my problem.



  • Hi,

    I am not quite sure what you expect from the term "pop-up menu".

    But the answer is yes, you can create pop-menus programmatically in Python. For simple menus you can use c4d.gui.ShowPopupDialog() for more complex stuff you can implement GeDialog and GeUserArea to do anything you want. If you just want a vertical list of text entries ShowPopupDialog() will be enough. If you want anything fancier like radial menus or icons you will have to implement that on your own with classes I did mention.

    Cheers
    zipit



  • @zipit

    Thanks for referring c4d.gui.ShowPopupDialog(). The documentation, in this rare ocassion, presents a code example that I can just copy and paste and it works. (Why can't all code examples work this way?)

    Anyhow

    RE: radial menu
    I search "radial" in the documentation but results are not relevant to radial menu. Maybe it has other name? Just wondering

    RE: Marking Menu like Maya
    Just wondering, is the marking menu like Maya also possible in C4D. See example below:
    https://www.dropbox.com/s/9dnex4moovzu420/c4d138_marking_menu.mp4?dl=0

    A prominent feature is that the main and submenu is spaced out as "radial". The "spaced out" for me is really important since I don't really read the marking menus in Maya when I'm using them. It's just muscle memory.

    The vertical list is just too close that I need to read them otherwise I click the wrong command.



  • Hi @bentraje.

    If you really want to create a Maya like radial menu, the best way is to create a CommandData (this way you can assign a hotkey to this command).
    This CommandData will launch severals Gedialog (one for each main menu), then creates a button that will open a c4d.gui.ShowPopupDialog(), See How to make menus pop up in a certain distance of the mouse.
    On the clicks do the action and close all the GeDialog.

    Just in case I know that c4ds also developed something similar, see https://www.c4dcafe.com/ipb/blogs/entry/510-dials-wheel-of-tools/.

    Finally, regarding code example, it's one of my goals to make them work in any condition, with R21 we reworked our GitHub examples and they are working without any issue.
    I didn't get time to revamp built-in examples from the documentation, it's on my todo list. But however If you have an example that does not work as it is in the documentation or in Github, please let us know.

    Cheers,
    Maxime.



  • @m_adam

    RE: Maya radial
    Yea, it by theory the multiple gedialogs with pop-up from certain distance from the mouse should create a radial. I'll probably have it for another time/thread.

    Thanks for the response. Will consider this thread close

    RE: non working code example.
    Sure sure. Will let you know if anything comes up. The codes I referred above was from awhile ago, so I don't have immediate memory of them.


Log in to reply