Hey Guys
I was wondering if anyone have seen this behavior.

I have this small function  






*""" test undo with QT """import maya.cmds as mcdef testLoop():    sel = 
mc.ls(sl=1)    for node in sel:        mc.move(1,1,1, node, relative=1)*

If I run this on a selection of nodes from script editor I can undo the 
whole function with a single undo

but

if I run this from a pyside button I have to undo every 'move' command so 
if there are 10 selected objects I have to run undo 10 times. 

What am I doing wrong?

Thanks a lot.
here is my UI script














































*from PySide import QtCore, QtGui, QtUiToolsfrom shiboken import 
wrapInstanceimport maya.OpenMayaUI as omuiimport pysideuicimport maya.cmds 
as mcimport os, sys, inspectimport testUndo as TfilePath = 
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))uiFile 
= os.path.join( filePath , "testUndo.ui")main_window_ptr = 
omui.MQtUtil.mainWindow()_parentWindow = 
wrapInstance(long(main_window_ptr), QtGui.QWidget)class 
UiLoader(QtUiTools.QUiLoader):    def __init__(self, baseinstance):        
QtUiTools.QUiLoader.__init__(self, baseinstance)        self.baseinstance = 
baseinstance    def createWidget(self, class_name, parent=None, 
name=''):        if parent is None and self.baseinstance:            return 
self.baseinstance        else:            widget = 
QtUiTools.QUiLoader.createWidget(self, class_name, parent, name)            
if self.baseinstance:                setattr(self.baseinstance, name, 
widget)            return widgetdef loadUi(uifile, baseinstance=None):    
loader = UiLoader(baseinstance)    widget = loader.load(uifile)    
QtCore.QMetaObject.connectSlotsByName(widget)    return widgetclass 
TestUndoWindow(QtGui.QMainWindow):    def __init__(self, parent = 
None):        QtGui.QMainWindow.__init__(self, parent=_parentWindow)        
loadUi(uiFile, self)    def establishConnections(self):          
self.testUndo_btn.clicked.connect(self.testUndo)    def 
testUndo(self):        T.testLoop()*

-- 
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/4b20c166-e487-4b7c-b7d3-0eb754494cbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to