I have a window with an interactive slider moving keys around (keying is
unnecessary). Unfortunately the Undo queue loads up with every tiny change
in value.
The idea is to move the slider many times until it's just right, sometimes
even closing the UI and opening it up again, all while not loading the Undo
queue.
Any ideas on how to group all the instances of the "moveJimmy" command
below that the slider activates into a single Undo function?
The script is for moving keys, but the following code is a good example of
what's going on. Makes sphere, makes UI with slider, slider moves sphere up
and down:
import maya.cmds as mc
class Jimmy(object):
def __init__(self):
''' Make Jimmy '''
mc.polySphere(name='Jimmy')
def makeJimmyUI(self,*args,**kwargs):
''' Make Jimmy's window '''
# Remove UI if it already exists
if mc.window('jimmyUI',query=1,exists=1):
mc.deleteUI('jimmyUI')
mc.window('jimmyUI')
mc.columnLayout()
# Create Jimmy's slider
mc.floatSliderGrp('allInTheHips',
label='Move Jimmy',
dragCommand=self.moveJimmy, # Have Jimmy's slider
activate moveSphere
sliderStep=0.1,
minValue=-10,
maxValue=10,
)
# Show Jimmy's Window
mc.showWindow('jimmyUI')
def moveJimmy(self,*args, **kwargs):
''' Move Jimmy up and down '''
print 'yup'
# value = value
mc.setAttr('Jimmy.translateY',
mc.floatSliderGrp('allInTheHips',
query=True,
value=True)
)
James = Jimmy()
James.makeJimmyUI() # As long as "Jimmy" exists, this UI can be reopened
later
Thank you!!
All the best,
Isai
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/f1927991-2f10-4ed6-9004-99d0f40b803e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.