def test_get_scene_name(self): """Check that a untitled file is also named untitled""" import pymel.core as pm pm.newFile(force=True) manager = maya_manager.Maya_Manager() self.assertTrue('untitled' in manager.get_scene_name())
def test_submit(self, check_output_mock): # Tests submission of simple file to deadline import pymel.core as pm pm.openFile(get_resource('test_scene_cube_no_redshift.ma'), force=True) manager = maya_manager.Maya_Manager() manager.job.submit_to_deadline() self.assertTrue(check_output_mock.assert_called)
def test_set_job_value(self): """ Tests if the values are correctly set to the job :return: """ manager = maya_manager.Maya_Manager() #start frame manager.set_job_value('start_frame', 111) self.assertEqual(manager.job.start_frame, 111) #end frame manager.set_job_value('end_frame', 112) self.assertEqual(manager.job.end_frame, 112) #width manager.set_job_value('width', 2560) self.assertEqual(manager.job.width, 2560) #height manager.set_job_value('height', 1440) self.assertEqual(manager.job.height, 1440) #camera manager.set_job_value('camera', 'persp') self.assertEqual(manager.job.camera, 'persp') #dof manager.set_job_value('dof', True) self.assertEqual(manager.job.dof, True) manager.set_job_value('dof', False) self.assertEqual(manager.job.dof, False) #motion blur manager.set_job_value('motion_blur', True) self.assertEqual(manager.job.motion_blur, True) manager.set_job_value('motion_blur', False) self.assertEqual(manager.job.motion_blur, False) #quality manager.set_job_value('quality', 'low') self.assertEqual(manager.job.quality, 'low') #shader_override_type manager.set_job_value('shader_override_type', 4) self.assertEqual(manager.job.shader_override_type, 4) #unsupported parameter with self.assertRaises(Exception): manager.set_job_value('asdfas', 1440)
def test_frame_end_minimal_frame_start(self): """ End frame can not be less that start frame. """ manager = maya_manager.Maya_Manager() manager.set_job_value('start_frame', 10) manager.set_job_value('end_frame', 20) old_end_frame = manager.job.end_frame manager.set_job_value('start_frame', 100) self.assertNotEqual(old_end_frame, manager.job.end_frame) self.assertEqual(manager.job.end_frame, 100)
def test_create(self): """ Tests the creation of a new maya manager """ manager = maya_manager.Maya_Manager() self.assertNotEqual(manager, None) self.assertNotEqual(manager.job.file_path, None) self.assertNotEqual(manager.job.start_frame, None) self.assertNotEqual(manager.job.end_frame, None) self.assertNotEqual(manager.job.width, None) self.assertNotEqual(manager.job.height, None) self.assertNotEqual(manager.job.frame_path, None) self.assertNotEqual(manager.job.movie_path, None) self.assertNotEqual(manager.job.camera, None) self.assertNotEqual(manager.job.dof, None) self.assertNotEqual(manager.job.motion_blur, None) self.assertNotEqual(manager.job.quality, None)
def __init__(self, parent=None): super(Redshift_Playblast_View, self).__init__(parent) # Set object name and window title self.setObjectName(WINDOW_OBJECT) self.setWindowTitle(WINDOW_TITLE) # Window type self.setWindowFlags(QtCore.Qt.Window) # Makes Maya perform magic which makes the window stay # on top in OS X and Linux. As an added bonus, it'll # make Maya remember the window position self.setProperty("saveWindowPref", True) # Filepaths main_window_file = os.path.join(UI_PATH, 'view_maya.ui') # Load UIs self.loadUiWidget(main_window_file) # Main window UI # Set the main widget self.setCentralWidget(self._ui) # Define minimum size of UI self.setMinimumSize(380, 457) self.maya_manager = maya_manager.Maya_Manager() # Signals self.maya_manager.job.data_changed.connect(self.update_view) self._ui.txtStartFrame.textChanged.connect( lambda x: self.maya_manager.set_job_value('start_frame', x)) self._ui.txtEndFrame.textChanged.connect( lambda x: self.maya_manager.set_job_value('end_frame', x)) self._ui.txtWidth.textChanged.connect( lambda x: self.maya_manager.set_job_value('width', x)) self._ui.txtHeight.textChanged.connect( lambda x: self.maya_manager.set_job_value('height', x)) self._ui.cmBxCamera.currentIndexChanged.connect( lambda x: self.maya_manager.set_job_value( 'camera', self._ui.cmBxCamera.currentText())) self._ui.chBxMotionBlur.stateChanged.connect( lambda x: self.maya_manager.set_job_value( 'motion_blur', x == QtCore.Qt.CheckState.Checked)) self._ui.chBxDof.stateChanged.connect( lambda x: self.maya_manager.set_job_value( 'dof', x == QtCore.Qt.CheckState.Checked)) self._ui.cmbxQuality.currentIndexChanged.connect( lambda x: self.maya_manager.set_job_value( 'quality', self._ui.cmbxQuality.currentText())) self._ui.cmbxShaderOverride.currentIndexChanged.connect( lambda x: self.maya_manager.set_job_value( 'shader_override_type', Shader_Override_Type.value(self._ui.cmbxShaderOverride. currentText()))) self._ui.radioRunInMaya.toggled.connect( lambda x: self.maya_manager.set_job_value( 'local_mode', self._ui.radioRunInMaya.isChecked())) self._ui.radioRunOnRenderFarm.toggled.connect( lambda x: self.maya_manager.set_job_value( 'local_mode', self._ui.radioRunInMaya.isChecked())) self._ui.btnCreatePlayblast.clicked.connect( self.maya_manager.create_playblast) self._ui.btnSceneRange.clicked.connect( lambda: self.maya_manager.apply_scene_range()) self._ui.btnRenderSettings.clicked.connect( lambda: self.maya_manager.apply_render_settings_resolution()) self.update_view() #tab order self.setTabOrder(self._ui.txtStartFrame, self._ui.txtEndFrame) self.setTabOrder(self._ui.txtEndFrame, self._ui.txtWidth) self.setTabOrder(self._ui.txtWidth, self._ui.txtHeight) self.setTabOrder(self._ui.txtHeight, self._ui.txtOutput) self.setTabOrder(self._ui.txtOutput, self._ui.btnCreatePlayblast) self.setTabOrder(self._ui.btnCreatePlayblast, self._ui.txtStartFrame)