question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should Mobject be an abstract class?

See original GitHub issue

The following excerpt from camera.py contains the functions used to render objects and put them in the Camera’s pixel_array.

https://github.com/ManimCommunity/manim/blob/35e9e05eec4dc091d462ca2dab8b4561497ba0f1/manim/camera/camera.py#L488-L493

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 Mobjects.)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
leotrscommented, Aug 28, 2020

Yeah, I think it’s so that you can do things like VGroup.set_fill and that will neatly broadcast to each submobject.

0reactions
leotrscommented, Nov 21, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can we create an object of an abstract class in Java?
No, we can't create an object of an abstract class. But we can create a reference variable of an abstract class. The reference...
Read more >
Why java.lang.Object is not abstract? [duplicate]
According to Sun, An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot...
Read more >
Can an object be created from an abstract class?
NO, an abstract class can not have an object. REASON: Abstract classes serve as a template which a developer needs to extend and...
Read more >
Abstract Methods and Classes (The Java™ Tutorials ...
An abstract class is a class that is declared abstract —it may or may not include abstract methods. Abstract classes cannot be instantiated,...
Read more >
What is abstract class? | Definition from TechTarget
Abstract classes are used in all object-oriented programming (OOP) languages, including Java (see Java abstract class), C++, C# and VB.NET. Objects or classes ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found