Esempio n. 1
0
    def process(self, instance):
        # get sequence
        sequence = instance.context.data["activeSequence"]
        subset = instance.data["subset"]

        # get timeline in / out
        clip_in = instance.data["clipIn"]
        clip_out = instance.data["clipOut"]
        # get handles from context
        handle_start = instance.data["handleStart"]
        handle_end = instance.data["handleEnd"]

        staging_dir = self.staging_dir(instance)
        self.log.info("Created staging dir: {}...".format(staging_dir))

        # path to wav file
        audio_file = os.path.join(staging_dir, "{}.wav".format(subset))

        # export audio to disk
        writeSequenceAudioWithHandles(audio_file, sequence, clip_in, clip_out,
                                      handle_start, handle_end)

        # add to representations
        if not instance.data.get("representations"):
            instance.data["representations"] = list()

        representation = {
            'files': os.path.basename(audio_file),
            'stagingDir': staging_dir,
            'name': "wav",
            'ext': "wav"
        }

        instance.data["representations"].append(representation)
Esempio n. 2
0
    def process(self, instance):
        import os

        from hiero.exporters.FnExportUtil import writeSequenceAudioWithHandles

        item = instance.data["item"]
        context = instance.context

        self.log.debug("creating staging dir")
        self.staging_dir(instance)

        staging_dir = instance.data["stagingDir"]

        # get handles from context
        handle_start = instance.data["handleStart"]
        handle_end = instance.data["handleEnd"]

        # get sequence from context
        sequence = context.data["activeSequence"]

        # path to wav file
        audio_file = os.path.join(
            staging_dir, "{0}.wav".format(instance.data["subset"])
        )

        # export audio to disk
        writeSequenceAudioWithHandles(
            audio_file,
            sequence,
            item.timelineIn(),
            item.timelineOut(),
            handle_start,
            handle_end
        )

        # add to representations
        if not instance.data.get("representations"):
            instance.data["representations"] = list()

        representation = {
            'files': os.path.basename(audio_file),
            'stagingDir': staging_dir,
            'name': "wav",
            'ext': "wav"
        }

        instance.data["representations"].append(representation)
Esempio n. 3
0
    def process(self, instance):
        import os
        import time

        import hiero.core
        from hiero.exporters.FnExportUtil import writeSequenceAudioWithHandles

        nukeWriter = hiero.core.nuke.ScriptWriter()

        item = instance.data["item"]

        handles = instance.data["handles"]

        sequence = item.parent().parent()

        output_path = os.path.abspath(
            os.path.join(
                instance.context.data["currentFile"], "..", "workspace"
            )
        )

        # Generate audio
        audio_file = os.path.join(
            output_path, "{0}.wav".format(instance.data["name"])
        )

        writeSequenceAudioWithHandles(
            audio_file,
            sequence,
            item.timelineIn(),
            item.timelineOut(),
            handles,
            handles
        )

        # Generate Nuke script
        root_node = hiero.core.nuke.RootNode(
            item.timelineIn() - handles,
            item.timelineOut() + handles,
            fps=sequence.framerate()
        )
        nukeWriter.addNode(root_node)

        item.addToNukeScript(
            script=nukeWriter,
            includeRetimes=True,
            retimeMethod="Frame",
            startHandle=handles,
            endHandle=handles
        )

        movie_path = os.path.join(
            output_path, "{0}.mov".format(instance.data["name"])
        )
        write_node = hiero.core.nuke.WriteNode(movie_path.replace("\\", "/"))
        write_node.setKnob("file_type", "mov")
        write_node.setKnob("mov32_audiofile", audio_file.replace("\\", "/"))
        write_node.setKnob("mov32_fps", sequence.framerate())
        nukeWriter.addNode(write_node)

        nukescript_path = movie_path.replace(".mov", ".nk")
        nukeWriter.writeToDisk(nukescript_path)

        process = hiero.core.nuke.executeNukeScript(
            nukescript_path,
            open(movie_path.replace(".mov", ".log"), "w")
        )

        while process.poll() is None:
            time.sleep(0.5)

        assert os.path.exists(movie_path), "Creating review failed."

        instance.data["output_path"] = movie_path
        instance.data["review_family"] = "mov"