mirror of
https://github.com/3b1b/manim.git
synced 2025-08-03 04:04:36 +08:00
Use get_family_updaters to test if a mobject should be drawn during every frame of an animation
This commit is contained in:
@ -173,6 +173,12 @@ class Mobject(Container):
|
||||
def get_updaters(self):
|
||||
return self.updaters
|
||||
|
||||
def get_family_updaters(self):
|
||||
return list(it.chain(*[
|
||||
sm.get_updaters()
|
||||
for sm in self.get_family()
|
||||
]))
|
||||
|
||||
def add_updater(self, update_function, index=None, call_updater=True):
|
||||
if index is None:
|
||||
self.updaters.append(update_function)
|
||||
|
@ -288,7 +288,7 @@ class Scene(Container):
|
||||
for i, mob in enumerate(mobjects):
|
||||
update_possibilities = [
|
||||
mob in animation_mobjects,
|
||||
len(mob.get_updaters()) > 0,
|
||||
len(mob.get_family_updaters()) > 0,
|
||||
mob in self.foreground_mobjects
|
||||
]
|
||||
if any(update_possibilities):
|
||||
|
Reference in New Issue
Block a user