Skip to content

Fix behavior of Mobject.suspend_updating when only suspending parent mobject, let children continue updating #4402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -892,16 +892,15 @@ def update(self, dt: float = 0, recursive: bool = True) -> Self:
:meth:`get_updaters`

"""
if self.updating_suspended:
return self
for updater in self.updaters:
if "dt" in inspect.signature(updater).parameters:
updater(self, dt)
else:
updater(self)
if not self.updating_suspended:
for updater in self.updaters:
if "dt" in inspect.signature(updater).parameters:
updater(self, dt)
else:
updater(self)
if recursive:
for submob in self.submobjects:
submob.update(dt, recursive)
submob.update(dt, recursive=recursive)
return self

def get_time_based_updaters(self) -> list[TimeBasedUpdater]:
Expand Down
11 changes: 5 additions & 6 deletions manim/mobject/opengl/opengl_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1466,12 +1466,11 @@ def init_updaters(self) -> None:
self.updating_suspended = False

def update(self, dt: float = 0, recurse: bool = True) -> Self:
if not self.has_updaters or self.updating_suspended:
return self
for updater in self.time_based_updaters:
updater(self, dt)
for updater in self.non_time_updaters:
updater(self)
if self.has_updaters and not self.updating_suspended:
for updater in self.time_based_updaters:
updater(self, dt)
for updater in self.non_time_updaters:
updater(self)
if recurse:
for submob in self.submobjects:
submob.update(dt, recurse)
Expand Down
Loading