ManimCommunity / ManimCommunity/manim
Arrow3D issue in `__init__` for `--renderer=opengl`
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
I try to run OpenGL as renderer for Arrow3D and I see the issue that the default `strokewidth` is `0.5`, which is a float and not `interable`:
```
manim/lib/python3.10/site-packages/manim/mobject/opengl/opengl_v │
│ ectorized_mobject.py:413 in has_stroke │
│ │
│ 410 │ │ return ( │
│ 411 │ │ │ stroke_widths is not None │
│ 412 │ │ │ and stroke_opacities is not None │
│ ❱ 413 │ │ │ and any(stroke_widths) │
│ 414 │ │ │ and any(stroke_opacities) │
│ 415 │ │ ) │
│ 416 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'float' object is not iterable
```
Code for reproducing the problem
```python
arrow = Arrow3D(
start=start_location,
end=end_location,
resolution=RES,
color=color,
)
```
This can be tackled by making https://github.com/ManimCommunity/manim/blob/27011d648f8a0fe0d79fd9187b21083a4009a940/manim/mobject/three_d/three_dimensions.py#L109 to :
```python
stroke_width: list = [0.5],
```
However, I am sure this is cosmetic and not the actual fix.
Contributor guide
Research direction
Start in manim/mobject/three_d/three_dimensions.py around the Arrow3D default stroke_width, then inspect has_stroke in manim/mobject/opengl/opengl_vectorized_mobject.py. Reproduce the issue with the provided Arrow3D example using --renderer=opengl and determine the appropriate type handling. Done means the example no longer raises the float-not-iterable 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