From 487f582302e1555782d5dd1af4626f52fffdd332 Mon Sep 17 00:00:00 2001 From: BillyLikesHacking <86190295+BillyLikesHacking@users.noreply.github.com> Date: Fri, 22 Oct 2021 20:02:05 +0800 Subject: [PATCH] Update mobject.py --- manimlib/mobject/mobject.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py index 126ebdec..8ca79c69 100644 --- a/manimlib/mobject/mobject.py +++ b/manimlib/mobject/mobject.py @@ -1596,6 +1596,15 @@ class Group(Mobject): raise Exception("All submobjects must be of type Mobject") Mobject.__init__(self, **kwargs) self.add(*mobjects) + def __add__(self, other : 'Mobject' or 'Group'): + assert(isinstance(other, Mobject)) + if other in self: + return Group(*self, other.copy()) + if isinstance(other, (Group, VGroup)): + if all([isinstance(i, VMobject) for i in Group(*self, *other)]): + return VGroup(*self, *other) + return Group(*self, *other) + return Group(*self, other) class Point(Mobject):