Removed the option for displaying to excluse submobjects

This commit is contained in:
Grant Sanderson 2020-01-16 11:04:11 -08:00
parent 1609be6d49
commit 40c8b7db76
4 changed files with 18 additions and 20 deletions

View file

@ -198,17 +198,13 @@ class Camera(object):
return self return self
### ###
def get_mobjects_to_display( def get_mobjects_to_display(self, mobjects, excluded_mobjects=None):
self, mobjects, mobjects = extract_mobject_family_members(
include_submobjects=True, mobjects, only_those_with_points=True,
excluded_mobjects=None): )
if include_submobjects: if excluded_mobjects:
mobjects = extract_mobject_family_members( all_excluded = extract_mobject_family_members(excluded_mobjects)
mobjects, only_those_with_points=True, mobjects = list_difference_update(mobjects, all_excluded)
)
if excluded_mobjects:
all_excluded = extract_mobject_family_members(excluded_mobjects)
mobjects = list_difference_update(mobjects, all_excluded)
return mobjects return mobjects
def is_in_frame(self, mobject): def is_in_frame(self, mobject):

View file

@ -31,7 +31,6 @@ class MappingCamera(Camera):
mobject.insert_n_curves(self.min_num_curves) mobject.insert_n_curves(self.min_num_curves)
Camera.capture_mobjects( Camera.capture_mobjects(
self, mobject_copies, self, mobject_copies,
include_submobjects=False,
excluded_mobjects=None, excluded_mobjects=None,
) )

View file

@ -1,6 +1,7 @@
from manimlib.camera.moving_camera import MovingCamera from manimlib.camera.moving_camera import MovingCamera
from manimlib.scene.scene import Scene from manimlib.scene.scene import Scene
from manimlib.utils.iterables import list_update from manimlib.utils.iterables import list_update
from manimlib.utils.family_ops import extract_mobject_family_members
class MovingCameraScene(Scene): class MovingCameraScene(Scene):
@ -18,7 +19,7 @@ class MovingCameraScene(Scene):
def get_moving_mobjects(self, *animations): def get_moving_mobjects(self, *animations):
moving_mobjects = Scene.get_moving_mobjects(self, *animations) moving_mobjects = Scene.get_moving_mobjects(self, *animations)
all_moving_mobjects = self.camera.extract_mobject_family_members( all_moving_mobjects = extract_mobject_family_members(
moving_mobjects moving_mobjects
) )
movement_indicators = self.camera.get_mobjects_indicating_movement() movement_indicators = self.camera.get_mobjects_indicating_movement()

View file

@ -113,27 +113,29 @@ class Scene(Container):
def reset_camera(self): def reset_camera(self):
self.camera.reset() self.camera.reset()
def capture_mobjects_in_camera(self, mobjects, **kwargs): def capture_mobjects_in_camera(self, mobjects, excluded_mobjects=None):
self.camera.capture_mobjects(mobjects, **kwargs) self.camera.capture_mobjects(mobjects, excluded_mobjects=excluded_mobjects)
def update_frame( def update_frame(
self, self,
mobjects=None, mobjects=None,
background=None, background=None,
include_submobjects=True, ignore_skipping=False,
ignore_skipping=True, excluded_mobjects=None):
**kwargs):
if self.skip_animations and not ignore_skipping: if self.skip_animations and not ignore_skipping:
return return
# Default to displaying everything in self.mobjects
if mobjects is None: if mobjects is None:
mobjects = self.mobjects mobjects = self.mobjects
if background is not None: if background is not None:
self.set_camera_pixel_array(background) self.set_camera_pixel_array(background)
else: else:
self.reset_camera() self.reset_camera()
kwargs["include_submobjects"] = include_submobjects self.capture_mobjects_in_camera(
self.capture_mobjects_in_camera(mobjects, **kwargs) mobjects, excluded_mobjects=excluded_mobjects,
)
def freeze_background(self): def freeze_background(self):
self.update_frame() self.update_frame()