Re: [Maya-Python] Maya 2024 pyMel ;(

2023-04-01 Thread Justin Israel
On Sun, 2 Apr 2023, 11:23 am Abdelhalim abulmagd, <
abdelhalim.abulm...@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?

https://help.autodesk.com/view/MAYAUL/2022/ENU/?guid=GUID-2AA5EFCE-53B1-46A0-8E43-4CD0B2C72FB4

https://help.autodesk.com/view/MAYAUL/2023/ENU/?guid=GUID-2AA5EFCE-53B1-46A0-8E43-4CD0B2C72FB4


> On Sun, Apr 2, 2023, 12:36 AM DGFA DAG's GRAPHIC & FOTO ART <
> gerome@gmail.com> wrote:
>
>> 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.
>>
>> --
>> 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/1b086fbd-ac54-435e-b4e7-7d90d1943eb3n%40googlegroups.com
>> 
>> .
>>
> --
> 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/CAJLC81Omy4V1XC6-7C-xb58C8qAspHhm1wZEav_7GEwYCxwu8A%40mail.gmail.com
> 
> .
>

-- 
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/CAPGFgA3DK3Sd2m1mEnx%2BTRTrrzkKB52pm6dNtzkwtfg2%3DmOqwA%40mail.gmail.com.


Re: [Maya-Python] Maya 2024 pyMel ;(

2023-04-01 Thread Abdelhalim abulmagd
Why pymel not available?

On Sun, Apr 2, 2023, 12:36 AM DGFA DAG's GRAPHIC & FOTO ART <
gerome@gmail.com> wrote:

> 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.
>
> --
> 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/1b086fbd-ac54-435e-b4e7-7d90d1943eb3n%40googlegroups.com
> 
> .
>

-- 
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/CAJLC81Omy4V1XC6-7C-xb58C8qAspHhm1wZEav_7GEwYCxwu8A%40mail.gmail.com.


Re: [Maya-Python] Maya 2024 pyMel ;(

2023-04-01 Thread Justin Israel
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')


On Sun, 2 Apr 2023, 10:36 am DGFA DAG's GRAPHIC & FOTO ART, <
gerome@gmail.com> wrote:

> 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.
>
> --
> 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/1b086fbd-ac54-435e-b4e7-7d90d1943eb3n%40googlegroups.com
> 
> .
>

-- 
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/CAPGFgA1iznu-EF3b7EwonVbutKnOoO1MTmpPRxkgNmYHggfMHw%40mail.gmail.com.


[Maya-Python] Re: (Maya Python) Is there a way to run a command from a menuItem inside a objectMenu

2023-04-01 Thread DGFA DAG's GRAPHIC & FOTO ART
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.


[Maya-Python] Maya 2024 pyMel ;(

2023-04-01 Thread DGFA DAG's GRAPHIC & FOTO ART
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.

-- 
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/1b086fbd-ac54-435e-b4e7-7d90d1943eb3n%40googlegroups.com.