mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Use get_family_updaters to test if a mobject should be drawn during every frame of an animation
This commit is contained in:
parent
26c7faabdd
commit
982d437267
2 changed files with 7 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue