def runPreSubmission(self): ''' Override the base class (which is an empty stub method) so that a validation pre-process can be run. If validation fails, then indicate that the the submission process should be aborted. We also collect dependencies (and asds) at this point and pass that data along... In order to validate the submission, dependencies must be collected and inspected. Because we don't want to unnessarily collect dependencies again (after validation succeeds), we also pass the depenencies along in the returned dictionary (so that we don't need to collect them again). ''' # Check if script has unsaved changes and ask user if they'd like to # save their script before continuing with submission # NOTE: The option of 'No' has a value of 2, and would # be the fall-through value here (i.e. continue without # doing anything). save_dialog_result = self.checkSaveBeforeSubmission() if not save_dialog_result: raise exceptions.UserCanceledError() elif save_dialog_result == 1: nuke_utils.save_current_nuke_script() # Get the write nodes that have been selected by the user (in the UI) write_nodes = self.extended_widget.getSelectedWriteNodes() if not write_nodes: message = "No Write nodes selected for rendering!\nPlease select at least one Write node from the UI before pressing Submit" pyside_utils.launch_error_box("No Write nodes selected!", message, parent=self) raise Exception(message) # Get the applicable views views = self.extended_widget.getSelectedViews() if not views: message = "No views selected for rendering!\nPlease select at least one view from the UI before pressing Submit" pyside_utils.launch_error_box("No views selected!", message, parent=self) raise Exception(message) raw_dependencies = self.collectDependencies(write_nodes, views) # If uploading locally (i.e. not using uploader daemon if self.getLocalUpload(): # Don't need to enforce md5s for the daemon (don't want to do unnessary md5 hashing here) enforced_md5s = {} else: # Get all files that we want to have integrity enforcement when uploading via the daemon enforced_md5s = self.getEnforcedMd5s() # add md5 enforced files to dependencies. In theory these should already be included in the raw_dependencies, but let's cover our bases raw_dependencies.extend(enforced_md5s.keys()) dependencies = file_utils.process_dependencies(raw_dependencies) output_path, write_paths = self.getOutputPath() raw_data = { "dependencies": dependencies, "output_path": [output_path, write_paths] } is_valid = self.runValidation(raw_data) return { "abort": not is_valid, "dependencies": dependencies, "output_path": output_path, "enforced_md5s": enforced_md5s }
def runPreSubmission(self): ''' Override the base class (which is an empty stub method) so that a validation pre-process can be run. If validation fails, then indicate that the the submission process should be aborted. We also collect dependencies at this point and pass that data along... In order to validate the submission, dependencies must be collected and inspected. Because we don't want to unnessarily collect dependencies again (after validation succeeds), we also pass the depenencies along in the returned dictionary (so that we don't need to collect them again). ''' # Check if scene has unsaved changes and ask user if they'd like to # save their scene before continuing with submission # NOTE: The option of 'No' has a value of 2, and would # be the fall-through value here (i.e. continue without # doing anything). save_dialog_result = self.checkSaveBeforeSubmission() if not save_dialog_result: raise exceptions.UserCanceledError() elif save_dialog_result == 1: maya_utils.save_current_maya_scene() # TODO(lws): This try/except should be moved up to the parent-class so # that there's a clear control flow. This work has actually been done in # another branch...that will hopefully go out one day. try: raw_dependencies = self.collectDependencies() except: title = "Failed to collect dependencies" message = "".join(traceback.format_exception(*sys.exc_info())) pyside_utils.launch_error_box(title, message, self) raise # If uploading locally (i.e. not using uploader daemon if self.getLocalUpload(): # Don't need to enforce md5s for the daemon (don't want to do unnessary md5 hashing here) enforced_md5s = {} else: # Get all files that we want to have integrity enforcement when uploading via the daemon enforced_md5s = self.getEnforcedMd5s() # add md5 enforced files to dependencies. In theory these should already be included in the raw_dependencies, but let's cover our bases raw_dependencies.extend(enforced_md5s.keys()) # Process all of the dependendencies. This will create a dictionary of dependencies, and whether they are considred Valid or not (bool) dependencies = file_utils.process_dependencies(raw_dependencies) # If the renderer is arnold and "use .tx files is enabled", then add corresponding tx files. # TODO:(lws) This process shouldn't happen here. We can't keep tacking on things for random # software-specific behavior. We're going to need start seperating behavior via classes (perhaps # one for each renderer type?) if maya_utils.is_arnold_renderer() and maya_utils.is_arnold_tx_enabled(): tx_filepaths = file_utils.get_tx_paths(dependencies.keys(), existing_only=True) processed_tx_filepaths = file_utils.process_dependencies(tx_filepaths) dependencies.update(processed_tx_filepaths) raw_data = {"dependencies": dependencies} is_valid = self.runValidation(raw_data) return {"abort": not is_valid, "dependencies": dependencies, "enforced_md5s": enforced_md5s}