示例#1
0
class MayaPyHomeWidget(PyGlassWidget):
    """A class for..."""

    #===================================================================================================
    #                                                                                       C L A S S

    #___________________________________________________________________________________________________ __init__
    def __init__(self, parent, **kwargs):
        """Creates a new instance of MayaPyHomeWidget."""
        super(MayaPyHomeWidget, self).__init__(parent, **kwargs)
        self._firstView = True

        self.assignment1Btn.clicked.connect(self._handleAssignment1)
        self.assignment2Btn.clicked.connect(self._handleAssignment2)
        self.gundamBtn.clicked.connect(self._handleGundam)
        self.movesBtn.clicked.connect(self._handleMoves)

        self._statusBox, statusLayout = self._createElementWidget(
            self, QtGui.QVBoxLayout, True)
        statusLayout.addStretch()

        self._nimbleStatus = NimbleStatusElement(
            self._statusBox,
            disabled=self.mainWindow.appConfig.get(
                UserConfigEnum.NIMBLE_TEST_STATUS, True))
        statusLayout.addWidget(self._nimbleStatus)
#===================================================================================================
#                                                                               P R O T E C T E D

#___________________________________________________________________________________________________ _activateWidgetDisplayImpl

    def _activateWidgetDisplayImpl(self, **kwargs):
        if self._firstView:
            self._nimbleStatus.refresh()
            self._firstView = False

#===================================================================================================
#                                                                                 H A N D L E R S

#___________________________________________________________________________________________________ _handleAssignment1

    def _handleAssignment1(self):
        self.mainWindow.setActiveWidget('assignment1')

#___________________________________________________________________________________________________ _handleAssignment2

    def _handleAssignment2(self):
        self.mainWindow.setActiveWidget('assignment2')

#___________________________________________________________________________________________________ _handleGundam

    def _handleGundam(self):
        self.mainWindow.setActiveWidget('gundam')

#___________________________________________________________________________________________________ _handleMoves

    def _handleMoves(self):
        self.mainWindow.setActiveWidget('Moves')
示例#2
0
class MayaPyHomeWidget(PyGlassWidget):
    """A class for..."""

#===================================================================================================
#                                                                                       C L A S S

#___________________________________________________________________________________________________ __init__
    def __init__(self, parent, **kwargs):
        """Creates a new instance of MayaPyHomeWidget."""
        super(MayaPyHomeWidget, self).__init__(parent, **kwargs)
        self._firstView = True

        self.assignment1Btn.clicked.connect(self._handleAssignment1)
        self.assignment2Btn.clicked.connect(self._handleAssignment2)
        self.assignment3Btn.clicked.connect(self._handleAssignment3)
        self.assignment4Btn.clicked.connect(self._handleAssignment4)
        self.assignment5Btn.clicked.connect(self._handleAssignment5)

        self._statusBox, statusLayout = self._createElementWidget(self, QtGui.QVBoxLayout, True)
        statusLayout.addStretch()

        self._nimbleStatus = NimbleStatusElement(
            self._statusBox,
            disabled=self.mainWindow.appConfig.get(UserConfigEnum.NIMBLE_TEST_STATUS, True) )
        statusLayout.addWidget(self._nimbleStatus)
#===================================================================================================
#                                                                               P R O T E C T E D

#___________________________________________________________________________________________________ _activateWidgetDisplayImpl
    def _activateWidgetDisplayImpl(self, **kwargs):
        if self._firstView:
            self._nimbleStatus.refresh()
            self._firstView = False

#===================================================================================================
#                                                                                 H A N D L E R S

#___________________________________________________________________________________________________ _handleAssignment1
    def _handleAssignment1(self):
        self.mainWindow.setActiveWidget('assignment1')

#___________________________________________________________________________________________________ _handleAssignment2
    def _handleAssignment2(self):
        self.mainWindow.setActiveWidget('assignment2')

#___________________________________________________________________________________________________ _handleAssignment3
    def _handleAssignment3(self):
        self.mainWindow.setActiveWidget('assignment3')
#___________________________________________________________________________________________________ _handleAssignment4
    def _handleAssignment4(self):
        self.mainWindow.setActiveWidget('assignment4')
#___________________________________________________________________________________________________ _handleAssignment5
    def _handleAssignment5(self):
        self.mainWindow.setActiveWidget('YakunWork')
示例#3
0
class MayaPyHomeWidget(PyGlassWidget):
    """A class for..."""

    #===================================================================================================
    #                                                                                       C L A S S

    #___________________________________________________________________________________________________ __init__
    def __init__(self, parent, **kwargs):
        """Creates a new instance of MayaPyHomeWidget."""
        super(MayaPyHomeWidget, self).__init__(parent, **kwargs)
        self._firstView = True

        self.assignment1Btn.clicked.connect(self._handleAssignment1)
        self.assignment2Btn.clicked.connect(self._handleAssignment2)
        self.assignment3Btn.clicked.connect(self._handleAssignment3)
        self.assignment4Btn.clicked.connect(self._handleAssignment4)
        self.assignment5Btn.clicked.connect(self._handleAssignment5)
        self.colorChangeButton.clicked.connect(self._handleColorChange)
        self.finalProjButton.clicked.connect(self._handleFinalProj)

        self._statusBox, statusLayout = self._createElementWidget(
            self, QtGui.QVBoxLayout, True)
        statusLayout.addStretch()

        self._nimbleStatus = NimbleStatusElement(
            self._statusBox,
            disabled=self.mainWindow.appConfig.get(
                UserConfigEnum.NIMBLE_TEST_STATUS, True))
        statusLayout.addWidget(self._nimbleStatus)
#===================================================================================================
#                                                                               P R O T E C T E D

#___________________________________________________________________________________________________ _activateWidgetDisplayImpl

    def _activateWidgetDisplayImpl(self, **kwargs):
        if self._firstView:
            self._nimbleStatus.refresh()
            self._firstView = False

#===================================================================================================
#                                                                                 H A N D L E R S

#___________________________________________________________________________________________________ _handleAssignment1

    def _handleAssignment1(self):
        self.mainWindow.setActiveWidget('assignment1')

#___________________________________________________________________________________________________ _handleAssignment2

    def _handleAssignment2(self):
        self.mainWindow.setActiveWidget('assignment2')

#___________________________________________________________________________________________________ _handleAssignment3

    def _handleAssignment3(self):
        self.mainWindow.setActiveWidget('assignment3')
#___________________________________________________________________________________________________ _handleAssignment3

    def _handleAssignment4(self):
        self.mainWindow.setActiveWidget('assignment4')
#___________________________________________________________________________________________________ _handleAssignment3

    def _handleAssignment5(self):
        self.mainWindow.setActiveWidget('assignment5')
#___________________________________________________________________________________________________ _handleAssignment3

    def _handleFinalProj(self):
        self.mainWindow.setActiveWidget('finalProj')
#___________________________________________________________________________________________________ _handleAssignment3

    def _handleColorChange(self):
        self.mainWindow.setActiveWidget('colorChange')
示例#4
0
class MayaPyHomeWidget(PyGlassWidget):
    """A class for..."""

#===================================================================================================
#                                                                                       C L A S S

#___________________________________________________________________________________________________ __init__
    def __init__(self, parent, **kwargs):
        """Creates a new instance of MayaPyHomeWidget."""
        super(MayaPyHomeWidget, self).__init__(parent, **kwargs)
        self._firstView = True

        self.alignmentWeight = 0
        self.separationWeight = 0
        self.cohesionWeight = 0
        self.numFlockers = 5
        self.speed = 1
        self.numFrames = 120
        self.in3D = False
        self.distance = 5

        weights = ['0', '1', '2', '3', '4', '5']
        numFlockers = ['5', '10', '15', '20', '25', '35', '40', '45', '50']
        speeds = ['1', '2', '3', '4', '5']
        dimensions = ['2D', '3D']
        frames = ['120', '240', '360', '480', '600']
        distances = ['5', '10', '15', '20']

        self.alignmentBox.addItems(weights)
        self.cohesionBox.addItems(weights)
        self.separationBox.addItems(weights)
        self.numFlockersBox.addItems(numFlockers)
        self.speedBox.addItems(speeds)
        self.dimensionsBox.addItems(dimensions)
        self.framesBox.addItems(frames)
        self.distanceBox.addItems(distances)
        self.alignmentBox.setCurrentIndex(0)
        self.cohesionBox.setCurrentIndex(0)
        self.separationBox.setCurrentIndex(0)
        self.numFlockersBox.setCurrentIndex(0)
        self.speedBox.setCurrentIndex(0)
        self.dimensionsBox.setCurrentIndex(0)
        self.framesBox.setCurrentIndex(0)
        self.distanceBox.setCurrentIndex(0)

        self.runButton.clicked.connect(self._run)

        self._statusBox, statusLayout = self._createElementWidget(self, QtGui.QVBoxLayout, True)
        statusLayout.addStretch()

        self._nimbleStatus = NimbleStatusElement(
            self._statusBox,
            disabled=self.mainWindow.appConfig.get(UserConfigEnum.NIMBLE_TEST_STATUS, True) )
        statusLayout.addWidget(self._nimbleStatus)
#===================================================================================================
#                                                                               P R O T E C T E D

#___________________________________________________________________________________________________ _activateWidgetDisplayImpl
    def _activateWidgetDisplayImpl(self, **kwargs):
        if self._firstView:
            self._nimbleStatus.refresh()
            self._firstView = False

#===================================================================================================
#                                                                                 H A N D L E R S

#___________________________________________________________________________________________________ _handleAssignment1
    def _run(self):
        self.alignmentWeight = int(self.alignmentBox.currentText())
        self.cohesionWeight = int(self.cohesionBox.currentText())
        self.separationWeight = int(self.separationBox.currentText())
        self.numFlockers = int(self.numFlockersBox.currentText())
        self.speed = int(self.speedBox.currentText())
        self.numFrames = int(self.framesBox.currentText())
        self.distance = int(self.distanceBox.currentText())
        if self.dimensionsBox.currentText() == "2D":
            self.in3D = False
        else:
            self.in3D = True
        Driver.simulate(self.numFlockers,
                        self.numFrames,
                        self.alignmentWeight,
                        self.cohesionWeight,
                        self.separationWeight,
                        self.speed,
                        self.distance,
                        self.in3D)
class MayaPyHomeWidget(PyGlassWidget):
    """A class for..."""

    #===================================================================================================
    #                                                                                       C L A S S

    #___________________________________________________________________________________________________ __init__
    def __init__(self, parent, **kwargs):
        """Creates a new instance of MayaPyHomeWidget."""
        super(MayaPyHomeWidget, self).__init__(parent, **kwargs)
        self._firstView = True

        self.createButton.clicked.connect(self._handleCreateButton)

        self._statusBox, statusLayout = self._createElementWidget(
            self, QtGui.QVBoxLayout, True)
        statusLayout.addStretch()

        self._nimbleStatus = NimbleStatusElement(
            self._statusBox,
            disabled=self.mainWindow.appConfig.get(
                UserConfigEnum.NIMBLE_TEST_STATUS, True))
        statusLayout.addWidget(self._nimbleStatus)
#===================================================================================================
#                                                                               P R O T E C T E D

#___________________________________________________________________________________________________ _activateWidgetDisplayImpl

    def _activateWidgetDisplayImpl(self, **kwargs):
        if self._firstView:
            self._nimbleStatus.refresh()
            self._firstView = False


#===================================================================================================
#                                                                                 H A N D L E R S

#___________________________________________________________________________________________________ _handleCreateButton

    def _handleCreateButton(self):
        """
        This callback creates the Material to be used, and adds it to the object selected for import
        """
        #path = '../../apps/MayaPy/'
        path = '../assets/'
        matName = self.MaterialBox.currentText()
        objectName = self.ObjectBox.currentText()
        type = 'mayaAscii'

        #Import Object first then create shader to attach to it

        if matName == 'Ruby':
            newShader = mayaMRshader(matName, (0.614, 0.041, 0.041), 1.0, 1.0,
                                     (0.723, 0.623, 0.623), 1.0, 2.417,
                                     (0.723, 0.623, 0.623), (0.7, 0.5, 0.2),
                                     0.5)
        if matName == 'Emerald':
            newShader = mayaMRshader(matName, (0.076, 0.614, 0.076), 1.0, 1.0,
                                     (0.633, 0.728, 0.633), 1.0, 1.6,
                                     (0.633, 0.728, 0.633), (0.7, 0.5, 0.2),
                                     0.5)
        if matName == 'Diamond':
            newShader = mayaMRshader(matName, (0.723, 0.945, 1.0), 1.0, 1.0,
                                     (1.0, 1.0, 1.0), 1.0, 2.417,
                                     (1.0, 1.0, 1.0), (0.7, 0.5, 0.2), 0.5)
        if matName == 'Pearl':
            newShader = mayaMRshader(matName, (1.0, 1.0, 1.0), 1.0, 1.0,
                                     (1.0, 0.829, 0.829), 1.0, 2.417,
                                     (1.0, 1.0, 1.0), (0.7, 0.5, 0.2), 0.5)

        newShader.create()

        file = importFile(objectName, path, type)
        file.create()

        global objectNum
        objectNum = objectNum + 1
        cmds.select(objectName)
        cmds.rename(objectName + str(objectNum))

        cmds.hyperShade(a=matName + '1')
class MayaPyHomeWidget(PyGlassWidget):
    """A class for..."""

#===================================================================================================
#                                                                                       C L A S S

#___________________________________________________________________________________________________ __init__
    def __init__(self, parent, **kwargs):
        """Creates a new instance of MayaPyHomeWidget."""
        super(MayaPyHomeWidget, self).__init__(parent, **kwargs)
        self._firstView = True

        self.moveBtn.clicked.connect(self._handleMove)
        self.jumpBtn.clicked.connect(self._handleJump)
        self.attackBtn.clicked.connect(self._handleAttack)
        self.resetBtn.clicked.connect(self._handleReset)

        self._statusBox, statusLayout = self._createElementWidget(self, QtGui.QVBoxLayout, True)
        statusLayout.addStretch()

        self._nimbleStatus = NimbleStatusElement(
            self._statusBox,
            disabled=self.mainWindow.appConfig.get(UserConfigEnum.NIMBLE_TEST_STATUS, True) )
        statusLayout.addWidget(self._nimbleStatus)
#===================================================================================================
#                                                                               P R O T E C T E D

#___________________________________________________________________________________________________ _activateWidgetDisplayImpl
    def _activateWidgetDisplayImpl(self, **kwargs):
        if self._firstView:
            self._nimbleStatus.refresh()
            self._firstView = False

#===================================================================================================
#                                                                                 H A N D L E R S

#___________________________________________________________________________________________________ _handleMove
    def _handleMove(self):
        cmds.playbackOptions(max=24, aet=24)
        cmds.setKeyframe("CTRL_L_legA", at="translateZ", v=float(cmds.getAttr('CTRL_L_legA.translateZ')), t=1)
        cmds.setKeyframe("CTRL_L_legA", at="translateZ", v=float(cmds.getAttr('CTRL_L_legA.translateZ')+2), t=6)
        cmds.setKeyframe("CTRL_L_legA", at="translateZ", v=float(cmds.getAttr('CTRL_L_legA.translateZ')), t=12)
        cmds.setKeyframe("CTRL_L_legA", at="translateZ", v=float(cmds.getAttr('CTRL_L_legA.translateZ')-2), t=18)
        cmds.setKeyframe("CTRL_L_legA", at="translateZ", v=float(cmds.getAttr('CTRL_L_legA.translateZ')), t=24)

        cmds.setKeyframe("CTRL_L_legB", at="translateZ", v=float(cmds.getAttr('CTRL_L_legB.translateZ')), t=1)
        cmds.setKeyframe("CTRL_L_legB", at="translateZ", v=float(cmds.getAttr('CTRL_L_legB.translateZ')-2), t=6)
        cmds.setKeyframe("CTRL_L_legB", at="translateZ", v=float(cmds.getAttr('CTRL_L_legB.translateZ')), t=12)
        cmds.setKeyframe("CTRL_L_legB", at="translateZ", v=float(cmds.getAttr('CTRL_L_legB.translateZ')+2), t=18)
        cmds.setKeyframe("CTRL_L_legB", at="translateZ", v=float(cmds.getAttr('CTRL_L_legB.translateZ')), t=24)

        cmds.setKeyframe("CTRL_L_legC", at="translateZ", v=float(cmds.getAttr('CTRL_L_legC.translateZ')), t=1)
        cmds.setKeyframe("CTRL_L_legC", at="translateZ", v=float(cmds.getAttr('CTRL_L_legC.translateZ')+2), t=6)
        cmds.setKeyframe("CTRL_L_legC", at="translateZ", v=float(cmds.getAttr('CTRL_L_legC.translateZ')), t=12)
        cmds.setKeyframe("CTRL_L_legC", at="translateZ", v=float(cmds.getAttr('CTRL_L_legC.translateZ')-2), t=18)
        cmds.setKeyframe("CTRL_L_legC", at="translateZ", v=float(cmds.getAttr('CTRL_L_legC.translateZ')), t=24)

        cmds.setKeyframe("CTRL_L_legD", at="translateZ", v=float(cmds.getAttr('CTRL_L_legD.translateZ')), t=1)
        cmds.setKeyframe("CTRL_L_legD", at="translateZ", v=float(cmds.getAttr('CTRL_L_legD.translateZ')-2), t=6)
        cmds.setKeyframe("CTRL_L_legD", at="translateZ", v=float(cmds.getAttr('CTRL_L_legD.translateZ')), t=12)
        cmds.setKeyframe("CTRL_L_legD", at="translateZ", v=float(cmds.getAttr('CTRL_L_legD.translateZ')+2), t=18)
        cmds.setKeyframe("CTRL_L_legD", at="translateZ", v=float(cmds.getAttr('CTRL_L_legD.translateZ')), t=24)

        cmds.setKeyframe("CTRL_R_legA", at="translateZ", v=float(cmds.getAttr('CTRL_R_legA.translateZ')), t=1)
        cmds.setKeyframe("CTRL_R_legA", at="translateZ", v=float(cmds.getAttr('CTRL_R_legA.translateZ')-2), t=6)
        cmds.setKeyframe("CTRL_R_legA", at="translateZ", v=float(cmds.getAttr('CTRL_R_legA.translateZ')), t=12)
        cmds.setKeyframe("CTRL_R_legA", at="translateZ", v=float(cmds.getAttr('CTRL_R_legA.translateZ')+2), t=18)
        cmds.setKeyframe("CTRL_R_legA", at="translateZ", v=float(cmds.getAttr('CTRL_R_legA.translateZ')), t=24)

        cmds.setKeyframe("CTRL_R_legB", at="translateZ", v=float(cmds.getAttr('CTRL_R_legB.translateZ')), t=1)
        cmds.setKeyframe("CTRL_R_legB", at="translateZ", v=float(cmds.getAttr('CTRL_R_legB.translateZ')+2), t=6)
        cmds.setKeyframe("CTRL_R_legB", at="translateZ", v=float(cmds.getAttr('CTRL_R_legB.translateZ')), t=12)
        cmds.setKeyframe("CTRL_R_legB", at="translateZ", v=float(cmds.getAttr('CTRL_R_legB.translateZ')-2), t=18)
        cmds.setKeyframe("CTRL_R_legB", at="translateZ", v=float(cmds.getAttr('CTRL_R_legB.translateZ')), t=24)

        cmds.setKeyframe("CTRL_R_legC", at="translateZ", v=float(cmds.getAttr('CTRL_R_legC.translateZ')), t=1)
        cmds.setKeyframe("CTRL_R_legC", at="translateZ", v=float(cmds.getAttr('CTRL_R_legC.translateZ')-2), t=6)
        cmds.setKeyframe("CTRL_R_legC", at="translateZ", v=float(cmds.getAttr('CTRL_R_legC.translateZ')), t=12)
        cmds.setKeyframe("CTRL_R_legC", at="translateZ", v=float(cmds.getAttr('CTRL_R_legC.translateZ')+2), t=18)
        cmds.setKeyframe("CTRL_R_legC", at="translateZ", v=float(cmds.getAttr('CTRL_R_legC.translateZ')), t=24)

        cmds.setKeyframe("CTRL_R_legD", at="translateZ", v=float(cmds.getAttr('CTRL_R_legD.translateZ')), t=1)
        cmds.setKeyframe("CTRL_R_legD", at="translateZ", v=float(cmds.getAttr('CTRL_R_legD.translateZ')+2), t=6)
        cmds.setKeyframe("CTRL_R_legD", at="translateZ", v=float(cmds.getAttr('CTRL_R_legD.translateZ')), t=12)
        cmds.setKeyframe("CTRL_R_legD", at="translateZ", v=float(cmds.getAttr('CTRL_R_legD.translateZ')-2), t=18)
        cmds.setKeyframe("CTRL_R_legD", at="translateZ", v=float(cmds.getAttr('CTRL_R_legD.translateZ')), t=24)


#___________________________________________________________________________________________________ _handleJump
    def _handleJump(self):
        cmds.playbackOptions(max=30, aet=30)
        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')), t=1)
        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')-4), t=12)
        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')-4), t=12)
        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')+18), t=18)
        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')-4), t=24)
        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')), t=30)


#___________________________________________________________________________________________________ _handleAttack
    def _handleAttack(self):
        cmds.playbackOptions(max=54, aet=54)
        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')), t=1)
        cmds.setKeyframe("MoveAll", at="translateZ", v=float(cmds.getAttr('MoveAll.translateZ')), t=1)
        cmds.setKeyframe("CTRL_innerFangL", at="translateY", v=float(cmds.getAttr('CTRL_innerFangL.translateY')), t=1)
        cmds.setKeyframe("CTRL_innerFangR", at="translateY", v=float(cmds.getAttr('CTRL_innerFangR.translateY')), t=1)
        cmds.setKeyframe("L_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('L_outerFang_JA.rotateZ')), t=1)
        cmds.setKeyframe("R_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('R_outerFang_JA.rotateZ')), t=1)

        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')), t=36)
        cmds.setKeyframe("MoveAll", at="translateZ", v=float(cmds.getAttr('MoveAll.translateZ')-3.5), t=36)
        cmds.setKeyframe("CTRL_innerFangL", at="translateY", v=float(cmds.getAttr('CTRL_innerFangL.translateY')+1.5), t=36)
        cmds.setKeyframe("CTRL_innerFangR", at="translateY", v=float(cmds.getAttr('CTRL_innerFangR.translateY')+1.5), t=36)
        cmds.setKeyframe("L_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('L_outerFang_JA.rotateZ')+45), t=36)
        cmds.setKeyframe("R_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('R_outerFang_JA.rotateZ')+45), t=36)

        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')), t=48)
        cmds.setKeyframe("MoveAll", at="translateZ", v=float(cmds.getAttr('MoveAll.translateZ')-3.5), t=48)
        cmds.setKeyframe("CTRL_innerFangL", at="translateY", v=float(cmds.getAttr('CTRL_innerFangL.translateY')+1.5), t=48)
        cmds.setKeyframe("CTRL_innerFangR", at="translateY", v=float(cmds.getAttr('CTRL_innerFangR.translateY')+1.5), t=48)
        cmds.setKeyframe("L_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('L_outerFang_JA.rotateZ')+45), t=48)
        cmds.setKeyframe("R_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('R_outerFang_JA.rotateZ')+45), t=48)

        cmds.setKeyframe("MoveAll", at="translateY", v=float(cmds.getAttr('MoveAll.translateY')-7), t=54)
        cmds.setKeyframe("MoveAll", at="translateZ", v=float(cmds.getAttr('MoveAll.translateZ')+5.5), t=54)
        cmds.setKeyframe("CTRL_innerFangL", at="translateY", v=float(cmds.getAttr('CTRL_innerFangL.translateY')), t=54)
        cmds.setKeyframe("CTRL_innerFangR", at="translateY", v=float(cmds.getAttr('CTRL_innerFangR.translateY')), t=54)
        cmds.setKeyframe("L_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('L_outerFang_JA.rotateZ')), t=54)
        cmds.setKeyframe("R_outerFang_JA", at="rotateZ", v=float(cmds.getAttr('R_outerFang_JA.rotateZ')), t=54)


#___________________________________________________________________________________________________ _handleReset
    def _handleReset(self):
        cmds.currentTime(1)
        cmds.cutKey('MoveAll', 'CTRL_R_legD', 'CTRL_R_legC', 'CTRL_R_legB', 'CTRL_R_legA', 'CTRL_L_legD', 'CTRL_L_legC',
                    'CTRL_L_legB', 'CTRL_L_legA', 'CTRL_innerFangL', 'CTRL_innerFangR', 'R_outerFang_JA', 'L_outerFang_JA')
示例#7
0
class MayaPyHomeWidget(PyGlassWidget):
    """A class for..."""

    #===================================================================================================
    #                                                                                       C L A S S

    #___________________________________________________________________________________________________ __init__
    def __init__(self, parent, **kwargs):
        """Creates a new instance of MayaPyHomeWidget."""
        super(MayaPyHomeWidget, self).__init__(parent, **kwargs)
        self._firstView = True

        self.moveBtn.clicked.connect(self._handleMove)
        self.jumpBtn.clicked.connect(self._handleJump)
        self.attackBtn.clicked.connect(self._handleAttack)
        self.resetBtn.clicked.connect(self._handleReset)

        self._statusBox, statusLayout = self._createElementWidget(
            self, QtGui.QVBoxLayout, True)
        statusLayout.addStretch()

        self._nimbleStatus = NimbleStatusElement(
            self._statusBox,
            disabled=self.mainWindow.appConfig.get(
                UserConfigEnum.NIMBLE_TEST_STATUS, True))
        statusLayout.addWidget(self._nimbleStatus)
#===================================================================================================
#                                                                               P R O T E C T E D

#___________________________________________________________________________________________________ _activateWidgetDisplayImpl

    def _activateWidgetDisplayImpl(self, **kwargs):
        if self._firstView:
            self._nimbleStatus.refresh()
            self._firstView = False

#===================================================================================================
#                                                                                 H A N D L E R S

#___________________________________________________________________________________________________ _handleMove

    def _handleMove(self):
        cmds.playbackOptions(max=24, aet=24)
        cmds.setKeyframe("CTRL_L_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legA.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_L_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legA.translateZ') + 2),
                         t=6)
        cmds.setKeyframe("CTRL_L_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legA.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_L_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legA.translateZ') - 2),
                         t=18)
        cmds.setKeyframe("CTRL_L_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legA.translateZ')),
                         t=24)

        cmds.setKeyframe("CTRL_L_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legB.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_L_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legB.translateZ') - 2),
                         t=6)
        cmds.setKeyframe("CTRL_L_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legB.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_L_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legB.translateZ') + 2),
                         t=18)
        cmds.setKeyframe("CTRL_L_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legB.translateZ')),
                         t=24)

        cmds.setKeyframe("CTRL_L_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legC.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_L_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legC.translateZ') + 2),
                         t=6)
        cmds.setKeyframe("CTRL_L_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legC.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_L_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legC.translateZ') - 2),
                         t=18)
        cmds.setKeyframe("CTRL_L_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legC.translateZ')),
                         t=24)

        cmds.setKeyframe("CTRL_L_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legD.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_L_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legD.translateZ') - 2),
                         t=6)
        cmds.setKeyframe("CTRL_L_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legD.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_L_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legD.translateZ') + 2),
                         t=18)
        cmds.setKeyframe("CTRL_L_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_L_legD.translateZ')),
                         t=24)

        cmds.setKeyframe("CTRL_R_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legA.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_R_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legA.translateZ') - 2),
                         t=6)
        cmds.setKeyframe("CTRL_R_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legA.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_R_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legA.translateZ') + 2),
                         t=18)
        cmds.setKeyframe("CTRL_R_legA",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legA.translateZ')),
                         t=24)

        cmds.setKeyframe("CTRL_R_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legB.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_R_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legB.translateZ') + 2),
                         t=6)
        cmds.setKeyframe("CTRL_R_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legB.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_R_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legB.translateZ') - 2),
                         t=18)
        cmds.setKeyframe("CTRL_R_legB",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legB.translateZ')),
                         t=24)

        cmds.setKeyframe("CTRL_R_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legC.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_R_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legC.translateZ') - 2),
                         t=6)
        cmds.setKeyframe("CTRL_R_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legC.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_R_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legC.translateZ') + 2),
                         t=18)
        cmds.setKeyframe("CTRL_R_legC",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legC.translateZ')),
                         t=24)

        cmds.setKeyframe("CTRL_R_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legD.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_R_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legD.translateZ') + 2),
                         t=6)
        cmds.setKeyframe("CTRL_R_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legD.translateZ')),
                         t=12)
        cmds.setKeyframe("CTRL_R_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legD.translateZ') - 2),
                         t=18)
        cmds.setKeyframe("CTRL_R_legD",
                         at="translateZ",
                         v=float(cmds.getAttr('CTRL_R_legD.translateZ')),
                         t=24)

#___________________________________________________________________________________________________ _handleJump

    def _handleJump(self):
        cmds.playbackOptions(max=30, aet=30)
        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY')),
                         t=1)
        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY') - 4),
                         t=12)
        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY') - 4),
                         t=12)
        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY') + 18),
                         t=18)
        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY') - 4),
                         t=24)
        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY')),
                         t=30)

#___________________________________________________________________________________________________ _handleAttack

    def _handleAttack(self):
        cmds.playbackOptions(max=54, aet=54)
        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY')),
                         t=1)
        cmds.setKeyframe("MoveAll",
                         at="translateZ",
                         v=float(cmds.getAttr('MoveAll.translateZ')),
                         t=1)
        cmds.setKeyframe("CTRL_innerFangL",
                         at="translateY",
                         v=float(cmds.getAttr('CTRL_innerFangL.translateY')),
                         t=1)
        cmds.setKeyframe("CTRL_innerFangR",
                         at="translateY",
                         v=float(cmds.getAttr('CTRL_innerFangR.translateY')),
                         t=1)
        cmds.setKeyframe("L_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('L_outerFang_JA.rotateZ')),
                         t=1)
        cmds.setKeyframe("R_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('R_outerFang_JA.rotateZ')),
                         t=1)

        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY')),
                         t=36)
        cmds.setKeyframe("MoveAll",
                         at="translateZ",
                         v=float(cmds.getAttr('MoveAll.translateZ') - 3.5),
                         t=36)
        cmds.setKeyframe(
            "CTRL_innerFangL",
            at="translateY",
            v=float(cmds.getAttr('CTRL_innerFangL.translateY') + 1.5),
            t=36)
        cmds.setKeyframe(
            "CTRL_innerFangR",
            at="translateY",
            v=float(cmds.getAttr('CTRL_innerFangR.translateY') + 1.5),
            t=36)
        cmds.setKeyframe("L_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('L_outerFang_JA.rotateZ') + 45),
                         t=36)
        cmds.setKeyframe("R_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('R_outerFang_JA.rotateZ') + 45),
                         t=36)

        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY')),
                         t=48)
        cmds.setKeyframe("MoveAll",
                         at="translateZ",
                         v=float(cmds.getAttr('MoveAll.translateZ') - 3.5),
                         t=48)
        cmds.setKeyframe(
            "CTRL_innerFangL",
            at="translateY",
            v=float(cmds.getAttr('CTRL_innerFangL.translateY') + 1.5),
            t=48)
        cmds.setKeyframe(
            "CTRL_innerFangR",
            at="translateY",
            v=float(cmds.getAttr('CTRL_innerFangR.translateY') + 1.5),
            t=48)
        cmds.setKeyframe("L_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('L_outerFang_JA.rotateZ') + 45),
                         t=48)
        cmds.setKeyframe("R_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('R_outerFang_JA.rotateZ') + 45),
                         t=48)

        cmds.setKeyframe("MoveAll",
                         at="translateY",
                         v=float(cmds.getAttr('MoveAll.translateY') - 7),
                         t=54)
        cmds.setKeyframe("MoveAll",
                         at="translateZ",
                         v=float(cmds.getAttr('MoveAll.translateZ') + 5.5),
                         t=54)
        cmds.setKeyframe("CTRL_innerFangL",
                         at="translateY",
                         v=float(cmds.getAttr('CTRL_innerFangL.translateY')),
                         t=54)
        cmds.setKeyframe("CTRL_innerFangR",
                         at="translateY",
                         v=float(cmds.getAttr('CTRL_innerFangR.translateY')),
                         t=54)
        cmds.setKeyframe("L_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('L_outerFang_JA.rotateZ')),
                         t=54)
        cmds.setKeyframe("R_outerFang_JA",
                         at="rotateZ",
                         v=float(cmds.getAttr('R_outerFang_JA.rotateZ')),
                         t=54)

#___________________________________________________________________________________________________ _handleReset

    def _handleReset(self):
        cmds.currentTime(1)
        cmds.cutKey('MoveAll', 'CTRL_R_legD', 'CTRL_R_legC', 'CTRL_R_legB',
                    'CTRL_R_legA', 'CTRL_L_legD', 'CTRL_L_legC', 'CTRL_L_legB',
                    'CTRL_L_legA', 'CTRL_innerFangL', 'CTRL_innerFangR',
                    'R_outerFang_JA', 'L_outerFang_JA')