mirror of
https://github.com/3b1b/manim.git
synced 2025-07-28 04:23:16 +08:00
Added a couple helpful debugging functions
This commit is contained in:
21
manimlib/utils/debug.py
Normal file
21
manimlib/utils/debug.py
Normal file
@ -0,0 +1,21 @@
|
||||
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:
|
||||
submob.print_family(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
|
Reference in New Issue
Block a user