示例#1
0
    def update_render_status(self):

        Gdk.threads_enter()

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

            job_proxy = self.get_completed_job_proxy()
            jobs.update_job_queue(job_proxy)

            GLib.idle_add(self.create_producer_and_do_update_edit, None)

        else:
            status = gmicheadless.get_session_status(
                self.get_container_program_id())
            if status != None:
                step, frame, length, elapsed = status

                steps_count = 3
                if self.container_data.render_data.do_video_render == False:
                    steps_count = 2
                msg = _("Step ") + str(step) + " / " + str(steps_count) + " - "
                if step == "1":
                    msg += _("Writing Clip Frames")
                elif step == "2":
                    msg += _("Rendering G'Mic Script")
                else:
                    msg += _("Encoding Video")

                msg += " - " + self.get_job_name()

                job_proxy = self.get_job_proxy()
                if self.render_type == FULL_RENDER:
                    job_proxy.progress = float(frame) / float(length)
                else:
                    if step == "1":
                        render_length = self.render_range_out - self.render_range_in
                        frame = int(frame) - self.gmic_frame_offset
                    else:
                        render_length = self.render_range_out - self.render_range_in
                    job_proxy.progress = float(frame) / float(render_length)

                    if job_proxy.progress < 0.0:
                        # hack to fix how gmiplayer.FramesRangeWriter works.
                        # We would need to patch to g'mic tool to not need this but this is easier.
                        job_proxy.progress = 1.0

                    if job_proxy.progress > 1.0:
                        # hack to fix how progress is calculated in gmicheadless because producers can render a bit longer then required.
                        job_proxy.progress = 1.0

                job_proxy.elapsed = float(elapsed)
                job_proxy.text = msg

                jobs.update_job_queue(job_proxy)
            else:
                pass  # This can happen sometimes before gmicheadless.py has written a status message, we just do nothing here.

        Gdk.threads_leave()
示例#2
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")
示例#3
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:
                # "old_clip", "new_clip", "track", "index"
                data = {
                    "old_clip": self.clip,
                    "new_clip": rendered_clip,
                    "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:
                print(status)
            else:
                print("Miss")