Exemple #1
0
 def capture_mobjects(self, mobjects, **kwargs):
     self.update_sub_cameras()
     for imfc in self.image_mobjects_from_cameras:
         to_add = list(mobjects)
         if not self.allow_cameras_to_capture_their_own_display:
             to_add = list_difference_update(to_add, imfc.get_family())
         imfc.camera.capture_mobjects(to_add, **kwargs)
     MovingCamera.capture_mobjects(self, mobjects, **kwargs)
Exemple #2
0
 def capture_mobjects(self, mobjects, **kwargs):
     self.update_sub_cameras()
     for imfc in self.image_mobjects_from_cameras:
         to_add = list(mobjects)
         if not self.allow_cameras_to_capture_their_own_display:
             to_add = list_difference_update(
                 to_add, imfc.get_family()
             )
         imfc.camera.capture_mobjects(to_add, **kwargs)
     MovingCamera.capture_mobjects(self, mobjects, **kwargs)
Exemple #3
0
    def add_numbers(self, x_values=None, excluding=None, **kwargs):
        if x_values is None:
            x_values = self.get_tick_range()
        if excluding is not None:
            x_values = list_difference_update(x_values, excluding)

        self.numbers = VGroup()
        for x in x_values:
            self.numbers.add(self.get_number_mobject(x, **kwargs))
        self.add(self.numbers)
        return self.numbers
Exemple #4
0
 def get_mobjects_to_display(
         self, mobjects,
         include_submobjects=True,
         excluded_mobjects=None):
     if include_submobjects:
         mobjects = self.extract_mobject_family_members(
             mobjects, only_those_with_points=True,
         )
         if excluded_mobjects:
             all_excluded = self.extract_mobject_family_members(
                 excluded_mobjects
             )
             mobjects = list_difference_update(mobjects, all_excluded)
     return mobjects
Exemple #5
0
 def get_mobjects_to_display(
         self, mobjects,
         include_submobjects=True,
         excluded_mobjects=None):
     if include_submobjects:
         mobjects = self.extract_mobject_family_members(
             mobjects, only_those_with_points=True,
         )
         if excluded_mobjects:
             all_excluded = self.extract_mobject_family_members(
                 excluded_mobjects
             )
             mobjects = list_difference_update(mobjects, all_excluded)
     return mobjects
Exemple #6
0
    def remove(self, *mobjects: Mobject):
        """
        Removes anything in mobjects from scenes mobject list, but in the event that one
        of the items to be removed is a member of the family of an item in mobject_list,
        the other family members are added back into the list.

        For example, if the scene includes Group(m1, m2, m3), and we call scene.remove(m1),
        the desired behavior is for the scene to then include m2 and m3 (ungrouped).
        """
        for mob in mobjects:
            # First restructure self.mobjects so that parents/grandparents/etc. are replaced
            # with their children, likewise for all ancestors in the extended family.
            for ancestor in mob.get_ancestors(extended=True):
                self.replace(ancestor, *ancestor.submobjects)
            self.mobjects = list_difference_update(self.mobjects, mob.get_family())
        return self