Пример #1
0
    def run(self):
        """ """

        name = self.fetch('name', 'remder')
        directory = self.fetch('directory', '~')
        render_flags = self.fetch('render_flags')

        render_directory = os.path.realpath(directory)
        if not os.path.exists(render_directory):
            os.makedirs(render_directory)

        fd, path = tempfile.mkstemp('nimble-render-save-')
        os.close(fd)

        cmds.file(rename=path)
        cmds.file(force=True, save=True, type='mayaBinary')

        flags = ' '.join(render_flags if render_flags else [])
        os.system(' '.join([
            'Render',
            '-r sw',  # software renderer
            '-rd "{}"'.format(render_directory),
            '-of png',
            '-im "{}"'.format(name),
            flags,
            path
        ]))

        try:
            os.remove(path)
        except Exception:
            pass

        self.put('path', os.path.join(render_directory, '{}.png'.format(name)))
Пример #2
0
def doSecond():
    filePath = "C:/Users/Kyle/Downloads/x_wing/x_wing.mb"

    cmds.file(filePath, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='x_wing', i=True )
    cmds.select('x_wing:polySurface3')
    cmds.scale(.1,.1,.1)
    cmds.move(0,10,10)
    cmds.setKeyframe(time=1)
    cmds.move(0,10,-10)
    cmds.setKeyframe(time=120)
Пример #3
0
def doThird():
    filePath3 = "C:/Users/Kyle/Downloads/hangar2.mb"
    filePath4 = "C:/Users/Kyle/Downloads/tie fighter.mb"
    cmds.file(filePath3,
              type='mayaBinary',
              ra=True,
              mergeNamespacesOnClash=False,
              namespace='hangar2',
              i=True)

    cmds.select('hangar2:pCube2')
    cmds.move(0, 2.872, 0)
    cmds.setKeyframe(time=1)

    cmds.file(filePath4,
              type='mayaBinary',
              ra=True,
              mergeNamespacesOnClash=False,
              namespace='tie fighter',
              i=True)

    cmds.select('tie_fighter:Tie_Droid:polySurface9')
    cmds.scale(.25, .25, .25)
    cmds.move(.8, 5.6, 0)
    cmds.setKeyframe(time=1)
    cmds.move(.8, 5.6, 0)
    cmds.setKeyframe(time=15)
    cmds.move(.8, 5.6, 0)
    cmds.setKeyframe(time=30)
    cmds.move(.8, 3.759, 0)
    cmds.setKeyframe(time=45)
    cmds.rotate(0, 40, 0)
    cmds.setKeyframe(time=65)
    cmds.move(4.765, 3.759, 3.545)
    cmds.setKeyframe(time=90)
    cmds.move(13.514, 3.759, 12.571)
    cmds.setKeyframe(time=120)

    cmds.file(filePath4,
              type='mayaBinary',
              ra=True,
              mergeNamespacesOnClash=False,
              namespace='tie fighter1',
              i=True)

    cmds.select('tie_fighter1:Tie_Droid:polySurface9')
    cmds.scale(.25, .25, .25)
    cmds.move(-.2, 5.6, 0)
    cmds.setKeyframe(time=1)
    cmds.setKeyframe(time=15)
    cmds.move(-.2, 4.377, 0)
    cmds.setKeyframe(time=30)
    cmds.setKeyframe(time=45)
    time.sleep(1)
    cmds.rotate(0, 40, 0)
    time.sleep(1)
    cmds.setKeyframe(time=65)
    cmds.move(3.765, 4.377, 3.545)
    cmds.setKeyframe(time=90)
    cmds.move(12.514, 4.377, 12.571)
    cmds.setKeyframe(time=120)
    time.sleep(1)

    cmds.file(filePath4,
              type='mayaBinary',
              ra=True,
              mergeNamespacesOnClash=False,
              namespace='tie fighter2',
              i=True)

    cmds.select('tie_fighter2:Tie_Droid:polySurface9')
    cmds.scale(.25, .25, .25)
    cmds.move(-1.2, 5.6, 0)
    cmds.setKeyframe(time=1)
    cmds.move(-1.2, 3.729, 0)
    cmds.setKeyframe(time=15)
    cmds.setKeyframe(time=30)
    cmds.setKeyframe(time=45)
    time.sleep(1)
    cmds.rotate(0, 40, 0)
    time.sleep(1)
    cmds.setKeyframe(time=65)
    cmds.move(2.765, 3.729, 3.545)
    cmds.setKeyframe(time=90)
    cmds.move(11.514, 3.729, 12.571)
    cmds.setKeyframe(time=120)
    time.sleep(1)
Пример #4
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()
Пример #5
0
 def create(self):
     cmds.file(self.path + self.name + '.ma', i=True, type=self.type)
Пример #6
0
def doFourth():
    filePath4 = "C:/Users/Kyle/Downloads/tie fighter.mb"
    filePath = "C:/Users/Kyle/Downloads/x_wing/x_wing.mb"

    cmds.file(filePath, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='x_wing', i=True )

    cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter', i=True )
    cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter', i=True )
    cmds.file(filePath4, type='mayaBinary', ra=True, mergeNamespacesOnClash=False, namespace='tie fighter', i=True )

    cmds.select('x_wing:polySurface3')
    cmds.scale(.15,.15,.15)
    cmds.move(0,4,15)
    cmds.setKeyframe(time=1)
    cmds.move(0,4,11.7)
    cmds.rotate(0,-18.6,0)
    cmds.setKeyframe(time=30)
    cmds.move(6.667, 4.803,7.37)
    cmds.rotate(0,36,0)
    cmds.setKeyframe(time=60)
    cmds.move(-2.127, 6.86,-5.277)
    cmds.rotate(26.244,36,0)
    cmds.setKeyframe(time=120)

    cmds.select('tie_fighter:Tie_Droid:polySurface9')
    cmds.move(2,6,5)
    cmds.rotate(0,180,0)
    cmds.setKeyframe(time=1)
    cmds.move(5,6,1.415)
    cmds.rotate(0,156.849,0)
    cmds.setKeyframe(time=30)
    cmds.move(2.309,8.410,-1.272)
    cmds.rotate(0,214,0)
    cmds.setKeyframe(time=60)
    cmds.move(-7.6,8.410,-15.8)
    cmds.rotate(15,211,-27)
    cmds.setKeyframe(time=120)

    cmds.select('tie_fighter1:Tie_Droid:polySurface9')
    cmds.move(0,4,5)
    cmds.rotate(0,180,0)
    cmds.setKeyframe(time=1)
    cmds.move(3.6,4,1.49)
    cmds.rotate(0,153.924,0)
    cmds.setKeyframe(time=30)
    cmds.move(.64,6.118,-.19)
    cmds.rotate(0,212.91,0)
    cmds.setKeyframe(time=60)
    cmds.move(-9.9,6.118,-14.19)
    cmds.rotate(14.932,209.673,-28.310)
    cmds.setKeyframe(time=120)

    cmds.select('tie_fighter2:Tie_Droid:polySurface9')
    cmds.move(4,4,5)
    cmds.rotate(0,180,0)
    cmds.setKeyframe(time=1)
    cmds.move(7.45,4,1)
    cmds.rotate(0,159.3,0)
    cmds.setKeyframe(time=30)
    cmds.move(4,5.92,-2.743)
    cmds.rotate(0,222.231,0)
    cmds.setKeyframe(time=60)
    cmds.move(-6.65,5.92,-17.742)
    cmds.rotate(8,219,-19.8)
    cmds.setKeyframe(time=120)
Пример #7
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
Пример #8
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