Skip to content

Conversation

mathsvisualization
Copy link

Motivation

Restoring scene checkpoints did not clear updaters from mobjects.
As a result, after reverting to a previous checkpoint, updaters that
were not present originally continued to run, causing inconsistent
scene states.

This PR fixes the issue by ensuring that updaters are cleared during
scene restoration.

Proposed changes

  • In SceneState.restore_scene:
    • Clear updaters on each mobject before restoring its state.
    • Ensure restored scene matches exactly the saved checkpoint.

Code

from manimlib import *

class FixRestoreSceneWithUpdater(InteractiveScene):
    def construct(self):
        # Setup
        cube = Cube()
        self.add(cube)
        frame = self.frame
        frame.reorient(32, 68, 0, (-0.02, 0.0, 0.0))

        # cache the scene
        frame.always.increment_theta(1 * DEG)

Before

2025-10-01.17-24-48.mp4

After

2025-10-01.17-26-25.mp4

Test

  • Created a checkpoint with a mobject without updaters.
  • Added an updater to the same mobject later in the scene.
  • Reverted to the previous checkpoint:
    • ✅ Now updater is cleared as expected.
    • ✅ Scene state is restored correctly.

Previously, restoring a scene checkpoint did not reset updaters.
This caused discrepancies when switching between checkpoints if
a mobject had updaters attached.

Now, restore_scene clears all updaters before restoring the mobject,
ensuring scene state consistency across checkpoints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant