Beispiel #1
0
 def test_slice_will_set_the_render_pan_zoom_attribute_of_the_camera(self):
     """testing if calling the slice() method will set the renderPanZoom
     attribute of the camera
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(10, 20)
     self.assertEqual(self.camera.renderPanZoom.get(), True)
Beispiel #2
0
 def test_slice_will_set_the_render_pan_zoom_attribute_of_the_camera(self):
     """testing if calling the slice() method will set the renderPanZoom
     attribute of the camera
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(10, 20)
     self.assertEqual(self.camera.renderPanZoom.get(), True)
Beispiel #3
0
 def test_slice_will_set_the_zoom_attribute_of_the_camera_properly(self):
     """testing if calling the slice() method will set the zoom attribute
     of the camera properly
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(2, 3)
     self.assertAlmostEqual(self.camera.zoom.get(), 0.5)
Beispiel #4
0
 def test_slice_will_set_the_zoom_attribute_of_the_camera_properly(self):
     """testing if calling the slice() method will set the zoom attribute
     of the camera properly
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(2, 3)
     self.assertAlmostEqual(self.camera.zoom.get(), 0.5)
Beispiel #5
0
 def test_slice_will_set_the_vertical_film_aperture_of_the_camera_properly(
         self):
     """testing if calling the slice() method will set the
     verticalFilmAperture attribute of the camera properly
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(2, 3)
     self.assertAlmostEqual(self.camera.verticalFilmAperture.get(),
                            0.7972425)
Beispiel #6
0
 def test_slice_will_set_the_vertical_film_aperture_of_the_camera_properly(self):
     """testing if calling the slice() method will set the
     verticalFilmAperture attribute of the camera properly
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(2, 3)
     self.assertAlmostEqual(
         self.camera.verticalFilmAperture.get(),
         0.7972425
     )
Beispiel #7
0
    def test_unslice_will_set_the_is_sliced_attribute_correctly(self):
        """testing if unslice() method will set the is_sliced attribute\
        correctly
        """
        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        self.assertTrue(rs.is_sliced)

        rs.unslice()
        self.assertFalse(rs.is_sliced)
Beispiel #8
0
    def test_unslice_will_set_the_is_sliced_attribute_correctly(self):
        """testing if unslice() method will set the is_sliced attribute\
        correctly
        """
        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        self.assertTrue(rs.is_sliced)

        rs.unslice()
        self.assertFalse(rs.is_sliced)
Beispiel #9
0
    def test_slice_will_create_data_attributes_on_camera(self):
        """testing if calling the slice() method will create the data
        attributes on the camera
        """
        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 20)

        self.assertTrue(rs.camera.hasAttr('isSliced'))
        self.assertTrue(rs.camera.hasAttr('nonSlicedResolutionX'))
        self.assertTrue(rs.camera.hasAttr('nonSlicedResolutionY'))
        self.assertTrue(rs.camera.hasAttr('slicesInX'))
        self.assertTrue(rs.camera.hasAttr('slicesInY'))
Beispiel #10
0
 def test_slice_will_set_the_vertical_pan_attribute_of_the_camera_properly(
         self):
     """testing if calling the slice() method will set the verticalPan
     attribute of the camera properly
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(2, 3)
     expected_values = [-0.2657475, -0.2657475, 0, 0, 0.2657475, 0.2657475]
     for i in range(6):
         pm.currentTime(i)
         self.assertAlmostEqual(self.camera.verticalPan.get(),
                                expected_values[i])
Beispiel #11
0
    def test_slice_will_create_data_attributes_on_camera(self):
        """testing if calling the slice() method will create the data
        attributes on the camera
        """
        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 20)

        self.assertTrue(rs.camera.hasAttr('isSliced'))
        self.assertTrue(rs.camera.hasAttr('nonSlicedResolutionX'))
        self.assertTrue(rs.camera.hasAttr('nonSlicedResolutionY'))
        self.assertTrue(rs.camera.hasAttr('slicesInX'))
        self.assertTrue(rs.camera.hasAttr('slicesInY'))
Beispiel #12
0
    def test_slice_will_set_the_render_resolution(self):
        """testing if calling slice() method will set the render resolution
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 20)

        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 27)
Beispiel #13
0
    def test_slice_will_set_the_render_resolution(self):
        """testing if calling slice() method will set the render resolution
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 20)

        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 27)
Beispiel #14
0
    def test_init_with_a_sliced_camera(self):
        """testing if initializing with a pre-sliced camera will work properly
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(1000)
        dres.height.set(1000)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        rs2 = RenderSlicer(camera=self.camera)
        self.assertEqual(rs2.is_sliced, True)
        self.assertEqual(rs2.slices_in_x, 10)
        self.assertEqual(rs2.slices_in_y, 10)
Beispiel #15
0
    def test_slice_will_set_the_pixel_aspect_to_1(self):
        """testing if the slice() method will set the render pixel aspect to 1
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(1920)
        dres.height.set(1080)
        dres.pixelAspect.set(2.5)

        rs = RenderSlicer(self.camera)
        rs.slice(10, 10)

        self.assertEqual(dres.pixelAspect.get(), 1)
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)
Beispiel #16
0
    def test_slice_will_set_the_pixel_aspect_to_1(self):
        """testing if the slice() method will set the render pixel aspect to 1
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(1920)
        dres.height.set(1080)
        dres.pixelAspect.set(2.5)

        rs = RenderSlicer(self.camera)
        rs.slice(10, 10)

        self.assertEqual(dres.pixelAspect.get(), 1)
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)
Beispiel #17
0
    def test_init_with_a_sliced_camera(self):
        """testing if initializing with a pre-sliced camera will work properly
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(1000)
        dres.height.set(1000)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        rs2 = RenderSlicer(camera=self.camera)
        self.assertEqual(rs2.is_sliced, True)
        self.assertEqual(rs2.slices_in_x, 10)
        self.assertEqual(rs2.slices_in_y, 10)
        # self.assertEqual(rs2.original_resolution, 1000)
Beispiel #18
0
 def test_slice_will_set_the_vertical_pan_attribute_of_the_camera_properly(self):
     """testing if calling the slice() method will set the verticalPan
     attribute of the camera properly
     """
     rs = RenderSlicer(camera=self.camera)
     rs.slice(2, 3)
     expected_values = [
         -0.2657475, -0.2657475, 0, 0, 0.2657475, 0.2657475
     ]
     for i in range(6):
         pm.currentTime(i)
         self.assertAlmostEqual(
             self.camera.verticalPan.get(),
             expected_values[i]
         )
Beispiel #19
0
    def test_unslice_will_restore_original_render_resolution(self):
        """unslice will restore the original render resolution
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        rs.unslice()
        self.assertEqual(dres.width.get(), 960)
        self.assertEqual(dres.height.get(), 540)
Beispiel #20
0
    def test_unslice_will_restore_original_render_resolution(self):
        """unslice will restore the original render resolution
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        rs.unslice()
        self.assertEqual(dres.width.get(), 960)
        self.assertEqual(dres.height.get(), 540)
Beispiel #21
0
    def test_slice_will_work_on_previously_sliced_camera(self):
        """testing if the calling slice() method will also work with a
        previously sliced camera
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)
        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        rs2 = RenderSlicer(camera=self.camera)
        rs2.slice(5, 5)
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)
Beispiel #22
0
    def test_slice_will_work_on_previously_sliced_camera(self):
        """testing if the calling slice() method will also work with a
        previously sliced camera
        """
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)
        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        rs2 = RenderSlicer(camera=self.camera)
        rs2.slice(5, 5)
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)
Beispiel #23
0
    def test_slice_will_set_the_data_attributes_on_camera(self):
        """testing if calling the slice() method will set the data
        attributes properly on camera
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 20)

        self.assertEqual(rs.camera.isSliced.get(), True)
        self.assertEqual(rs.camera.nonSlicedResolutionX.get(), 960)
        self.assertEqual(rs.camera.nonSlicedResolutionY.get(), 540)
        self.assertEqual(rs.camera.slicesInX.get(), 10)
        self.assertEqual(rs.camera.slicesInY.get(), 20)
Beispiel #24
0
    def test_slice_will_set_the_data_attributes_on_camera(self):
        """testing if calling the slice() method will set the data
        attributes properly on camera
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 20)

        self.assertEqual(rs.camera.isSliced.get(), True)
        self.assertEqual(rs.camera.nonSlicedResolutionX.get(), 960)
        self.assertEqual(rs.camera.nonSlicedResolutionY.get(), 540)
        self.assertEqual(rs.camera.slicesInX.get(), 10)
        self.assertEqual(rs.camera.slicesInY.get(), 20)
Beispiel #25
0
    def test_slice_will_un_slice_the_same_camera(self):
        """testing if calling the slice() method will un-slice the camera if
        it is already sliced
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        # check the render resolution
        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        # create a new camera and slice again
        rs2 = RenderSlicer(camera=self.camera)
        rs2.slice(5, 5)

        # check the resolution
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)
Beispiel #26
0
    def test_slice_will_un_slice_the_same_camera(self):
        """testing if calling the slice() method will un-slice the camera if
        it is already sliced
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        # check the render resolution
        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        # create a new camera and slice again
        rs2 = RenderSlicer(camera=self.camera)
        rs2.slice(5, 5)

        # check the resolution
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)
Beispiel #27
0
    def test_slice_will_un_slice_if_the_scene_has_a_silced_camera(self):
        """testing if calling the slice() method will un-slice the scene if
        there is a previously sliced camera
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        # check the render resolution
        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        # create a new camera and slice again
        cam = pm.nt.Camera()
        rs2 = RenderSlicer(camera=cam)
        rs2.slice(5, 5)

        # check the resolution
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)
Beispiel #28
0
    def test_slice_will_un_slice_if_the_scene_has_a_silced_camera(self):
        """testing if calling the slice() method will un-slice the scene if
        there is a previously sliced camera
        """
        # check the scene render resolution first
        dres = pm.PyNode('defaultResolution')
        dres.width.set(960)
        dres.height.set(540)

        rs = RenderSlicer(camera=self.camera)
        rs.slice(10, 10)

        # check the render resolution
        self.assertEqual(dres.width.get(), 96)
        self.assertEqual(dres.height.get(), 54)

        # create a new camera and slice again
        cam = pm.nt.Camera()
        rs2 = RenderSlicer(camera=cam)
        rs2.slice(5, 5)

        # check the resolution
        self.assertEqual(dres.width.get(), 192)
        self.assertEqual(dres.height.get(), 108)