ml_utilities.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:ml_tools 作者: morganloomis 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号