Repository: ManimCommunity/manim
File: manim/renderer/opengl_renderer.py (Python)

Code before:
        This method is used internally to check if the current
        animation needs to be skipped or not. It also checks if
        the number of animations that were played correspond to
        the number of animations that need to be played, and
        raises an EndSceneEarlyException if they don't correspond.
        """
        # there is always at least one section -> no out of bounds here
        if self.file_writer.sections[-1].skip_animations:
            self.skip_animations = True
        if (
            config["from_animation_number"]
            and self.num_plays < config["from_animation_number"]
        ):
            self.skip_animations = True
        if (
            config["upto_animation_number"]
            and self.num_plays > config["upto_animation_number"]
        ):
            self.skip_animations = True
            raise EndSceneEarlyException()

    @handle_caching_play
    def play(self, scene, *args, **kwargs):
        # TODO: Handle data locking / unlocking.
        self.animation_start_time = time.time()
        print(self.skip_animations)
        self.file_writer.begin_animation(not self.skip_animations)

        scene.compile_animation_data(*args, **kwargs)
        scene.begin_animations()
        if scene.is_current_animation_frozen_frame():
            self.update_frame(scene)

            if not self.skip_animations:
                for _ in range(int(config.frame_rate * scene.duration)):
                    self.file_writer.write_frame(self)

            if self.window is not None:
                while time.time() - self.animation_start_time < scene.duration:
                    self.window.swap_buffers()
            self.animation_elapsed_time = scene.duration

        else:
            scene.play_internal()

        self.file_writer.end_animation(not self.skip_animations)
        self.time += scene.duration
        self.num_plays += 1

    def clear_screen(self):
        self.frame_buffer_object.clear(*self.background_color)

Review comment (bug):
I'm guessing this was only for debugging purposes? It prints a bool in every play call when rendering with opengl

Code after:
                size=im.size,
                components=len(im.getbands()),
                data=im.tobytes(),
            )
            texture.use(location=tid)
            self.path_to_texture_id[path] = tid
        return self.path_to_texture_id[path]

    def update_skipping_status(self):
        """
        This method is used internally to check if the current
        animation needs to be skipped or not. It also checks if
        the number of animations that were played correspond to
        the number of animations that need to be played, and
        raises an EndSceneEarlyException if they don't correspond.
        """
        # there is always at least one section -> no out of bounds here
        if self.file_writer.sections[-1].skip_animations:
            self.skip_animations = True
        if (
            config["from_animation_number"]
            and self.num_plays < config["from_animation_number"]
        ):
            self.skip_animations = True
        if (
            config["upto_animation_number"]
            and self.num_plays > config["upto_animation_number"]
        ):
            self.skip_animations = True
            raise EndSceneEarlyException()

    @handle_caching_play
    def play(self, scene, *args, **kwargs):
        # TODO: Handle data locking / unlocking.
        self.animation_start_time = time.time()
        self.file_writer.begin_animation(not self.skip_animations)

        scene.compile_animation_data(*args, **kwargs)
        scene.begin_animations()
        if scene.is_current_animation_frozen_frame():
            self.update_frame(scene)

            if not self.skip_animations:
                for _ in range(int(config.frame_rate * scene.duration)):
                    self.file_writer.write_frame(self)

            if self.window is not None:
                while time.time() - self.animation_start_time < scene.duration:
                    self.window.swap_buffers()
            self.animation_elapsed_time = scene.duration