Should Mobject be an abstract class?
See original GitHub issueThe following excerpt from camera.py
contains the functions used to render objects and put them in the Camera’s pixel_array
.
As you can see, Mobjects are not processed at all. This means that if I add
a Mobject on my Scene
, it will never be captured by the camera and not rendered on video.
Seeing as Mobjects are never being handled, should Mobject
be an abstract class? As far as I can tell, Mobject is really only instantiated in some tests, but most (all?) of those tests could just as easily be written using VMobject instead.
EDIT: another question. Currently Mobjects are being silently ignored. Instead, the code above should (at least) issue a warning to the user “you are trying to render a Mobject, which is currently not supported. Use VMobject instead”.
EDIT: regardless of whether or not Mobject is made abstract, I think Group
should be deprecated. Nobody is using Group
. (Nobody can use Group for anything useful since it can only contain Mobject
s.)
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Yeah, I think it’s so that you can do things like
VGroup.set_fill
and that will neatly broadcast to each submobject.I believe Mobject can still be made into an abstract class in some other way, for example by decorating one of its methods with
@abstractmethod
(see here). However, if we do so, then each of its derived classes has to override that method. Note that Group and Vmobject both derive from Mobject, so there are not many methods that will be meaningfully overriden by both at the same time.