ManimCommunity / ManimCommunity/manim

`GrowFromEdge` breaks with opengl

Open
#2,323 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

Consider this scene:

```python
class Test(Scene):
def construct(self):
m = Circle()
self.play(GrowFromEdge(m, LEFT))
```

It renders just fine with cairo, but with opengl this happens:

```
Traceback (most recent call last):
╭──────────────────────────────────────────────────────────────────────────────────────╮
│ File "/home/sudgy/.local/lib/python3.9/site-packages/manim/cli/render/commands.py", │
│line 108, in render │
│ 105 while keep_running: │
│ 106 for SceneClass in scene_classes_from_file(file): │
│ 107 scene = SceneClass(renderer) │
│ ❱ 108 rerun = scene.render() │
│ 109 if rerun or config["write_all"]: │
│ 110 renderer.num_plays = 0 │
│ 111 continue │
│ File "/home/sudgy/.local/lib/python3.9/site-packages/manim/scene/scene.py", line 216,│
│in render │
│ 213 """ │
│ 214 self.setup() │
│ 215 try: │
│ ❱ 216 self.construct() │
│ 217 except EndSceneEarlyException: │
│ 218 pass │
│ 219 except RerunSceneException as e: │
│ File "/home/sudgy/programs/python/manim/test/test.py", line 10, in construct │
│ 7 class Test(Scene): │
│ 8 def construct(self): │
│ 9 m = Circle() │
│ ❱ 10 self.play(GrowFromEdge(m, LEFT)) │
│ File "/home/sudgy/.local/lib/python3.9/site-packages/manim/animation/growing.py", │
│line 51, in __init__ │
│ 48 │
│ 49 class GrowFromEdge(GrowFromPoint): │
│ 50 def __init__(self, mobject: "Mobject", edge: np.ndarray, **kwargs) -> None:│
│ ❱ 51 point = mobject.get_critical_point(edge) │
│ 52 super().__init__(mobject, point, **kwargs) │
│ 53 │
│ 54 │
╰──────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Circle' object has no attribute 'get_critical_point'
```

I've noticed this before, that for some reason `OpenGLMobject` renamed some of `Mobject`'s methods (including `get_critical_point`), making writing generic code for both of them extremely difficult in some cases. The main point here though is that this code should work but doesn't.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in manim/animation/growing.py at GrowFromEdge, then compare the get_critical_point interfaces on Mobject and OpenGLMobject. Reproduce the supplied Circle scene with the OpenGL renderer and verify that GrowFromEdge works with both Cairo and OpenGL.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.