def _upload_files(self, sg_version, output_path, thumbnail_path, upload_to_shotgun): """ """ # Upload in a new thread and make our own event loop to wait for the # thread to finish. event_loop = QtCore.QEventLoop() thread = UploaderThread(self.__app, sg_version, output_path, thumbnail_path, upload_to_shotgun) thread.finished.connect(event_loop.quit) thread.start() event_loop.exec_() # log any errors generated in the thread for e in thread.get_errors(): self.__app.log_error(e)
def _upload_files(self, sg_version, output_path, thumbnail_path, upload_to_shotgun): """ """ # Upload in a new thread and make our own event loop to wait for the # thread to finish. event_loop = QtCore.QEventLoop() thread = UploaderThread(self.__app, sg_version, output_path, thumbnail_path, upload_to_shotgun) thread.finished.connect(event_loop.quit) thread.start() event_loop.exec_() # log any errors generated in the thread thread_errors = thread.get_errors() if thread_errors: for e in thread_errors: self.__app.log_error(e) # make sure we don't display a success message. TODO: Custom exception? raise Exception('\n'.join(thread_errors))
def _upload_files(self, sg_version, output_path, thumbnail_path): """ Upload the required files to Shotgun. :param dict sg_version: Version to which uploaded files should be linked. :param str output_path: Media to upload to Shotgun. :param str thumbnail_path: Thumbnail to upload to Shotgun. """ # Upload in a new thread and make our own event loop to wait for the # thread to finish. event_loop = QtCore.QEventLoop() thread = UploaderThread(self.__app, sg_version, output_path, thumbnail_path, self._upload_to_shotgun) thread.finished.connect(event_loop.quit) thread.start() event_loop.exec_() # log any errors generated in the thread for e in thread.get_errors(): self.__app.log_error(e)
def _upload_files(self): """Upload the required files to Shotgun. """ # upload in a new thread and make our own event loop to wait for the # thread to finish. event_loop = QtCore.QEventLoop() thread = UploaderThread( self.__app, self.sg_version, self.local_path_to_movie, self.thumbnail_path, self._upload_to_shotgun ) thread.finished.connect(event_loop.quit) thread.start() event_loop.exec_() # log any errors generated in the thread for e in thread.get_errors(): self.__app.log_error(e)
def render_movie_in_nuke(self, path, output_path, width, height, first_frame, last_frame, version, name, color_space, fields=None, active_progress_info=None): """ Renders the movie using a Nuke subprocess, along with slate/burnins using all the app settings. :param path: The path where frames should be found. :param output_path: The path where the movie should be written to :param width: Movie width :param height: Movie height :param first_frame: The first frame of the sequence of frames :param last_frame: The last frame of the sequence of frames :param version: Version currently being published :param name: Name of the file being published :param color_space: Colorspace used to create the frames :param fields: Any additional information to be used in slate/burnins :param active_progress_info: Any function that receives the progress percentage Can be used to update GUI """ # add to information passed for preprocessing fields["first_frame"] = first_frame fields["last_frame"] = last_frame fields["path"] = path # preprocess self._burnin_nk to replace tokens processed_nuke_script_path = self.__app.execute_hook_method( "preprocess_nuke_hook", "get_processed_script", nuke_script_path=self._burnin_nk, fields=fields) render_info = self.gather_nuke_render_info(path, output_path, width, height, first_frame, last_frame, version, name, color_space, processed_nuke_script_path) run_in_batch_mode = True if nuke is None else False event_loop = QtCore.QEventLoop() thread = ShooterThread(render_info, run_in_batch_mode) thread.finished.connect(event_loop.quit) thread.start() event_loop.exec_() # log any errors generated in the thread thread_error_msg = thread.get_errors() if thread_error_msg: self.__app.log_error("ERROR:\n" + thread_error_msg) # Do not clutter user message with any warnings etc from Nuke. Print only traceback. # TODO: is there a better way? try: subproc_traceback = 'Traceback' + thread_error_msg.split( 'Traceback')[1] except IndexError: subproc_traceback = thread_error_msg # Make sure we don't display a success message. TODO: Custom exception? raise Exception("Error in tk-multi-reviewsubmission: " + subproc_traceback)
def render_in_nuke(self, path_to_frames, path_to_movie, extra_write_node_mapping, width, height, first_frame, last_frame, version, name, color_space, fields=None, active_progress_info=None): """ Renders the movie using a Nuke subprocess, along with slate/burnins using all the app settings. :param path_to_frames: The path where frames should be found. :param path_to_movie: The path where the movie should be written to :param extra_write_node_mapping: Mapping of write nodes with their output paths that should be rendered, other than the movie write node :param width: Movie width :param height: Movie height :param first_frame: The first frame of the sequence of frames :param last_frame: The last frame of the sequence of frames :param version: Version currently being published :param name: Name of the file being published :param color_space: Colorspace used to create the frames :param fields: Any additional information to be used in slate/burnins :param active_progress_info: Any function that receives the progress percentage Can be used to update GUI """ # add to information passed for preprocessing fields["first_frame"] = first_frame fields["last_frame"] = last_frame fields["path"] = path_to_frames # preprocess self._burnin_nk to replace tokens processed_nuke_script_path = self.__app.execute_hook_method( "preprocess_nuke_hook", "get_processed_script", nuke_script_path=self._burnin_nk, fields=fields) render_info = self.gather_nuke_render_info( path_to_frames, path_to_movie, extra_write_node_mapping, width, height, first_frame, last_frame, version, name, color_space, processed_nuke_script_path) run_in_batch_mode = True if nuke is None else False event_loop = QtCore.QEventLoop() thread = ShooterThread(render_info, run_in_batch_mode, active_progress_info) thread.finished.connect(event_loop.quit) thread.start() event_loop.exec_() # log any errors generated in the thread thread_error_msg = thread.get_errors() if thread_error_msg: self.__app.log_error("ERROR:\n" + thread_error_msg) # Do not clutter user message with any warnings etc from Nuke. Print only traceback. # TODO: is there a better way? try: subproc_traceback = 'Traceback' + thread_error_msg.split( 'Traceback')[1] except IndexError: subproc_traceback = thread_error_msg # Make sure we don't display a success message. raise NukeSubprocessFailed("Error in tk-multi-reviewsubmission: " + subproc_traceback) processed_paths = thread.get_processed_paths() if not processed_paths: raise NoProcessedPathsReturnedByNukeSubprocess( "Error in tk-multi-reviewsubmission: " "No output paths were returned after the Nuke Render!") else: # in the render hook we expect the thread to return us ':' separated paths # return a list of paths processed_paths_list = processed_paths.split(":") for path_to_frames in processed_paths_list: active_progress_info(msg="Created %s" % path_to_frames, stage={ "item": { "name": "Render" }, "output": { "name": "Nuke" } }) return processed_paths_list