3b1b-manim/manimlib/utils/debug.py

22 lines
660 B
Python
Raw Normal View History

from manimlib.constants import BLACK
from manimlib.mobject.numbers import Integer
from manimlib.mobject.types.vectorized_mobject import VGroup
def print_family(mobject, n_tabs=0):
"""For debugging purposes"""
print("\t" * n_tabs, mobject, id(mobject))
for submob in mobject.submobjects:
2019-12-17 09:37:59 -08:00
print_family(submob, n_tabs + 1)
def get_submobject_index_labels(mobject, label_height=0.15):
labels = VGroup()
for n, submob in enumerate(mobject):
label = Integer(n)
label.set_height(label_height)
label.move_to(submob)
label.set_stroke(BLACK, 5, background=True)
labels.add(label)
return labels