ManimCommunity / ManimCommunity/manim

OpenGL - Cairo discrepancy: Can't use more than one argument for shift

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

Nobody has claimed this yet.

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

Description

## Description of bug / unexpected behavior

The shift function of all Mobjects accepts an arbitrary number of summed-together movement vectors. On OpenGL however, more than one argument gives a strange error.

## Expected behavior

The multiple arguments should either be an error on both renderers or work on both renderers.

## How to reproduce the issue

Code for reproducing the problem

```py
class Example(Scene):
def construct(self):
# any mobject works
text = Text('blah')
text.shift(UP, LEFT)
```

## Logs
Terminal output

```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ Python\Python310\lib\site-packages\manim\cli\render\comman │
│ ds.py:103 in render │
│ │
│ 100 │ │ │ │ for SceneClass in scene_classes_from_file(file): │
│ 101 │ │ │ │ │ with tempconfig(config): │
│ 102 │ │ │ │ │ │ scene = SceneClass(renderer) │
│ ❱ 103 │ │ │ │ │ │ rerun = scene.render() │
│ 104 │ │ │ │ │ if rerun or config["write_all"]: │
│ 105 │ │ │ │ │ │ renderer.num_plays = 0 │
│ 106 │ │ │ │ │ │ continue │
│ │
│ Python\Python310\lib\site-packages\manim\scene\scene.py:22 │
│ 2 in render │
│ │
│ 219 │ │ """ │
│ 220 │ │ self.setup() │
│ 221 │ │ try: │
│ ❱ 222 │ │ │ self.construct() │
│ 223 │ │ except EndSceneEarlyException: │
│ 224 │ │ │ pass │
│ 225 │ │ except RerunSceneException as e: │
│ │
│ some_file.py:23 in construct │
│ │
│ 20 │ def construct(self): │
│ 21 │ │ # any mobject works │
│ 22 │ │ text = Text('blah') │
│ ❱ 23 │ │ text.shift(UP, LEFT) │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: OpenGLMobject.shift() takes 2 positional arguments but 3 were given
```

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 by running the provided Example scene with Text('blah') and text.shift(UP, LEFT) using the OpenGL renderer, then compare the shift entry point shown in the traceback, OpenGLMobject.shift, with the Cairo behavior. Done means multiple shift vectors either work consistently in both renderers or are rejected consistently, without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.