コード例 #1
0
    def update_render_status(self):

        if gmicheadless.session_render_complete(
                self.get_container_program_id()) == True:
            self.remove_as_status_polling_object()
            if self.render_type == FULL_RENDER:

                frame_file = self.get_lowest_numbered_file()
                if frame_file == None:
                    # Something is quite wrong, maybe best to just print out message and give up.
                    print("No frame file found for gmic conatainer clip")
                    return

                resource_name_str = utils.get_img_seq_resource_name(
                    frame_file, True)
                resource_path = self.get_rendered_media_dir(
                ) + "/" + resource_name_str

                rendered_clip = current_sequence().create_file_producer_clip(
                    resource_path, new_clip_name=None, novalidate=False, ttl=1)
                track, clip_index = current_sequence(
                ).get_track_and_index_for_id(self.clip.id)
                if track == None:
                    # clip was removed from timeline
                    # TODO: infowindow?
                    return

                # "old_clip", "new_clip", "track", "index"
                data = {
                    "old_clip": self.clip,
                    "new_clip": rendered_clip,
                    "rendered_media_path": resource_path,
                    "track": track,
                    "index": clip_index
                }
                action = edit.container_clip_full_render_replace(data)
                action.do_edit()
        else:
            status = gmicheadless.get_session_status(
                self.get_container_program_id())
            if status != None:
                step, frame, length, elapsed = status

                msg = _("Step") + str(step) + "/3"
                if step == "1":
                    msg += _("Writing frames")
                else:
                    msg += _("Rendering G'Mic script")

                job_proxy = self.get_job_proxy()
                job_proxy.progress = float(frame) / float(length)
                job_proxy.elapsed = float(elapsed)
                job_proxy.text = msg

                jobs.show_message(job_proxy)
            else:
                print("Miss")
コード例 #2
0
    def create_producer_and_do_update_edit(self, unused_data):

        # Using frame sequence as clip
        if self.container_data.render_data.do_video_render == False:
            resource_path = self.get_rendered_frame_sequence_resource_path()
            if resource_path == None:
                return  # TODO: User info?

            rendered_clip = current_sequence().create_file_producer_clip(
                resource_path, new_clip_name=None, novalidate=False, ttl=1)

        # Using video clip as clip
        else:
            if self.container_data.render_data.save_internally == True:
                resource_path = self.get_session_dir(
                ) + "/" + appconsts.CONTAINER_CLIP_VIDEO_CLIP_NAME + self.container_data.render_data.file_extension
            else:
                resource_path = self.container_data.render_data.render_dir + "/" + self.container_data.render_data.file_name + self.container_data.render_data.file_extension

            rendered_clip = current_sequence().create_file_producer_clip(
                resource_path, new_clip_name=None, novalidate=True, ttl=1)

        track, clip_index = current_sequence().get_track_and_index_for_id(
            self.clip.id)

        # Check if container clip still on timeline
        if track == None:
            # clip was removed from timeline
            # TODO: infowindow?
            return

        # Do replace edit
        data = {
            "old_clip": self.clip,
            "new_clip": rendered_clip,
            "rendered_media_path": resource_path,
            "track": track,
            "index": clip_index,
            "do_filters_clone": self.do_filters_clone
        }

        if self.render_type == FULL_RENDER:  # unrendered -> fullrender
            self.clip.container_data.last_render_type = FULL_RENDER
            action = edit.container_clip_full_render_replace(data)
            action.do_edit()
        else:  # unrendered -> clip render
            self.clip.container_data.last_render_type = CLIP_LENGTH_RENDER
            action = edit.container_clip_clip_render_replace(data)
            action.do_edit()