From 024a9dd3d48659fe565709d35e8fa7fe7c8c47b7 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 17 Jan 2018 22:13:38 -0800 Subject: [PATCH] Removed separate_moving_and_static from scenes in place of cleaner get_moving_mobjects approach --- scene/scene.py | 6 +----- scene/zoomed_scene.py | 10 ++++------ topics/three_dimensions.py | 7 +++---- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/scene/scene.py b/scene/scene.py index cc4a0105..ccbf9df6 100644 --- a/scene/scene.py +++ b/scene/scene.py @@ -229,19 +229,15 @@ class Scene(object): ) to_remove = self.camera.extract_mobject_family_members(mobjects) - self.mobjects = list_difference_update(self.mobjects, to_remove) - self.remove_foreground_mobjects(*to_remove) self.mobjects = self.get_restructured_mobject_list(self.mobjects, to_remove) self.foreground_mobjects = self.get_restructured_mobject_list( self.foreground_mobjects, to_remove ) - self.continual_animations = filter( lambda ca : ca not in continual_animations and \ ca.mobject not in to_remove, self.continual_animations ) - return self def get_restructured_mobject_list(self, mobjects, to_remove): @@ -276,7 +272,7 @@ class Scene(object): return self.add_foreground_mobjects(mobject) def remove_foreground_mobjects(self, *mobjects): - self.foreground_mobjects = list_difference_update( + self.foreground_mobjects = get_restructured_mobject_list( self.foreground_mobjects, self.camera.extract_mobject_family_members(mobjects) ) diff --git a/scene/zoomed_scene.py b/scene/zoomed_scene.py index 7b197667..52a7403d 100644 --- a/scene/zoomed_scene.py +++ b/scene/zoomed_scene.py @@ -122,15 +122,13 @@ class ZoomedScene(Scene): self.zoomed_camera.capture_mobjects( mobjects, **kwargs ) - def separate_moving_and_static_mobjects(self, *animations): - moving_mobjects, static_mobjects = Scene.separate_moving_and_static_mobjects( - self, *animations - ) + def get_moving_mobjects(self, *animations): + moving_mobjects = Scene.get_moving_mobjects(self, *animations) if self.zoom_activated and self.little_rectangle in moving_mobjects: # When the camera is moving, so is everything, - return self.get_mobjects(), [] + return self.mobjects else: - return moving_mobjects, static_mobjects + return moving_mobjects diff --git a/topics/three_dimensions.py b/topics/three_dimensions.py index 5e1cc47c..9a5faed1 100644 --- a/topics/three_dimensions.py +++ b/topics/three_dimensions.py @@ -175,11 +175,10 @@ class ThreeDScene(Scene): if is_camera_rotating: self.add(self.ambient_camera_rotation) - def separate_moving_and_static_mobjects(self, *animations): - moving, static = Scene.separate_moving_and_static_mobjects(self, *animations) + def get_moving_mobjects(self, *animations): if self.camera.rotation_mobject in moving: - return moving + static, [] - return moving, static + return self.mobjects + return Scene.get_moving_mobjects(self, *animations) ##############