Hi, I wrote a menu in pymel, but it does not work in Maya 2024 (no more 
pymel), but in 2023 it works fine.
Hope it helps. Here a short of this whole menu:


import pymel.core as pm

def dags_menu():
# call menu objects
main_window = pm.language.melGlobals['gMainWindow']
menu_obj = 'DagsMenu'
menu_label = 'Dags Tools'

if pm.menu(menu_obj, label=menu_label, parent=main_window, exists=True):
pm.deleteUI(pm.menu(menu_obj, deleteAllItems=True, e=True))

dags_menu = pm.menu(menu_obj, label=menu_label, parent=main_window, 
tearOff=True)


project_menu(dags_menu)
polygon_menu(dags_menu)
object_menu(dags_menu)
script_menu(dags_menu)
material_menu(dags_menu)
rigging_menu(dags_menu)
camera_menu(dags_menu)
light_menu(dags_menu)
render_menu(dags_menu)


def polygon_menu(dags_menu):
    # Main Submenu Polgon
# pm.setParent('..', menu=True)
# dags_menu = pm.menu(menu_obj, label=menu_label, parent=main_window, 
tearOff=True)
pm.menuItem(label='Polygon', subMenu=True, parent=dags_menu, tearOff=True)
    # pm.menuItem(divider=True)
# Quaddraw
pm.menuItem(
label='Quad Draw',
command='QuadDrawTool',
image='quadDraw_NEX32.png',
sourceType='mel',
optionBox=False,
visible=True,
)
# Sphere
pm.menuItem(
label='Sphere',
command='polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -cuv 2 -ch 1; 
objectMoveCommand;',
image='polySphere.png',
sourceType='mel',
optionBox=False,
visible=True,
)
# Cube
pm.menuItem(
label='Cube',
command='polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1; 
objectMoveCommand;',
image='polyCube.png',
sourceType='mel',
optionBox=False,
visible=True,
)

Kat Patterson schrieb am Mittwoch, 21. Dezember 2022 um 01:09:19 UTC+1:

> I am in need of some help, not sure how active this forum is anymore.
>
> I am looking to see if there is any way to make a optionMenu run a command 
> for each option in the drop down menu? I am pretty new to maya python so I 
> do not know very much, but google is less helpful than finding everything 
> out myself.
>
> Here is the code that i currently have, I just am not sure how to connect 
> the commands to the actual window ui;
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/1ef3073a-a987-4e9e-a0f0-4e0933d3fa21n%40googlegroups.com.

Reply via email to