Beispiel #1
0
 def test_get_selected_cameras(self):
     tfm = maya.cmds.createNode('transform')
     shp = maya.cmds.createNode('camera', parent=tfm)
     maya.cmds.select(tfm, replace=True)
     cameras = lib_utils.get_selected_cameras()
     assert len(cameras) == 1
     return
    def populateUi(self):
        all_camera_nodes = lib.get_cameras()
        selected_cameras = lib.get_selected_cameras()
        active_camera = lib.get_active_viewport_camera()
        self.updateCameraList(
            self.camera_comboBox,
            self.camera_model,
            all_camera_nodes,
            selected_cameras,
            active_camera
        )
        active_camera = self.getCameraData()
        mkr_grp_nodes = lib.get_marker_groups(active_camera)
        active_mkr_grp = None
        self.updateMarkerGroupList(
            self.markerGroup_comboBox,
            self.markerGroup_model,
            active_mkr_grp,
            mkr_grp_nodes
        )

        value = const.LOAD_MODE_DEFAULT_VALUE
        self.populateLoadModeModel(self.loadMode_model)
        index = self.loadMode_model.stringList().index(value)
        self.loadMode_comboBox.setCurrentIndex(index)

        value = const.DISTORTION_MODE_DEFAULT_VALUE
        self.populateDistortionModeModel(self.distortionMode_model)
        index = self.distortionMode_model.stringList().index(value)
        self.distortionMode_comboBox.setCurrentIndex(index)
        return
Beispiel #3
0
 def cameraUpdateClicked(self):
     all_camera_nodes = lib.get_cameras()
     selected_cameras = lib.get_selected_cameras()
     active_camera = lib.get_active_viewport_camera()
     self.updateCameraList(self.camera_comboBox, self.camera_model,
                           all_camera_nodes, selected_cameras,
                           active_camera)
     return
Beispiel #4
0
 def populate_ui(self):
     # Add camera items
     all_camera_nodes = cam_lib.get_cameras()
     selected_cameras = cam_lib.get_selected_cameras()
     active_camera = cam_lib.get_active_viewport_camera()
     for cam in all_camera_nodes:
         cam_tfm = cam.get_transform_node()
         self.cameraListComboBox.addItem(str(cam_tfm))
     if active_camera:
         active_camera_tfm = active_camera.get_transform_node()
         for count, cam in enumerate(all_camera_nodes):
             if cam.get_transform_node() == active_camera_tfm:
                 self.cameraListComboBox.setCurrentIndex(count)
                 break
     self.sceneLabel.setEnabled(False)
     self.sceneLineEdit.setEnabled(False)
     self.sceneGetButton.setEnabled(False)
Beispiel #5
0
    def populateUi(self):
        config = get_config()
        self._file_info = None

        w, h = lib.get_default_image_resolution()
        self.imageRes_label.setEnabled(False)
        self.imageResWidth_label.setEnabled(False)
        self.imageResWidth_spinBox.setValue(w)
        self.imageResWidth_spinBox.setEnabled(False)
        self.imageResHeight_label.setEnabled(False)
        self.imageResHeight_spinBox.setValue(h)
        self.imageResHeight_spinBox.setEnabled(False)

        self.fileInfo_plainTextEdit.setReadOnly(True)

        value = get_config_value(
            config,
            'data/load_bundle_position',
            const.LOAD_BUNDLE_POS_DEFAULT_VALUE)
        self.loadBndPositions_checkBox.setChecked(value)

        value = get_config_value(
            config,
            'data/use_overscan',
            const.USE_OVERSCAN_DEFAULT_VALUE)
        self.overscan_checkBox.setChecked(value)

        # Get the file path from the clipboard.
        try:
            clippy = QtGui.QClipboard()
            text = str(clippy.text()).strip()
            if lib.is_valid_file_path(text):
                self.setFilePath(text)
        except Exception as e:
            msg = 'Could not get file path from clipboard.'
            LOG.warning(msg)
            LOG.info(str(e))

        all_camera_nodes = lib.get_cameras()
        selected_cameras = lib.get_selected_cameras()
        active_camera = lib.get_active_viewport_camera()
        self.updateCameraList(
            self.camera_comboBox,
            self.camera_model,
            all_camera_nodes,
            selected_cameras,
            active_camera
        )
        active_camera = self.getCameraData()
        mkr_grp_nodes = lib.get_marker_groups(active_camera)
        active_mkr_grp = None
        self.updateMarkerGroupList(
            self.markerGroup_comboBox,
            self.markerGroup_model,
            active_mkr_grp,
            mkr_grp_nodes
        )

        value = get_config_value(
            config,
            "data/load_mode",
            const.LOAD_MODE_DEFAULT_VALUE
        )
        self.populateLoadModeModel(self.loadMode_model)
        index = self.loadMode_model.stringList().index(value)
        self.loadMode_comboBox.setCurrentIndex(index)

        value = get_config_value(
            config,
            "data/distortion_mode",
            const.DISTORTION_MODE_DEFAULT_VALUE
        )
        self.populateDistortionModeModel(self.distortionMode_model)
        index = self.distortionMode_model.stringList().index(value)
        self.distortionMode_comboBox.setCurrentIndex(index)
        return
Beispiel #6
0
 def populateUi(self):
     # Camera list
     selected_cameras = lib.get_selected_cameras()
     self.updateCameraList(self.camera_comboBox, self.camera_model,
                           selected_cameras)
     return
Beispiel #7
0
 def cameraUpdateClicked(self):
     selected_cameras = lib.get_selected_cameras()
     self.updateCameraList(self.camera_comboBox, self.camera_model,
                           selected_cameras)
     return