ManimCommunity / ManimCommunity/manim

StealthTip tip_shape doesn't work in OpenGL

Open
#4,067 0 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

StealthTip tip_shape doesn't work in OpenGL :

```
AttributeError: 'StealthTip' object has no attribute 'data'
```

## Expected behavior

No difference between opengl and cairo mobs.

## How to reproduce the issue

Code for reproducing the problem

```py
from manim import *
from manim.opengl import *
config.renderer = 'opengl'

class Scene1(ThreeDScene):
def construct(self):
self.add(Arrow(tip_shape=StealthTip))
self.wait(1)
```

## Logs
Terminal output

```
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/user1/.local/lib/python3.10/site-packages/manim/cli/render/commands.py:120 in render │
│ │
│ 117 │ │ │ try: │
│ 118 │ │ │ │ with tempconfig({}): │
│ 119 │ │ │ │ │ scene = SceneClass() │
│ ❱ 120 │ │ │ │ │ scene.render() │
│ 121 │ │ │ except Exception: │
│ 122 │ │ │ │ error_console.print_exception() │
│ 123 │ │ │ │ sys.exit(1) │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/scene/scene.py:229 in render │
│ │
│ 226 │ │ """ │
│ 227 │ │ self.setup() │
│ 228 │ │ try: │
│ ❱ 229 │ │ │ self.construct() │
│ 230 │ │ except EndSceneEarlyException: │
│ 231 │ │ │ pass │
│ 232 │ │ except RerunSceneException as e: │
│ │
│ /home/user1/svn/perm3d/test_arrow.py:8 in construct │
│ │
│ 5 │
│ 6 class Scene1(ThreeDScene): │
│ 7 │ def construct(self): │
│ ❱ 8 │ │ self.add(Arrow(tip_shape=StealthTip)) │
│ 9 │ │ self.wait(1) │
│ 10 │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/mobject/geometry/line.py:530 in │
│ __init__ │
│ │
│ 527 │ │ # TODO, should this be affected when │
│ 528 │ │ # Arrow.set_stroke is called? │
│ 529 │ │ self.initial_stroke_width = self.stroke_width │
│ ❱ 530 │ │ self.add_tip(tip_shape=tip_shape) │
│ 531 │ │ self._set_stroke_width_from_length() │
│ 532 │ │
│ 533 │ def scale(self, factor: float, scale_tips: bool = False, **kwargs) -> Self: │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/mobject/geometry/arc.py:118 in add_tip │
│ │
│ 115 │ │ a 'starting tip' or not. │
│ 116 │ │ """ │
│ 117 │ │ if tip is None: │
│ ❱ 118 │ │ │ tip = self.create_tip(tip_shape, tip_length, tip_width, at_start) │
│ 119 │ │ else: │
│ 120 │ │ │ self.position_tip(tip, at_start) │
│ 121 │ │ self.reset_endpoints_based_on_tip(tip, at_start) │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/mobject/geometry/arc.py:136 in │
│ create_tip │
│ │
│ 133 │ │ """Stylises the tip, positions it spatially, and returns │
│ 134 │ │ the newly instantiated tip to the caller. │
│ 135 │ │ """ │
│ ❱ 136 │ │ tip = self.get_unpositioned_tip(tip_shape, tip_length, tip_width) │
│ 137 │ │ self.position_tip(tip, at_start) │
│ 138 │ │ return tip │
│ 139 │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/mobject/geometry/arc.py:166 in │
│ get_unpositioned_tip │
│ │
│ 163 │ │ color = self.get_color() │
│ 164 │ │ style.update({"fill_color": color, "stroke_color": color}) │
│ 165 │ │ style.update(self.tip_style) │
│ ❱ 166 │ │ tip = tip_shape(length=tip_length, **style) │
│ 167 │ │ return tip │
│ 168 │ │
│ 169 │ def position_tip(self, tip: tips.ArrowTip, at_start: bool = False): │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/mobject/geometry/tips.py:216 in │
│ __init__ │
│ │
│ 213 │ │ **kwargs, │
│ 214 │ ): │
│ 215 │ │ self.start_angle = start_angle │
│ ❱ 216 │ │ VMobject.__init__( │
│ 217 │ │ │ self, fill_opacity=fill_opacity, stroke_width=stroke_width, **kwargs │
│ 218 │ │ ) │
│ 219 │ │ self.set_points_as_corners( │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/mobject/types/vectorized_mobject.py:146 │
│ in __init__ │
│ │
│ 143 │ ): │
│ 144 │ │ self.fill_opacity = fill_opacity │
│ 145 │ │ self.stroke_opacity = stroke_opacity │
│ ❱ 146 │ │ self.stroke_width = stroke_width │
│ 147 │ │ if background_stroke_color is not None: │
│ 148 │ │ │ self.background_stroke_color: ManimColor = ManimColor( │
│ 149 │ │ │ │ background_stroke_color │
│ │
│ /home/user1/.local/lib/python3.10/site-packages/manim/utils/config_ops.py:63 in __set__ │
│ │
│ 60 │ │ return obj.data[self.name] │
│ 61 │ │
│ 62 │ def __set__(self, obj, array: np.ndarray): │
│ ❱ 63 │ │ obj.data[self.name] = array │
│ 64 │
│ 65 │
│ 66 class _Uniforms: │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'StealthTip' object has no attribute 'data'
```

## Additional comments

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 reproducing the provided scene with the OpenGL renderer, then inspect manim/mobject/geometry/tips.py and the vectorized mobject initialization shown in the traceback. Compare the StealthTip path with the Cairo path; done means the example renders in OpenGL without the AttributeError and produces the expected tip.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.