Exemplo n.º 1
0
    def initializeCadenceCam(self):
        """ This creates an orthographic camera that looks down the Y axis onto
            the XZ plane, and rotated so that the AI file track labels are
            legible.  This camera is positioned so that the given track nodeName
            is centered in its field by setCameraFocus. """

        if cmds.objExists(self.CADENCE_CAM):
            return

        priorSelection = MayaUtils.getSelectedTransforms()

        c = cmds.camera(
            orthographic=True,
            nearClipPlane=1,
            farClipPlane=100000,
            orthographicWidth=400)
        cmds.setAttr(c[0] + '.visibility', False)
        cmds.rename(c[0], self.CADENCE_CAM)
        cmds.rotate(-90, 180, 0)
        cmds.move(0, 100, 0, self.CADENCE_CAM, absolute=True)

        MayaUtils.setSelection(priorSelection)
Exemplo n.º 2
0
    def _handleCreate(self):

        # set initial rotations to zero
        rStat = 0

        # get degrees pre frame for station whell
        rotStation = int(self.ssr.text())

        # set number of frames to shoot at each camera location
        aimPt_1_frames = int(self.cam1f.text())
        aimPt_2_frames = int(self.cam2f.text()) + aimPt_1_frames
        aimPt_3_frames = int(self.cam3f.text()) + aimPt_2_frames
        endPtFrames = 50 + aimPt_3_frames

        # camera position 1
        aimPt_1_x = float(self.cam1x.text())
        aimPt_1_y = float(self.cam1y.text())
        aimPt_1_z = float(self.cam1z.text())

        # camera position 2
        aimPt_2_x = float(self.cam2x.text())
        aimPt_2_y = float(self.cam2y.text())
        aimPt_2_z = float(self.cam2z.text())

        # camera position 3
        aimPt_3_x = float(self.cam3x.text())
        aimPt_3_y = float(self.cam3y.text())
        aimPt_3_z = float(self.cam3z.text())

        # import sun
        cmds.file(
            '$HOME/PycharmProjects/space2014/graphics/SpaceStation/scenes/sun.ma',
            i=True)
        # move sun away from station
        cmds.move(0, 0, 655, 'pSphere1')
        # import station
        cmds.file(
            '$HOME/PycharmProjects/space2014/graphics/SpaceStation/scenes/station.ma',
            i=True)
        # import background
        cmds.file(
            '$HOME/PycharmProjects/space2014/graphics/SpaceStation/scenes/stage.ma',
            i=True)

        # create a new camera
        cam = cmds.camera()

        # move camera to first position
        cmds.move(aimPt_1_x, aimPt_1_y, aimPt_1_z, cam)

        cmds.lookThru(cam)

        cmds.setKeyframe(cam, t=0)

        i = 1

        while i < aimPt_1_frames:

            cmds.setKeyframe('Wheel', attribute='rotateY', value=rStat, t=i)
            rStat = rStat + rotStation
            i += 1

        cmds.setKeyframe(cam, t=i)

        while i < aimPt_2_frames:
            cmds.setKeyframe('Wheel', attribute='rotateY', value=rStat, t=i)
            rStat = rStat + rotStation
            i += 1

        cmds.move(aimPt_2_x, aimPt_2_y, aimPt_2_z, cam)
        cmds.setKeyframe(cam, t=i)
        cmds.setKeyframe('SolarPanels', attribute='rotateZ', value=0, t=i)

        while i < aimPt_3_frames:
            cmds.setKeyframe('Wheel', attribute='rotateY', value=rStat, t=i)
            rStat = rStat + rotStation
            i += 1

        cmds.move(aimPt_3_x, aimPt_3_y, aimPt_3_z, cam)
        cmds.aimConstraint('spaceStation', 'camera1', offset=(0, -90, 0))
        cmds.setKeyframe(cam, t=i)
        cmds.setKeyframe('SolarPanels',
                         attribute='rotateZ',
                         value=float(self.spe.text()),
                         t=i)
        # cmds.setKeyframe( 'SolarPanels', attribute='rotateX', value=float(self.spa.text()), t=i)

        while i < endPtFrames:
            cmds.setKeyframe('Wheel', attribute='rotateY', value=rStat, t=i)
            rStat = rStat + rotStation
            i += 1

        print 'Total number of frames = ', endPtFrames
        print platform.system()
Exemplo n.º 3
0
    def _handleSpaceShipEnterButton(self):
        cmds.file(
            '$HOME/PycharmProjects/space2014/graphics/SpaceShip/scenes/SpaceShipEnter.ma',
            i=True)
        scale = 0
        scaleC = 0
        scaleX = 0

        moveX = 1300
        moveY = 290.702
        moveZ = 76

        xRot = 0
        yRot = 0
        doorRot = 0
        centerR = 0

        time = 1
        cmds.camera()
        cmds.select('camera1')
        cmds.move(600.0, 300.0, 100.0, relative=True)
        cmds.aimConstraint('SpaceShip2', 'camera1', offset=(0, -90, 0))
        cmds.camera()
        cmds.select('camera2')
        cmds.move(160, 392.383, -60.0, relative=True)
        cmds.aimConstraint('SpaceShip2', 'camera2', offset=(0, -90, 0))
        for k in range(30):
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleZ',
                             value=scale,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleY',
                             value=scaleC,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleX',
                             value=scaleX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateY',
                             value=moveY,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateZ',
                             value=moveZ,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            scaleX = scaleX + .01
            scale = scale + .01
            scaleC = scaleC + .01
            moveX = moveX - 10.00
            time = time + 1

        for j in range(20):
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleZ',
                             value=scale,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleY',
                             value=scaleC,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleX',
                             value=scaleX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateY',
                             value=moveY,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateZ',
                             value=moveZ,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            scaleX = scaleX + .01
            scale = scale + .01
            scaleC = scaleC + .01
            moveX = moveX - 7.00
            time = time + 1

        for m in range(100):
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleZ',
                             value=scale,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleY',
                             value=scaleC,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='scaleX',
                             value=scaleX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateY',
                             value=moveY,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateZ',
                             value=moveZ,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            moveX = moveX - 4.00
            time = time + 1

        for p in range(60):
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateY',
                             value=moveY,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateZ',
                             value=moveZ,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            moveX = moveX - 2.6
            time = time + 1

        for i in range(30):
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateY',
                             value=moveY,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateZ',
                             value=moveZ,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='rotateX',
                             value=xRot,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='rotateY',
                             value=yRot,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            xRot = xRot - .80
            yRot = yRot - .50

            moveX = moveX - 2.6
            moveY = moveY + 2.6
            moveZ = moveZ - 2.6
            time = time + 1

        for a in range(30):
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='rotateX',
                             value=xRot,
                             t=time)
            cmds.setKeyframe('SpaceShip2',
                             attribute='rotateY',
                             value=yRot,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            xRot = xRot + .80
            yRot = yRot + .50
            time = time + 1

            moveX = moveX - 2.6

        for b in range(35):
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            moveX = moveX - 2.0
            time = time + 1

        for c in range(47):
            cmds.setKeyframe('spaceDoor',
                             attribute='rotateY',
                             value=doorRot,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            time = time + 1
            doorRot = doorRot - 1.5

        for o in range(62):
            cmds.setKeyframe('SpaceShip2',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            moveX = moveX - 1.0
            time = time + 1

        for q in range(47):
            cmds.setKeyframe('spaceDoor',
                             attribute='rotateY',
                             value=doorRot,
                             t=time)
            cmds.setKeyframe('group5',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            centerR = centerR + .5

            time = time + 1
            doorRot = doorRot + 1.5
Exemplo n.º 4
0
    def _handleSpaceShipAndAsteroid(self):
        cmds.file(
            '$HOME/PycharmProjects/space2014/graphics/SpaceShip/scenes/Asteroid.ma',
            i=True)
        rotY = 0
        rotX = 0
        rotZ = 0
        moveX = 0
        centerR = 0

        aX = -1000
        aY = 352.834
        sX = 0
        doorRot = 0

        time = 0
        time2 = 175

        cmds.camera()
        cmds.move(-90, 370.0, 40.0, relative=True)
        cmds.aimConstraint('pCylinder11', 'camera1', offset=(0, -85, 0))
        cmds.camera()
        cmds.move(-1000, 360.0, 40.0, relative=True)
        cmds.aimConstraint('asteroid', 'camera2', offset=(0, -90, 0))
        cmds.camera()
        cmds.move(-1158.453, 371.553, -.461, relative=True)
        cmds.aimConstraint('asteroid', 'camera3', offset=(0, -90, 0))

        for o in range(327):
            cmds.setKeyframe('Beam', attribute='visibility', value=0, t=time)
            cmds.setKeyframe('asteroid',
                             attribute='translateX',
                             value=aX,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='translateY',
                             value=aY,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='rotateY',
                             value=rotY,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='rotateX',
                             value=rotX,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='rotateZ',
                             value=rotZ,
                             t=time)
            cmds.setKeyframe('group',
                             attribute='rotateY',
                             value=centerR,
                             t=time)

            rotY = rotY + .25
            rotX = rotX + .25
            rotZ = rotZ + .25
            aX = aX + 2.6
            centerR = centerR + .5

            time = time + 1

        for c in range(47):
            cmds.setKeyframe('spaceDoor',
                             attribute='rotateY',
                             value=doorRot,
                             t=time2)
            time2 = time2 + 1
            doorRot = doorRot - 1.5

        for k in range(105):
            cmds.setKeyframe('SpaceShip1',
                             attribute='translateX',
                             value=moveX,
                             t=time2)
            moveX = moveX - 1.92
            time2 = time2 + 1

        for j in range(47):
            cmds.setKeyframe('spaceDoor',
                             attribute='rotateY',
                             value=doorRot,
                             t=time2)
            time2 = time2 + 1
            doorRot = doorRot + 1.5

        for i in range(500):
            cmds.setKeyframe('Beam', attribute='visibility', value=1, t=time)
            cmds.setKeyframe('SpaceShip1',
                             attribute='translateX',
                             value=moveX,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='translateX',
                             value=aX,
                             t=time)
            cmds.setKeyframe('group',
                             attribute='rotateY',
                             value=centerR,
                             t=time)

            centerR = centerR + .5
            aX = aX - 1.92
            moveX = moveX - 1.92

            time = time + 1

        for i in range(350):
            cmds.setKeyframe('Beam', attribute='visibility', value=0, t=time)
            cmds.setKeyframe('asteroid',
                             attribute='translateX',
                             value=aX,
                             t=time)
            cmds.setKeyframe('group',
                             attribute='rotateY',
                             value=centerR,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='rotateY',
                             value=rotY,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='rotateX',
                             value=rotX,
                             t=time)
            cmds.setKeyframe('asteroid',
                             attribute='rotateZ',
                             value=rotZ,
                             t=time)

            centerR = centerR + .5
            aX = aX - 1.92

            time = time + 1
Exemplo n.º 5
0
    def _handleExitSceneButton(self):
        #Rotate Y angles
        angleWheel = 0;
        angleSolarPanels = 0
        angleDoor = 0
        angleEVE = 180.0
        angleArmLeft = -15;
        angleArmRight = 15;
        angleHead = 90

        #Translate Z values
        moveEVEz = .197

        #Translate Y values
        moveHeady = 2.965
        moveEVEy = 2.34

        cmds.camera()
        cmds.select('camera1')
        cmds.move(-1.186, 2.441, 2.849, relative=True)
        cmds.rotate(1.8, -27.2, 0)

        cmds.camera()
        cmds.select('camera2')
        cmds.move(0.25, 4.5, 15, relative=True)
        cmds.rotate(-10, -2, 0)

        cmds.camera()
        cmds.select('camera3')
        cmds.move(0.083, 8.809, 4.579, relative=True)
        cmds.rotate(-49.2, -10, 0)

        cmds.camera()
        cmds.select('camera4')
        cmds.move(-18.709, 15.459, -20.347, relative=True)
        cmds.rotate(-24, -151.6, 0)


        #cmds.aimConstraint('EVE', 'camera1')

        cmds.move(.186,2.34,.197,'EVE')
        for i in range (360):
            cmds.setKeyframe('station1:Wheel', attribute='rotateY', value=angleWheel, t=i)
            angleWheel+=.5
            cmds.setKeyframe('station1:SolarPanels', attribute='rotateY', value=angleSolarPanels, t=i)
            angleSolarPanels+=.5
            if (i <= 72):
                cmds.setKeyframe('station1:spaceDoor', attribute='rotateY', value=angleDoor, t=i)
                angleDoor -= (120/70);
            if(i <= 72):
                cmds.setKeyframe('EVE', attribute='rotateY', value=angleEVE, t=i)
                angleEVE += (180.0/72.0)
            if(i > 72 and i < (72 + 48)):
                cmds.setKeyframe('head_base', attribute='translateY', value=moveHeady, t=i)
                cmds.setKeyframe('arm_left', attribute='rotateX', value=angleArmLeft, t=i)
                cmds.setKeyframe('arm_right', attribute='rotateX', value=angleArmRight, t=i)
                moveEVEz += (.757-.197)/(48.0)
                if(i <= (72 + 24)):
                    angleArmRight += (24/15)
                    angleArmLeft -= (24/15)
                    cmds.setKeyframe('EVE', attribute='translateZ', value=moveEVEz, t=i)
                    moveHeady += ((3.194-2.965)/24)

                if(i > (72 + 24)):
                    angleArmRight -= (24/15)
                    angleArmLeft += (24/15)
                    cmds.setKeyframe('EVE', attribute='translateZ', value=moveEVEz, t=i)
                    moveHeady -= ((3.194-2.965)/24)
            if(i > (120) and i < (120+48)):
                if(i <= (120 + 24)):
                    angleHead -= (90-15)/24
                    cmds.setKeyframe('head_base', attribute='rotateY', value=angleHead, t=i)
                if( i > 144):
                    angleHead += (90+30)/(24)
                    cmds.setKeyframe('head_base', attribute='rotateY', value=angleHead, t=i)
                    if(i > (168-12)):
                        moveEVEz += ((1.709-.745)/2)/48
                        cmds.setKeyframe('EVE', attribute='translateZ', value=moveEVEz, t=i)
            if(i > 168 and i < (168+48)):
                if(i < 168 + 24):
                    angleHead -= (30/24)
                    cmds.setKeyframe('head_base', attribute='rotateY', value=angleHead, t=i)
                    cmds.setKeyframe('EVE', attribute='rotateY', value=angleEVE, t=i)
                if(i <= 206):
                    cmds.setKeyframe('station1:spaceDoor', attribute='rotateY', value=angleDoor, t=i)
                    angleDoor += (120/48);
                moveEVEz += ((1.709-.745)/2)/48.0
                cmds.setKeyframe('EVE', attribute='translateZ', value=moveEVEz, t=i)
                angleEVE += (720.0/48.0)
                moveEVEy += (3.094-2.965)/48.0
                cmds.setKeyframe('EVE', attribute='translateY', value=moveEVEy, t=i)
            if(i > 216):
                if(i < 270):
                     cmds.setKeyframe('EVE', attribute='translateY', value=angleHead, t=i)
                     angleHead += (700/48)
                cmds.setKeyframe('EVE', attribute='translateY', value = moveEVEy, t=i )
                cmds.setKeyframe('EVE', attribute='rotateY', value = angleEVE, t=i )
                moveEVEy += (11.0-2.466)/(360-216) + .01
Exemplo n.º 6
0
    def _handleExampleButton(self):
        """
        This callback creates a polygonal cylinder in the Maya scene.

        """
        # r = 50
        # a = 2.0*r
        # y = (0, 1, 0)
        # c = cmds.polyCylinder(
        #     r=r, h=5, sx=40, sy=1, sz=1, ax=y, rcp=0, cuv=2, ch=1, n='exampleCylinder')[0]
        # cmds.select(c)
        # response = nimble.createRemoteResponse(globals())
        # response.put('name', c)
        self.outputLabel.setText("Total animation keyframes:   PROCESSING")
        print("Total animation keyframes:   PROCESSING")
        height = self.heightBox.value()
        stepSize = self.stepSizeBox.value()
        originalStepSize = stepSize
        cmds.select('EVE')
        #height = 25.0
        numTwirls = 2.5
        interval = height / numTwirls
        currentHeight = -20.0
        rotateAngle = 0.0
        #stepSize = .02
        count = 0;
        cmds.setAttr('EVE.rotateY', 0.0)
        armliftAngleR = 0.0
        armliftAngleL = 0.0

        cmds.camera()
        cmds.select('camera1')
        cmds.move(12.0, 10.0, 10.0, relative=True)
        cmds.aimConstraint('EVE', 'camera1', offset=(0, -90, 0))

        while(currentHeight <= height):
            # cmds.setAttr('EVE.rotateY', rotateAngle)
            if(currentHeight >= 1*(height/2)):
                stepSize = (originalStepSize * 3.0)/4.0
                rotateAngle = rotateAngle + 5
                if(armliftAngleL >= -50.0 and armliftAngleR <= 50):
                    armliftAngleL -= 1
                    armliftAngleR += 1

            # print("**left arm angle: " + str(armliftAngleL))
            # print("**right arm angle: " + str(armliftAngleR))
            cmds.setKeyframe('arm_left', attribute='rotateX', value=armliftAngleL, t=count)
            cmds.setKeyframe('arm_right', attribute='rotateX', value=armliftAngleR, t=count)
            cmds.setKeyframe('EVE', attribute='translateY', value = currentHeight, t=count )
            cmds.setKeyframe('EVE', attribute='rotateY', value = rotateAngle, t=count )
            if(currentHeight < 1*(height/2)):
                rotateAngle = rotateAngle + 1
            #print("Keyframe i: " + str(count) + " Rotate angle: " + str(rotateAngle))
            #cmds.setAttr('EVE.translateY', currentHeight)
            currentHeight += stepSize
            count += 1
            print("Step size: " + str(stepSize))
            print("Current height: " + str(currentHeight))
        for i in range (360/4):
            rotateAngle = rotateAngle + 3
            cmds.setKeyframe('EVE', attribute='rotateY', value = rotateAngle, t=count )
            count += 1
        stepSize = ((originalStepSize * 3.0)/4.0)/2
        while(currentHeight >= 0):
            # cmds.setAttr('EVE.rotateY', rotateAngle)
            # if(armliftAngleL <=0 and armliftAngleR >= 0):
            #         armliftAngleL += 2
            #         armliftAngleR -= 2
            # print("**left arm angle: " + str(armliftAngleL))
            # print("**right arm angle: " + str(armliftAngleR))
            cmds.setKeyframe('arm_left', attribute='rotateX', value=armliftAngleL, t=count)
            cmds.setKeyframe('arm_right', attribute='rotateX', value=armliftAngleR, t=count)
            cmds.setKeyframe('EVE', attribute='translateY', value = currentHeight, t=count )
            cmds.setKeyframe('EVE', attribute='rotateY', value = rotateAngle, t=count )
            rotateAngle = rotateAngle + 1
            #print("Keyframe i: " + str(count) + " Rotate angle: " + str(rotateAngle))
            #cmds.setAttr('EVE.translateY', currentHeight)
            currentHeight -= stepSize
            count += 1
            print("Step size: " + str(stepSize))
            print("Current height: " + str(currentHeight))
        self.outputLabel.setText("Total animation keyframes:   " + str(count))
        print("Height: " + str(height))
        print("Step size: " + str(stepSize))
        print('Total key frames created: ' + str(count))
Exemplo n.º 7
0
    def _handleExitSceneButton(self):
        #Rotate Y angles
        angleWheel = 0
        angleSolarPanels = 0
        angleDoor = 0
        angleEVE = 180.0
        angleArmLeft = -15
        angleArmRight = 15
        angleHead = 90

        #Translate Z values
        moveEVEz = .197

        #Translate Y values
        moveHeady = 2.965
        moveEVEy = 2.34

        cmds.camera()
        cmds.select('camera1')
        cmds.move(-1.186, 2.441, 2.849, relative=True)
        cmds.rotate(1.8, -27.2, 0)

        cmds.camera()
        cmds.select('camera2')
        cmds.move(0.25, 4.5, 15, relative=True)
        cmds.rotate(-10, -2, 0)

        cmds.camera()
        cmds.select('camera3')
        cmds.move(0.083, 8.809, 4.579, relative=True)
        cmds.rotate(-49.2, -10, 0)

        cmds.camera()
        cmds.select('camera4')
        cmds.move(-18.709, 15.459, -20.347, relative=True)
        cmds.rotate(-24, -151.6, 0)

        #cmds.aimConstraint('EVE', 'camera1')

        cmds.move(.186, 2.34, .197, 'EVE')
        for i in range(360):
            cmds.setKeyframe('station1:Wheel',
                             attribute='rotateY',
                             value=angleWheel,
                             t=i)
            angleWheel += .5
            cmds.setKeyframe('station1:SolarPanels',
                             attribute='rotateY',
                             value=angleSolarPanels,
                             t=i)
            angleSolarPanels += .5
            if (i <= 72):
                cmds.setKeyframe('station1:spaceDoor',
                                 attribute='rotateY',
                                 value=angleDoor,
                                 t=i)
                angleDoor -= (120 / 70)
            if (i <= 72):
                cmds.setKeyframe('EVE',
                                 attribute='rotateY',
                                 value=angleEVE,
                                 t=i)
                angleEVE += (180.0 / 72.0)
            if (i > 72 and i < (72 + 48)):
                cmds.setKeyframe('head_base',
                                 attribute='translateY',
                                 value=moveHeady,
                                 t=i)
                cmds.setKeyframe('arm_left',
                                 attribute='rotateX',
                                 value=angleArmLeft,
                                 t=i)
                cmds.setKeyframe('arm_right',
                                 attribute='rotateX',
                                 value=angleArmRight,
                                 t=i)
                moveEVEz += (.757 - .197) / (48.0)
                if (i <= (72 + 24)):
                    angleArmRight += (24 / 15)
                    angleArmLeft -= (24 / 15)
                    cmds.setKeyframe('EVE',
                                     attribute='translateZ',
                                     value=moveEVEz,
                                     t=i)
                    moveHeady += ((3.194 - 2.965) / 24)

                if (i > (72 + 24)):
                    angleArmRight -= (24 / 15)
                    angleArmLeft += (24 / 15)
                    cmds.setKeyframe('EVE',
                                     attribute='translateZ',
                                     value=moveEVEz,
                                     t=i)
                    moveHeady -= ((3.194 - 2.965) / 24)
            if (i > (120) and i < (120 + 48)):
                if (i <= (120 + 24)):
                    angleHead -= (90 - 15) / 24
                    cmds.setKeyframe('head_base',
                                     attribute='rotateY',
                                     value=angleHead,
                                     t=i)
                if (i > 144):
                    angleHead += (90 + 30) / (24)
                    cmds.setKeyframe('head_base',
                                     attribute='rotateY',
                                     value=angleHead,
                                     t=i)
                    if (i > (168 - 12)):
                        moveEVEz += ((1.709 - .745) / 2) / 48
                        cmds.setKeyframe('EVE',
                                         attribute='translateZ',
                                         value=moveEVEz,
                                         t=i)
            if (i > 168 and i < (168 + 48)):
                if (i < 168 + 24):
                    angleHead -= (30 / 24)
                    cmds.setKeyframe('head_base',
                                     attribute='rotateY',
                                     value=angleHead,
                                     t=i)
                    cmds.setKeyframe('EVE',
                                     attribute='rotateY',
                                     value=angleEVE,
                                     t=i)
                if (i <= 206):
                    cmds.setKeyframe('station1:spaceDoor',
                                     attribute='rotateY',
                                     value=angleDoor,
                                     t=i)
                    angleDoor += (120 / 48)
                moveEVEz += ((1.709 - .745) / 2) / 48.0
                cmds.setKeyframe('EVE',
                                 attribute='translateZ',
                                 value=moveEVEz,
                                 t=i)
                angleEVE += (720.0 / 48.0)
                moveEVEy += (3.094 - 2.965) / 48.0
                cmds.setKeyframe('EVE',
                                 attribute='translateY',
                                 value=moveEVEy,
                                 t=i)
            if (i > 216):
                if (i < 270):
                    cmds.setKeyframe('EVE',
                                     attribute='translateY',
                                     value=angleHead,
                                     t=i)
                    angleHead += (700 / 48)
                cmds.setKeyframe('EVE',
                                 attribute='translateY',
                                 value=moveEVEy,
                                 t=i)
                cmds.setKeyframe('EVE',
                                 attribute='rotateY',
                                 value=angleEVE,
                                 t=i)
                moveEVEy += (11.0 - 2.466) / (360 - 216) + .01
Exemplo n.º 8
0
    def _handleExampleButton(self):
        """
        This callback creates a polygonal cylinder in the Maya scene.

        """
        # r = 50
        # a = 2.0*r
        # y = (0, 1, 0)
        # c = cmds.polyCylinder(
        #     r=r, h=5, sx=40, sy=1, sz=1, ax=y, rcp=0, cuv=2, ch=1, n='exampleCylinder')[0]
        # cmds.select(c)
        # response = nimble.createRemoteResponse(globals())
        # response.put('name', c)
        self.outputLabel.setText("Total animation keyframes:   PROCESSING")
        print("Total animation keyframes:   PROCESSING")
        height = self.heightBox.value()
        stepSize = self.stepSizeBox.value()
        originalStepSize = stepSize
        cmds.select('EVE')
        #height = 25.0
        numTwirls = 2.5
        interval = height / numTwirls
        currentHeight = -20.0
        rotateAngle = 0.0
        #stepSize = .02
        count = 0
        cmds.setAttr('EVE.rotateY', 0.0)
        armliftAngleR = 0.0
        armliftAngleL = 0.0

        cmds.camera()
        cmds.select('camera1')
        cmds.move(12.0, 10.0, 10.0, relative=True)
        cmds.aimConstraint('EVE', 'camera1', offset=(0, -90, 0))

        while (currentHeight <= height):
            # cmds.setAttr('EVE.rotateY', rotateAngle)
            if (currentHeight >= 1 * (height / 2)):
                stepSize = (originalStepSize * 3.0) / 4.0
                rotateAngle = rotateAngle + 5
                if (armliftAngleL >= -50.0 and armliftAngleR <= 50):
                    armliftAngleL -= 1
                    armliftAngleR += 1

            # print("**left arm angle: " + str(armliftAngleL))
            # print("**right arm angle: " + str(armliftAngleR))
            cmds.setKeyframe('arm_left',
                             attribute='rotateX',
                             value=armliftAngleL,
                             t=count)
            cmds.setKeyframe('arm_right',
                             attribute='rotateX',
                             value=armliftAngleR,
                             t=count)
            cmds.setKeyframe('EVE',
                             attribute='translateY',
                             value=currentHeight,
                             t=count)
            cmds.setKeyframe('EVE',
                             attribute='rotateY',
                             value=rotateAngle,
                             t=count)
            if (currentHeight < 1 * (height / 2)):
                rotateAngle = rotateAngle + 1
            #print("Keyframe i: " + str(count) + " Rotate angle: " + str(rotateAngle))
            #cmds.setAttr('EVE.translateY', currentHeight)
            currentHeight += stepSize
            count += 1
            print("Step size: " + str(stepSize))
            print("Current height: " + str(currentHeight))
        for i in range(360 / 4):
            rotateAngle = rotateAngle + 3
            cmds.setKeyframe('EVE',
                             attribute='rotateY',
                             value=rotateAngle,
                             t=count)
            count += 1
        stepSize = ((originalStepSize * 3.0) / 4.0) / 2
        while (currentHeight >= 0):
            # cmds.setAttr('EVE.rotateY', rotateAngle)
            # if(armliftAngleL <=0 and armliftAngleR >= 0):
            #         armliftAngleL += 2
            #         armliftAngleR -= 2
            # print("**left arm angle: " + str(armliftAngleL))
            # print("**right arm angle: " + str(armliftAngleR))
            cmds.setKeyframe('arm_left',
                             attribute='rotateX',
                             value=armliftAngleL,
                             t=count)
            cmds.setKeyframe('arm_right',
                             attribute='rotateX',
                             value=armliftAngleR,
                             t=count)
            cmds.setKeyframe('EVE',
                             attribute='translateY',
                             value=currentHeight,
                             t=count)
            cmds.setKeyframe('EVE',
                             attribute='rotateY',
                             value=rotateAngle,
                             t=count)
            rotateAngle = rotateAngle + 1
            #print("Keyframe i: " + str(count) + " Rotate angle: " + str(rotateAngle))
            #cmds.setAttr('EVE.translateY', currentHeight)
            currentHeight -= stepSize
            count += 1
            print("Step size: " + str(stepSize))
            print("Current height: " + str(currentHeight))
        self.outputLabel.setText("Total animation keyframes:   " + str(count))
        print("Height: " + str(height))
        print("Step size: " + str(stepSize))
        print('Total key frames created: ' + str(count))