I managed to make some leeway however I am still having issues with it.
# Connections that I have set for my slider
self.ui.planeSizeHorizontalSlider.sliderPressed.connect(self.slider_pressed)
self.ui.planeSizeHorizontalSlider.sliderReleased.connect(self.
slider_released)
self.ui.planeSizeHorizontalSlider.valueChanged.connect(self.
plane_size_slider)
def slider_pressed(self):
cmds.undoInfo(openChunk=True, chunkName='SlideTest')
def slider_released(self):
cmds.undoInfo(closeChunk=True, chunkName='SlideTest')
def plane_size_slider(self, value):
img_plane_node = self.get_current_img_plane()
value /= 10.00
self.ui.planeSizeLineEdit.setText(str(value))
self.set_plane_size(img_plane_node, value)
def set_plane_size(self, node, value):
width = cmds.getAttr("{0}.width".format(node))
height = cmds.getAttr("{0}.height".format(node))
ratio = height / width
# This got regiters as additional actions...
cmds.setAttr("{0}.maintainRatio".format(node), 0)
cmds.setAttr("{0}.width".format(node), value)
cmds.setAttr("{0}.height".format(node), value * ratio)
cmds.setAttr("{0}.maintainRatio".format(node), 1)
However my undo queue is incorrect. Current queue stemming from the above
code (where the queue is empty to begin with) where I perform 2 slides...
# 1: #
# 2: #
# 3: #
# 4: #
# 5: SlideTest #
# 6: #
# 7: #
# 8: #
# 9: #
# 10: SlideTest #
Even so, when I do try to do an undo, it only works the first time and
nothing was changing thereafter. I presume the 'empty' entries are coming
from the `setAttr` in which I am expecting my undo queue to be something as
follows:
# 1: SlideTest #
# 2: SlideTest #
Appreciate in advance for any replies.
--
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/01551416-e7b9-4288-b5fe-3689addec693%40googlegroups.com.