def process(self, instance): errored_plugins = get_errored_plugins_from_data(instance.context) if errored_plugins: raise RuntimeError( "Skipping incrementing current file because publishing failed." ) scene_path = version_up(instance.context.data["currentFile"]) photoshop.app().ActiveDocument.SaveAs(scene_path) self.log.info("Incremented workfile to: {}".format(scene_path))
def process(self, instance): errored_plugins = get_errored_plugins_from_data(instance.context) if errored_plugins: raise RuntimeError( "Skipping incrementing current file because publishing failed." ) scene_path = version_up(instance.context.data["currentFile"]) aftereffects.stub().saveAs(scene_path, True) self.log.info("Incremented workfile to: {}".format(scene_path))
def process(self, instance): errored_plugins = get_errored_plugins_from_data(instance.context) if errored_plugins: raise RuntimeError( "Skipping incrementing current file because publishing failed." ) scene_dir = version_up( os.path.dirname(instance.context.data["currentFile"]) ) scene_path = os.path.join( scene_dir, os.path.basename(scene_dir) + ".xstage" ) harmony.save_scene_as(scene_path) self.log.info("Incremented workfile to: {}".format(scene_path))
def process(self, context): from pype.lib import version_up from pype.action import get_errored_plugins_from_data errored_plugins = get_errored_plugins_from_data(context) if any(plugin.__name__ == "FusionSubmitDeadline" for plugin in errored_plugins): raise RuntimeError("Skipping incrementing current file because " "submission to deadline failed.") comp = context.data.get("currentComp") assert comp, "Must have comp" current_filepath = context.data["currentFile"] new_filepath = version_up(current_filepath) comp.Save(new_filepath)
def process(self, context): import os from maya import cmds from pype.lib import version_up from pype.action import get_errored_plugins_from_data errored_plugins = get_errored_plugins_from_data(context) if any(plugin.__name__ == "MayaSubmitDeadline" for plugin in errored_plugins): raise RuntimeError("Skipping incrementing current file because " "submission to deadline failed.") current_filepath = context.data["currentFile"] new_filepath = version_up(current_filepath) # Ensure the suffix is .ma because we're saving to `mayaAscii` type if not new_filepath.endswith(".ma"): self.log.warning("Refactoring scene to .ma extension") new_filepath = os.path.splitext(new_filepath)[0] + ".ma" cmds.file(rename=new_filepath) cmds.file(save=True, force=True, type="mayaAscii")
def process(self, context): import os from maya import cmds from pype.lib import version_up from pype.action import get_errored_plugins_from_data errored_plugins = get_errored_plugins_from_data(context) if any(plugin.__name__ == "MayaSubmitDeadline" for plugin in errored_plugins): raise RuntimeError("Skipping incrementing current file because " "submission to deadline failed.") current_filepath = context.data["currentFile"] new_filepath = version_up(current_filepath) # # Ensure the suffix is .ma because we're saving to `mayaAscii` type if new_filepath.endswith(".ma"): fileType = "mayaAscii" elif new_filepath.endswith(".mb"): fileType = "mayaBinary" cmds.file(rename=new_filepath) cmds.file(save=True, force=True, type=fileType)
def process(self, instance): # Skip this plug-in if the ExtractImageSequence failed errored_plugins = get_errored_plugins_from_data(instance.context) if any(plugin.__name__ == "FusionRenderLocal" for plugin in errored_plugins): raise RuntimeError("Fusion local render failed, " "publishing images skipped.") subset = instance.data["subset"] ext = instance.data["ext"] # Regex to match resulting renders regex = "^{subset}.*[0-9]+{ext}+$".format(subset=re.escape(subset), ext=re.escape(ext)) # The instance has most of the information already stored metadata = { "regex": regex, "frameStart": instance.context.data["frameStart"], "frameEnd": instance.context.data["frameEnd"], "families": ["imagesequence"], } # Write metadata and store the path in the instance output_directory = instance.data["outputDir"] path = os.path.join(output_directory, "{}_metadata.json".format(subset)) with open(path, "w") as f: json.dump(metadata, f) assert os.path.isfile(path), ("Stored path is not a file for %s" % instance.data["name"]) # Suppress any subprocess console startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW startupinfo.wShowWindow = subprocess.SW_HIDE process = subprocess.Popen( ["python", _get_script(), "--paths", path], bufsize=1, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=startupinfo) while True: output = process.stdout.readline() # Break when there is no output or a return code has been given if output == '' and process.poll() is not None: process.stdout.close() break if output: line = output.strip() if line.startswith("ERROR"): self.log.error(line) else: self.log.info(line) if process.returncode != 0: raise RuntimeError("Process quit with non-zero " "return code: {}".format(process.returncode))