Skip to content

Maya runTimeCommand from menu

new in 2022
shows up in Maya search

Maya runTimeCommand

For example, if you had a script userSetup.py that creates a menu containing special Foo rendering scripts, you would need to convert this:

cmds.menuItem(
    p = renderingMenu, 
    l = 'Submit to Foo', 
    c = 'import foo_maya;foo_maya.submit_dialog()')

to this:

# Create runTimeCommand
cmds.runTimeCommand('SubmitToFoo', 
    default = True, 
    label = 'Send to Foo', 
    annotation = 'Send your scene to Foo for cloud rendering.', 
    category = 'Menu items.Cloud.Render', 
    command = 'import foo_maya;foo_maya.submit_dialog()', 
    keywords = 'render', 
    tags = 'Render' )

# Create menu
cmds.menuItem(
    p = renderingMenu, 
    rtc = 'SubmitToFoo')

  • command reference docs
  • supports tags & categories
  • can enable a plugin it relies on
  • can have an image (icon)
    • todo example

Maya Python
Maya menu