Maya 2024 pyMel ;(

623 views
Skip to first unread message

DGFA DAG's GRAPHIC & FOTO ART

unread,
Apr 1, 2023, 6:36:34 PM4/1/23
to Python Programming for Autodesk Maya
Hi,
in Maya 2024 is no more pymel available so I have to switch to what ever...

But I struggle with Maya cmds.
How can I translate this to cmds?

import pymel.core as pm
# import os
# import maya.mel as mel
# main call

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)


# menu Items
def project_menu(dags_menu):
# Main Submenu Project
# pm.setParent('..', menu=True)
# dags_menu = pm.menu(menu_obj, label=menu_label, parent=main_window, tearOff=True)
pm.menuItem(label='Project', subMenu=True, parent=dags_menu, tearOff=True)
# set project
pm.menuItem(
label='Set Project',
command='SetProject',
image='fileOpen.png',
sourceType='mel',
optionBox=False,
visible=True,
)

pm.menuItem(divider=True)
# save
pm.menuItem(
label='Save',
command='SaveScene',
image='save.png',
sourceType='mel',
optionBox=False,
visible=True,
)
# save as
pm.menuItem(
label='Save Scene As...',
command='SaveSceneAs',
image='save.png',
sourceType='mel',
optionBox=False,
visible=True,
)
# save incremental
pm.menuItem(
label='Increment Save',
command='IncrementAndSave',
image='saveToShelf.png',
sourceType='mel',
optionBox=False,
visible=True,
)

Thanks!
D.

Justin Israel

unread,
Apr 1, 2023, 7:23:08 PM4/1/23
to python_in...@googlegroups.com
Almost all of those calls have an equivalent maya cmds function, with the difference that you pass the string name of the ui object returned from previous ui calls. So just look at the Maya cmds python api.

Getting the main window name can be done with a call into mel: 
gMainWindow = maya.mel.eval('$temp1=$gMainWindow')

--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1b086fbd-ac54-435e-b4e7-7d90d1943eb3n%40googlegroups.com.

Abdelhalim abulmagd

unread,
Apr 1, 2023, 7:23:33 PM4/1/23
to python_in...@googlegroups.com
Why pymel not available?

--

Justin Israel

unread,
Apr 1, 2023, 7:28:06 PM4/1/23
to python_in...@googlegroups.com


On Sun, 2 Apr 2023, 11:23 am Abdelhalim abulmagd, <abdelhali...@gmail.com> wrote:
Why pymel not available?

Seems like they might have stopped shipping with PyMel as of 2023 and you need to manually install it? 



Marcus Ottosson

unread,
Apr 2, 2023, 5:38:40 AM4/2/23
to python_in...@googlegroups.com, Chad Dombrova
I've also tried getting to the bottom of why PyMEL stopped being included to begin with in 2023, assuming I missed a conversation somewhere. But it appears to have happened out of the blue over at Autodesk headquarters? :O Maybe @Chad Dombrova knows more?

Justin Israel

unread,
Apr 2, 2023, 6:59:06 AM4/2/23
to python_in...@googlegroups.com, Chad Dombrova
The last tag was in Nov 2021 
Could it be that it's not actively maintained anymore so Autodesk stopped bundling it? 

Marcus Ottosson

unread,
Apr 2, 2023, 8:12:42 AM4/2/23
to python_in...@googlegroups.com, Chad Dombrova
Hm, true. Could be as simple as that.


image.png

Still, surprised there was no conversation; I'd imagine someone may want to take over, especially since a lot of pipeline out there depend on it.

Chad Dombrova

unread,
Apr 12, 2023, 12:21:30 PM4/12/23
to Marcus Ottosson, python_in...@googlegroups.com
Hi all,
PyMEL 1.3.0 has been released with support for 2023, and 1.4.0b1 has been released with support for 2024.  To install the beta for 2024 pip install with --pre flag. 

PyMEL is definitely still actively developed, as you can see from the features discussed in this blog post:  https://dev.to/chadrik/pymels-new-type-stubs-2die

As for why PyMEL is no longer bundled with Maya, I'll do my best to summarize the discussions with Autodesk on this topic.  Firstly, there seemed to be the impression that the new python API 2.0 solved the problems with python scripting in Maya, which is an assessment that I don't agree with.  Nothing has appreciably changed with the ability to use maya.cmds with the C++ API wrapper(s) in the 15 years since python was first added to Maya.  One pain point from Autodesk's perspective was that releasing Maya required a certain amount of cooperation between Autodesk and the PyMEL developers, which added extra steps for them and slowed them down, which is a point I totally understand.  Their assessment was that the pros of installing via PyPI -- decoupled release schedules, esp the ability to release patch fixes to PyMEL -- outweighed the cons -- extra steps for users and headaches with installing behind a firewall.  And lastly, I think there was the feeling that there's a world of open source projects out there for Maya, so "why should PyMEL get special status?"

What we're seeing with the delayed release of pymel for 2023 is one of the downsides of the new arrangement:  the lack of a hard deadline to get PyMEL released in time to be bundled with Maya means it doesn't always make it to the top of the issue stack at Luma (I managed to get all of the release work done for 2023 and 2024 on my vacation and while sick).   

If there are others out there who would like to cooperate on PyMEL, we're happy to do so.  The release process is very well documented, and I make an effort to improve it every time I do the process.

I hope that clears things up.  Let me know if you folks have any questions and I'll do my best to answer them. 

-chad

Yury Nedelin

unread,
Apr 12, 2023, 12:36:56 PM4/12/23
to python_in...@googlegroups.com, Marcus Ottosson
Thanks for the update Chad.
Yury


Reply all
Reply to author
Forward
0 new messages