Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Removed separate_moving_and_static from scenes in place of cleaner get_moving_mobjects approach

Grant Sanderson024a9dd3d486
diff --git a/scene/scene.py b/scene/scene.py
index cc4a0105b..ccbf9df6d 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 7b1976678..52a7403d9 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 5e1cc47c7..9a5faed1d 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)
##############