ManimCommunity / ManimCommunity/manim
`animation_override` not supported by `OpenGLMobject`
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
Unlike Mobject, OpenGLMobject does not have the decorators required to make this feature work, introduced by #1422 :
https://github.com/ManimCommunity/manim/blob/main/manim/mobject/mobject.py#L107-L176
[here's](https://docs.manim.community/en/stable/reference/manim.animation.animation.html?highlight=override_animation#overrideanimationexample) the doc link for the feature if you're unaware of its purpose.
## Expected behavior
Animation being overwritten.
## How to reproduce the issue
```py
class MySquare(Square):
@override_animation(FadeIn)
def _fade_in_override(self, **kwargs):
return Create(self, **kwargs)
class OverrideAnimationExample(Scene):
def construct(self):
self.play(FadeIn(MySquare()))
```
Running the code in the doc link simply plays `FadeIn`, when it should be playing `Create`.
Simply copying over `mobject.py` code to `opengl_mobject.py` does not affect the outcome.
## Additional comments
I don't really understand the purpose of this feature, since overriding an existing animation doesn't seem like it makes sense when you could simply define a new one. Instead of redefining `Create` for a custom animation, it would make more sense to have the animation be a method of the mobject, as was done for `Table`, via [`Table.create`](https://docs.manim.community/en/stable/reference/manim.mobject.table.Table.html?highlight=table.create#manim.mobject.table.Table.create).
So, I don't think it's worth investigating the issue to try to bring it over.
Contributor guide
Research direction
Start by comparing the decorators in manim/mobject/mobject.py with OpenGLMobject in manim/mobject/opengl_mobject.py, then run the OverrideAnimationExample reproduction from the issue. Determine why copying the relevant code does not make FadeIn dispatch to Create for OpenGLMobject; done means the documented override behavior works for the OpenGL class.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100