Esempio n. 1
0
    def process(self, context):

        if lib.in_remote():
            return

        fname = context.data["originMaking"]

        if all(result["success"] for result in context.data["results"]):

            self.log.info("Publish succeed, save script back to workfile.")
            nuke.scriptSaveAs(fname, overwrite=True)
            modified = False

        else:
            # Mark failed if error raised during extraction or integration
            publishing = context.data["currentMaking"]
            script_dir, file_name = os.path.split(publishing)
            file_name = "__failed." + file_name
            modified = True

            os.rename(publishing, script_dir + "/" + file_name)

        nuke.Root()["name"].setValue(fname)
        nuke.Root()["project_directory"].setValue(os.path.dirname(fname))
        nuke.Root().setModified(modified)
    def process(self, context):

        if lib.in_remote():
            return

        maya.unlock()

        with capsule.maintained_selection():
            cmds.file(rename=context.data["originMaking"])
            # Changing selection to update window title for
            # displaying new file name
            cmds.select("defaultLightSet")

        if all(result["success"] for result in context.data["results"]):

            self.log.info("Publish succeed, save scene back to workfile.")
            cmds.file(save=True, force=True)

        else:
            # Mark failed if error raised during extraction or integration
            publishing = context.data["currentMaking"]
            scene_dir, file_name = os.path.split(publishing)
            file_name = "__failed." + file_name

            os.rename(publishing, scene_dir + "/" + file_name)
Esempio n. 3
0
    def process(self, instance):
        if lib.in_remote():
            return

        self.log.info("Validating image resolution..")
        if self.get_invalid(instance):
            raise Exception("Rendering resolution is not correct.")
    def process(self, context):

        if lib.in_remote():
            return

        if pipeline.is_locked():
            raise Exception("Script has been locked, please save the script "
                            "with another name.")
Esempio n. 5
0
    def process(self, context):

        if lib.in_remote():
            return

        if maya.is_locked():
            raise Exception("Scene has been locked, please save the scene "
                            "with another name.")
Esempio n. 6
0
    def extract_Ass(self, packager):
        from reveries.maya import arnold

        # Ensure option created
        arnold.utils.create_options()

        packager.skip_stage()
        package_path = packager.create_package()

        cache_file = packager.file_name("ass")
        cache_path = os.path.join(package_path, cache_file)

        self.log.info("Extracting standin..")

        try:
            texture = next(chd for chd in self.data.get("childInstances", [])
                           if chd.data["family"] == "reveries.texture")
        except StopIteration:
            file_node_attrs = dict()
        else:
            file_node_attrs = texture.data.get("fileNodeAttrs", dict())

        data = {
            "fileNodeAttrs": file_node_attrs,
            "member": self.member,
            "cachePath": cache_path,
            "hasYeti": self.data.get("hasYeti", False)
        }
        data_path = os.path.join(package_path, ".remoteData.json")

        if lib.to_remote():
            self.data["remoteDataPath"] = data_path
            with open(data_path, "w") as fp:
                json.dump(data, fp, indent=4)

            return

        elif lib.in_remote():
            self.log.info("Stand-In exported via per-frame script.")

        else:
            self.export_ass(data, self.data["startFrame"],
                            self.data["endFrame"], self.data["byFrameStep"])

        entry_file = next(f for f in os.listdir(package_path)
                          if f.endswith(".ass"))

        use_sequence = self.data["startFrame"] != self.data["endFrame"]
        packager.add_data({
            "entryFileName": entry_file,
            "useSequence": use_sequence
        })
        if use_sequence:
            packager.add_data({
                "startFrame": self.data["startFrame"],
                "endFrame": self.data["endFrame"]
            })