def drag(self, *args):
'''
This is what is actually run during the drag, updating the coordinates and calling the
placeholder drag functions depending on which button is pressed.
'''
self.dragPoint = mc.draggerContext(self.draggerContext, query=True, dragPoint=True)
#if this doesn't work, try getmodifier
self.modifier = mc.draggerContext(self.draggerContext, query=True, modifier=True)
self.x = ((self.dragPoint[0] - self.anchorPoint[0]) * self.multiplier) + self.defaultValue
self.y = ((self.dragPoint[1] - self.anchorPoint[1]) * self.multiplier) + self.defaultValue
if self.minValue is not None and self.x < self.minValue:
self.x = self.minValue
if self.maxValue is not None and self.x > self.maxValue:
self.x = self.maxValue
#dragString
if self.modifier == 'control':
if self.button == 1:
self.dragControlLeft(*args)
elif self.button == 2:
self.dragControlMiddle(*args)
elif self.modifier == 'shift':
if self.button == 1:
self.dragShiftLeft(*args)
elif self.button == 2:
self.dragShiftMiddle(*args)
else:
if self.button == 1:
self.dragLeft()
elif self.button == 2:
self.dragMiddle()
mc.refresh()
评论列表
文章目录