[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.


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

2022-12-20 Thread Justin Israel
On Wed, 21 Dec 2022, 2:24 pm Kat Patterson,  wrote:

> This helped greatly! Thank you so very much!!
>
> I do have one last question, do you know of a way to make the the changes
> of the dropdown menus only run off of a press of a button? (as in i have a
> 'create' button next to each dropdown menu). As in if i change the option
> to 'sphere' it doesnt change it when i press the option, it changes if i
> press the create button?
>
> It is alright if there is not an option like this, I am very greatful for
> you helping me ♥
>

Yes just don't set the callback on the optionMenu. Instead you can set a
callback on your button that will query the current value from the
optionMenu.

https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/button.html#flagcommand

You will need to save the name of the optionMenu that is returned when you
created it. Then you can query the value of it:
https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagvalue

Note that the value supports the query mode, so you can do:

opt = cmds.optionMenu(savedOptionsName, q=True, value=True)


> On Tuesday, December 20, 2022 at 5:51:01 PM UTC-7 justin...@gmail.com
> wrote:
>
>> On Wed, Dec 21, 2022 at 1:42 PM Kat Patterson 
>> wrote:
>>
>>> Okay so that did help, but now I am back to how do I add it to each
>>> individual command (i posted my code, it is a menu that creates an object,
>>> and another option to duplicate that object said amount of times) and how
>>> do I add the button into the mix to make said dropdown options run
>>>
>>
>> Well like the document that I had included says, when you use optionMenu,
>> it no longer respects the command attached to each menuItem. You would
>> control it all through the single callback that fires when the option
>> changes. You can either use an if/else like this:
>>
>> def printNewMenuItem(item):
>> if item == "Sphere":
>> printSphere()
>> elif item == "Cube":
>> printCube()
>> def printSphere():
>> print("It's a sphere!")
>> def printCube():
>> print("It's a cube!")
>>
>> Or you can define it in a map to make it easier:
>>
>> menuCallbacks = {
>> "Sphere": printSphere,
>> "Cube": printCube,
>> }
>> def printNewMenuItem(item):
>> cbk = menuCallbacks.get(item)
>> if cbk:
>> cbk()
>> else:
>> print("Oops. I didnt define a callback for {}".format(item))
>>
>>
>>
>>>
>>> On Tuesday, December 20, 2022 at 5:25:09 PM UTC-7 justin...@gmail.com
>>> wrote:
>>>
 On Wed, Dec 21, 2022 at 1:19 PM Kat Patterson 
 wrote:

> def printNewMenuItem( item ):
> print item
>
> This code alone ALWAYS produces a invalid syntax on my end, so I am
> unable to check if that even works, or how it even works. I have looked at
> the documentation and am unable to find a workaround while looking at
> either of those documentation sites.
>

 Are you running a version of Maya using python3? If so,

 def printNewMenuItem( item ):
 print(item)


>
> Any ideas?
>
> On Tuesday, December 20, 2022 at 5:14:28 PM UTC-7 justin...@gmail.com
> wrote:
>
>> Hi Kat,
>>
>> Have a look here:
>>
>> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html
>>
>> "Note that commands attached to menu items will not get called.
>> Attach any commands via the -cc/changedCommand flag."
>>
>> And specifically the changeCommand:
>>
>> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagchangeCommand
>>
>> The example at the bottom of the page actually shows you how to use
>> the callback, which will receive the value of the menuItem when it is
>> changed in the optionMenu.
>>
>> Justin
>>
>>
>> On Wed, Dec 21, 2022 at 1:11 PM Kat Patterson 
>> wrote:
>>
>>> https://pastebin.com/SfLxjFmG
>>>
>>> On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson
>>> wrote:
>>>
 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_m...@googlegroups.com.
>>> To view this discussion on the web visit
>>> 

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

2022-12-20 Thread Kat Patterson
This helped greatly! Thank you so very much!!

I do have one last question, do you know of a way to make the the changes 
of the dropdown menus only run off of a press of a button? (as in i have a 
'create' button next to each dropdown menu). As in if i change the option 
to 'sphere' it doesnt change it when i press the option, it changes if i 
press the create button? 

It is alright if there is not an option like this, I am very greatful for 
you helping me ♥

On Tuesday, December 20, 2022 at 5:51:01 PM UTC-7 justin...@gmail.com wrote:

> On Wed, Dec 21, 2022 at 1:42 PM Kat Patterson  wrote:
>
>> Okay so that did help, but now I am back to how do I add it to each 
>> individual command (i posted my code, it is a menu that creates an object, 
>> and another option to duplicate that object said amount of times) and how 
>> do I add the button into the mix to make said dropdown options run
>>
>
> Well like the document that I had included says, when you use optionMenu, 
> it no longer respects the command attached to each menuItem. You would 
> control it all through the single callback that fires when the option 
> changes. You can either use an if/else like this:
>
> def printNewMenuItem(item):
> if item == "Sphere":
> printSphere()
> elif item == "Cube":
> printCube()
> def printSphere():
> print("It's a sphere!")
> def printCube():
> print("It's a cube!")
>
> Or you can define it in a map to make it easier:
>
> menuCallbacks = {
> "Sphere": printSphere,
> "Cube": printCube,
> }
> def printNewMenuItem(item):
> cbk = menuCallbacks.get(item)
> if cbk:
> cbk()
> else:
> print("Oops. I didnt define a callback for {}".format(item))
>
>  
>
>>
>> On Tuesday, December 20, 2022 at 5:25:09 PM UTC-7 justin...@gmail.com 
>> wrote:
>>
>>> On Wed, Dec 21, 2022 at 1:19 PM Kat Patterson  
>>> wrote:
>>>
 def printNewMenuItem( item ):
 print item

 This code alone ALWAYS produces a invalid syntax on my end, so I am 
 unable to check if that even works, or how it even works. I have looked at 
 the documentation and am unable to find a workaround while looking at 
 either of those documentation sites.

>>>
>>> Are you running a version of Maya using python3? If so, 
>>>
>>> def printNewMenuItem( item ):
>>> print(item)
>>>  
>>>

 Any ideas?

 On Tuesday, December 20, 2022 at 5:14:28 PM UTC-7 justin...@gmail.com 
 wrote:

> Hi Kat,
>
> Have a look here:
>
> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html
>
> "Note that commands attached to menu items will not get called. Attach 
> any commands via the -cc/changedCommand flag."
>
> And specifically the changeCommand:
>
> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagchangeCommand
>
> The example at the bottom of the page actually shows you how to use 
> the callback, which will receive the value of the menuItem when it is 
> changed in the optionMenu.
>
> Justin
>
>
> On Wed, Dec 21, 2022 at 1:11 PM Kat Patterson  
> wrote:
>
>> https://pastebin.com/SfLxjFmG
>>
>> On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson wrote:
>>
>>> 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_m...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/16e3c45b-8fba-4542-83a9-750fbc0e1ce4n%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_m...@googlegroups.com.

>>> To view this discussion on the web visit 
 https://groups.google.com/d/msgid/python_inside_maya/e49e0fb6-aceb-4549-b406-e76fb5025476n%40googlegroups.com
  
 

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

2022-12-20 Thread Justin Israel
On Wed, Dec 21, 2022 at 1:42 PM Kat Patterson 
wrote:

> Okay so that did help, but now I am back to how do I add it to each
> individual command (i posted my code, it is a menu that creates an object,
> and another option to duplicate that object said amount of times) and how
> do I add the button into the mix to make said dropdown options run
>

Well like the document that I had included says, when you use optionMenu,
it no longer respects the command attached to each menuItem. You would
control it all through the single callback that fires when the option
changes. You can either use an if/else like this:

def printNewMenuItem(item):
if item == "Sphere":
printSphere()
elif item == "Cube":
printCube()
def printSphere():
print("It's a sphere!")
def printCube():
print("It's a cube!")

Or you can define it in a map to make it easier:

menuCallbacks = {
"Sphere": printSphere,
"Cube": printCube,
}
def printNewMenuItem(item):
cbk = menuCallbacks.get(item)
if cbk:
cbk()
else:
print("Oops. I didnt define a callback for {}".format(item))



>
> On Tuesday, December 20, 2022 at 5:25:09 PM UTC-7 justin...@gmail.com
> wrote:
>
>> On Wed, Dec 21, 2022 at 1:19 PM Kat Patterson 
>> wrote:
>>
>>> def printNewMenuItem( item ):
>>> print item
>>>
>>> This code alone ALWAYS produces a invalid syntax on my end, so I am
>>> unable to check if that even works, or how it even works. I have looked at
>>> the documentation and am unable to find a workaround while looking at
>>> either of those documentation sites.
>>>
>>
>> Are you running a version of Maya using python3? If so,
>>
>> def printNewMenuItem( item ):
>> print(item)
>>
>>
>>>
>>> Any ideas?
>>>
>>> On Tuesday, December 20, 2022 at 5:14:28 PM UTC-7 justin...@gmail.com
>>> wrote:
>>>
 Hi Kat,

 Have a look here:

 https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html

 "Note that commands attached to menu items will not get called. Attach
 any commands via the -cc/changedCommand flag."

 And specifically the changeCommand:

 https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagchangeCommand

 The example at the bottom of the page actually shows you how to use the
 callback, which will receive the value of the menuItem when it is changed
 in the optionMenu.

 Justin


 On Wed, Dec 21, 2022 at 1:11 PM Kat Patterson 
 wrote:

> https://pastebin.com/SfLxjFmG
>
> On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson wrote:
>
>> 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_m...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/16e3c45b-8fba-4542-83a9-750fbc0e1ce4n%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_m...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/e49e0fb6-aceb-4549-b406-e76fb5025476n%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/b99ee3df-4f2f-4134-b1e3-6ceb062dn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the 

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

2022-12-20 Thread Kat Patterson
Okay so that did help, but now I am back to how do I add it to each 
individual command (i posted my code, it is a menu that creates an object, 
and another option to duplicate that object said amount of times) and how 
do I add the button into the mix to make said dropdown options run

On Tuesday, December 20, 2022 at 5:25:09 PM UTC-7 justin...@gmail.com wrote:

> On Wed, Dec 21, 2022 at 1:19 PM Kat Patterson  wrote:
>
>> def printNewMenuItem( item ):
>> print item
>>
>> This code alone ALWAYS produces a invalid syntax on my end, so I am 
>> unable to check if that even works, or how it even works. I have looked at 
>> the documentation and am unable to find a workaround while looking at 
>> either of those documentation sites.
>>
>
> Are you running a version of Maya using python3? If so, 
>
> def printNewMenuItem( item ):
> print(item)
>  
>
>>
>> Any ideas?
>>
>> On Tuesday, December 20, 2022 at 5:14:28 PM UTC-7 justin...@gmail.com 
>> wrote:
>>
>>> Hi Kat,
>>>
>>> Have a look here:
>>>
>>> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html
>>>
>>> "Note that commands attached to menu items will not get called. Attach 
>>> any commands via the -cc/changedCommand flag."
>>>
>>> And specifically the changeCommand:
>>>
>>> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagchangeCommand
>>>
>>> The example at the bottom of the page actually shows you how to use the 
>>> callback, which will receive the value of the menuItem when it is changed 
>>> in the optionMenu.
>>>
>>> Justin
>>>
>>>
>>> On Wed, Dec 21, 2022 at 1:11 PM Kat Patterson  
>>> wrote:
>>>
 https://pastebin.com/SfLxjFmG

 On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson wrote:

> 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_m...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/python_inside_maya/16e3c45b-8fba-4542-83a9-750fbc0e1ce4n%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_m...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/e49e0fb6-aceb-4549-b406-e76fb5025476n%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/b99ee3df-4f2f-4134-b1e3-6ceb062dn%40googlegroups.com.


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

2022-12-20 Thread Justin Israel
On Wed, Dec 21, 2022 at 1:19 PM Kat Patterson 
wrote:

> def printNewMenuItem( item ):
> print item
>
> This code alone ALWAYS produces a invalid syntax on my end, so I am unable
> to check if that even works, or how it even works. I have looked at the
> documentation and am unable to find a workaround while looking at either of
> those documentation sites.
>

Are you running a version of Maya using python3? If so,

def printNewMenuItem( item ):
print(item)


>
> Any ideas?
>
> On Tuesday, December 20, 2022 at 5:14:28 PM UTC-7 justin...@gmail.com
> wrote:
>
>> Hi Kat,
>>
>> Have a look here:
>>
>> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html
>>
>> "Note that commands attached to menu items will not get called. Attach
>> any commands via the -cc/changedCommand flag."
>>
>> And specifically the changeCommand:
>>
>> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagchangeCommand
>>
>> The example at the bottom of the page actually shows you how to use the
>> callback, which will receive the value of the menuItem when it is changed
>> in the optionMenu.
>>
>> Justin
>>
>>
>> On Wed, Dec 21, 2022 at 1:11 PM Kat Patterson 
>> wrote:
>>
>>> https://pastebin.com/SfLxjFmG
>>>
>>> On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson wrote:
>>>
 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_m...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/16e3c45b-8fba-4542-83a9-750fbc0e1ce4n%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/e49e0fb6-aceb-4549-b406-e76fb5025476n%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/CAPGFgA29evEBhORu%2BwgrOx7dKS1HzjKm7%3D1BKD-ww9V2uGHCsw%40mail.gmail.com.


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

2022-12-20 Thread Kat Patterson
def printNewMenuItem( item ):
print item

This code alone ALWAYS produces a invalid syntax on my end, so I am unable 
to check if that even works, or how it even works. I have looked at the 
documentation and am unable to find a workaround while looking at either of 
those documentation sites.

Any ideas?

On Tuesday, December 20, 2022 at 5:14:28 PM UTC-7 justin...@gmail.com wrote:

> Hi Kat,
>
> Have a look here:
>
> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html
>
> "Note that commands attached to menu items will not get called. Attach any 
> commands via the -cc/changedCommand flag."
>
> And specifically the changeCommand:
>
> https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagchangeCommand
>
> The example at the bottom of the page actually shows you how to use the 
> callback, which will receive the value of the menuItem when it is changed 
> in the optionMenu.
>
> Justin
>
>
> On Wed, Dec 21, 2022 at 1:11 PM Kat Patterson  wrote:
>
>> https://pastebin.com/SfLxjFmG
>>
>> On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson wrote:
>>
>>> 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_m...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/16e3c45b-8fba-4542-83a9-750fbc0e1ce4n%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/e49e0fb6-aceb-4549-b406-e76fb5025476n%40googlegroups.com.


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

2022-12-20 Thread Justin Israel
Hi Kat,

Have a look here:
https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html

"Note that commands attached to menu items will not get called. Attach any
commands via the -cc/changedCommand flag."

And specifically the changeCommand:
https://help.autodesk.com/cloudhelp/2022/ENU/Maya-Tech-Docs/CommandsPython/optionMenu.html#flagchangeCommand

The example at the bottom of the page actually shows you how to use the
callback, which will receive the value of the menuItem when it is changed
in the optionMenu.

Justin


On Wed, Dec 21, 2022 at 1:11 PM Kat Patterson 
wrote:

> https://pastebin.com/SfLxjFmG
>
> On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson wrote:
>
>> 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/16e3c45b-8fba-4542-83a9-750fbc0e1ce4n%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/CAPGFgA2QH-142fM4AS8Mc36zTCm%2B_Dayrnw36Yd%2B98GqJmHwRQ%40mail.gmail.com.


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

2022-12-20 Thread Kat Patterson
https://pastebin.com/SfLxjFmG

On Tuesday, December 20, 2022 at 5:09:19 PM UTC-7 Kat Patterson wrote:

> 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/16e3c45b-8fba-4542-83a9-750fbc0e1ce4n%40googlegroups.com.