Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 13-10-2014 , 01:53 PM
Registered User
Join Date: Oct 2014
Posts: 10

Access values in optionMenuGrp in another function

Seeing that I have 2 menu options, while it is possible for me to create functions individually for each of the menu option, I was wondering how do I grab the values in my menuItems and have it be accessed by okayBtn in which it will fire the final confirmation when User clicks onto it.

So how do I capture it? I tried creating another function but it seems to be screwing it up...

Code:
def optionMenuCallback(*args):
    fn = cmds.menuItem (args[0], q=True, c=True)
    if fn:
        fn()

def menu1Callback():
    startAnimation = cmds.playbackOptions(query=True, minTime=True)
    endAnimation = cmds.playbackOptions(query=True, maxTime=True)

def menu2Callback():
    startAnimation = cmds.findKeyframe(which='first')
    endAnimation = cmds.findKeyframe(which='last')

w = cmds.window(w=150, h=100)
cmds.columnLayout(adjustableColumn=True)
form = cmds.formLayout(numberOfDivisions=100)
exportSelection = cmds.optionMenuGrp(label='example', cc=optionMenuCallback)
menuItem1 = cmds.menuItem('item1', c = menu1Callback)
menuItem2 = cmds.menuItem('item2', c= menu2Callback)
okayBtn = cmds.button(label='okay!', command=self.buttonPressed, width=150, height=35)
cmds.formLayout(form, edit=True, attachForm=[\
(exportSelection, 'top', 18),\
(exportSelection, 'left', 45),\
(okayBtn, 'left', 70),\
(okayBtn, 'top', 90)])
cmds.showWindow(w)


Last edited by salik89; 17-10-2014 at 04:08 AM.
# 2 17-10-2014 , 04:09 AM
Registered User
Join Date: Oct 2014
Posts: 10
any one? greatly appreciated for any pointers

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads