Beispiel #1
0
 def _prepare(self):
     body_mode = state.get('body_mode')
     if body_mode is BodyMode.PLAYBACK:
         self._threashold = len(setting.get_working_camera_ids())
         for camera_id in setting.get_working_camera_ids():
             state.on_changed(f'pixmap_{camera_id}', self._loaded)
         if state.get('closeup_camera'):
             state.on_changed('pixmap_closeup', self._loaded)
             self._threashold += 1
     elif body_mode is BodyMode.MODEL:
         state.on_changed('tick_update_geo', self._notify)
Beispiel #2
0
 def __init__(self, shot_id, frame, path):
     self._shot_id = shot_id
     self._frame = frame
     self._path = path
     self._cameras = {
         camera: False for camera in setting.get_working_camera_ids()
     }
Beispiel #3
0
 def _build_camera_proxies(self):
     """藉由 setting.get_working_camera_ids 創建相機 proxy 列表"""
     camera_list = {}
     for camera_id in setting.get_working_camera_ids():
         camera_list[camera_id] = CameraProxy(
             camera_id,
             self._on_state_changed
         )
     return camera_list
Beispiel #4
0
 def _request_camera_status(self):
     message_manager.send_message(
         MessageType.CAMERA_STATUS,
         {
             'calibrate_frame': self._camera_list[
                 setting.get_working_camera_ids()[0]
             ].current_frame
         }
     )
Beispiel #5
0
 def _prepare(self):
     body_mode = state.get('body_mode')
     if body_mode is BodyMode.PLAYBACK:
         for camera_id in setting.get_working_camera_ids():
             state.on_changed(f'pixmap_{camera_id}', self.increase)
         if state.get('closeup_camera'):
             state.on_changed('pixmap_closeup', self.increase)
     elif body_mode is BodyMode.MODEL:
         state.on_changed('opengl_data', self.increase)
Beispiel #6
0
    def _generate_camera_views(self):
        set_resize_leader = True
        for camera_id in setting.get_working_camera_ids():
            camera_number = setting.get_camera_number_by_id(camera_id)

            camera_view = CameraView(camera_number,
                                     camera_id,
                                     resize_leader=set_resize_leader)

            if set_resize_leader:
                set_resize_leader = False

            self._camera_views.append(camera_view)
Beispiel #7
0
    def __init__(self, collector, shot, name, frames, parameters):
        super().__init__(collector, shot.get_id())
        self._shot = shot
        self._name = name
        self._frames = frames  # 影格範圍
        self._parameters = parameters
        self._progress_list = {}  # 進度表{相機ID: 進度(0~1)}
        self._complete_check_list = {}

        # 先建立對應表
        for camera_id in setting.get_working_camera_ids():
            self._progress_list[camera_id] = 0
            self._complete_check_list[camera_id] = False
Beispiel #8
0
    def _get_total_progress(self):
        shot = state.get('current_shot')
        body_mode = state.get('body_mode')
        if body_mode is BodyMode.PLAYBACK:
            count = len(setting.get_working_camera_ids())

            if state.get('closeup_camera'):
                count += 1

            return (
                shot.frame_range[1] - shot.frame_range[0] + 1
            ) * count
        elif body_mode is BodyMode.MODEL:
            return len(state.get('frames'))
Beispiel #9
0
    def _change_closeup(self, step):
        closeup_camera = state.get('closeup_camera')
        if closeup_camera is None:
            return

        camera_ids = setting.get_working_camera_ids()
        idx = camera_ids.index(closeup_camera)
        idx += step

        if idx >= len(camera_ids):
            idx = 0
        elif idx < 0:
            idx = len(camera_ids) - 1

        state.set('closeup_camera', camera_ids[idx])
Beispiel #10
0
    def update_cache_progress(self, camera_pixmap):
        self._memory += camera_pixmap.get_size()

        if camera_pixmap.get_cache_type() is CameraCacheType.THUMBNAIL:
            thumb_origin = self._cache_progress[CameraCacheType.THUMBNAIL]
            unit = 1 / len(setting.get_working_camera_ids())
            if camera_pixmap.frame not in thumb_origin:
                thumb_origin[camera_pixmap.frame] = unit
            else:
                thumb_origin[camera_pixmap.frame] += unit
        else:
            camera_id = camera_pixmap.camera_id
            progress_origin = self._cache_progress[CameraCacheType.ORIGINAL]
            if camera_id not in progress_origin:
                progress_origin[camera_id] = []

            progress_origin[camera_id].append(camera_pixmap.frame)

        self.emit(EntityEvent.PROGRESS, self)
Beispiel #11
0
 def __init__(self, parent, job_name, job_frames, job_parms):
     camera_count = len(setting.get_working_camera_ids())
     super().__init__(parent, 'Submitting', len(job_frames) * camera_count)
     self._job_name = job_name
     self._job_frames = job_frames
     self._job_parms = job_parms
Beispiel #12
0
    def _build_state(self):
        # ui
        self._state['status'] = {'slaves': 0, 'bias': 0.0, 'frames': -1}
        self._state['body_mode'] = BodyMode.LIVEVIEW
        self._state['closeup_camera'] = None
        self._state['project_list_dialog'] = False
        self._state['project_list_select'] = None
        self._state['project_new_dialog'] = False
        self._state['shot_new_dialog'] = False
        self._state['is_cali'] = False
        self._state['live_view_size'] = 150
        self._state['caching'] = False
        self._state['key'] = None
        self._state['second_screen'] = False

        # projects
        self._state['deadline_status'] = False
        self._state['current_project'] = None
        self._state['projects'] = []

        # shots
        self._state['current_shot'] = None
        self._state['shots'] = []

        # jobs
        self._state['current_job'] = None
        self._state['jobs'] = []
        self._state['cali_list'] = []

        # parameter
        for key, parm in setting.camera_parameters.items():
            self._state[key] = parm['default']
        self._state['parm_outside'] = False

        # playbar
        self._state['current_slider_value'] = 0
        self._state['frames'] = []
        self._state['offset_frame'] = 0
        self._state['playing'] = False
        self._state['crop_range'] = [None, None]
        self._state['loop_range'] = [None, None]

        # support
        self._state['Calibrate'] = False
        self._state['Focus'] = False
        self._state['Serial'] = False
        self._state['Crop'] = False
        self._state['Rig'] = False
        self._state['Wireframe'] = False
        self._state['Loop'] = False

        # pixmap
        for camera_id in setting.get_working_camera_ids():
            self._state[f'pixmap_{camera_id}'] = None
        self._state['pixmap_closeup'] = None
        self._state['tick_submit'] = None

        # model
        self._state['opengl_data'] = None
        self._state['tick_export'] = None
        self._state['tick_update_geo'] = None
        self._state['screenshot_export_path'] = None

        # camera
        self._state['trigger'] = False
        self._state['live_view'] = False
        self._state['recording'] = False

        # arduino
        self._state['has_arduino'] = False
Beispiel #13
0
 def _summarize_condition(self):
     """總結條件,當報告等於相機數量時 /dev"""
     return len(self._reports) == len(setting.get_working_camera_ids())