A community-maintained Python framework for creating mathematical animations.
fixed bug for reduce_across_dim for mobs with empty submobs
Ben Hambrecht90504e24e7df
diff --git a/mobject/mobject.py b/mobject/mobject.pyindex c9a2affab..56c87c516 100644--- a/mobject/mobject.py+++ b/mobject/mobject.py@@ -623,13 +623,17 @@ class Mobject(Container):values = []values += [mob.reduce_across_dimension(points_func, reduce_func, dim)- for mob in self.submobjects+ for mob in self.nonempty_submobjects()]try:return reduce_func(values)except:return 0+ def nonempty_submobjects(self):+ return [submob for submob in self.submobjects+ if len(submob.submobjects) != 0 or len(submob.points) != 0]+def get_merged_array(self, array_attr):result = Nonefor mob in self.family_members_with_points():@@ -745,10 +749,7 @@ class Mobject(Container):def submobject_family(self):sub_families = map(Mobject.submobject_family, self.submobjects)all_mobjects = [self] + list(it.chain(*sub_families))-<<<<<<< HEAD#all_mobjects = list(it.chain(*sub_families)) + [self]-=======->>>>>>> masterreturn remove_list_redundancies(all_mobjects)def family_members_with_points(self):