Skip to content

Commit

Permalink
Merge branch 'main' into fix/code-transform-animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mindev27 authored Jan 22, 2025
2 parents 4dabe1e + 8f919b1 commit 2be9cf8
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2309,6 +2309,31 @@ def split(self) -> list[Self]:
return result + self.submobjects

def get_family(self, recurse: bool = True) -> list[Self]:
"""Lists all mobjects in the hierarchy (family) of the given mobject,
including the mobject itself and all its submobjects recursively.
Parameters
----------
recurse
Just for consistency with get_family method in OpenGLMobject.
Returns
-------
list
A list of mobjects in the family of the given mobject.
Examples
--------
::
>>> from manim import Square, Rectangle, VGroup, Group, Mobject, VMobject
>>> s, r, m, v = Square(), Rectangle(), Mobject(), VMobject()
>>> vg = VGroup(s, r)
>>> gr = Group(vg, m, v)
>>> gr.get_family()
[Group, VGroup(Square, Rectangle), Square, Rectangle, Mobject, VMobject]
"""
sub_families = [x.get_family() for x in self.submobjects]
all_mobjects = [self] + list(it.chain(*sub_families))
return remove_list_redundancies(all_mobjects)
Expand Down

0 comments on commit 2be9cf8

Please sign in to comment.