Skip to content

ImageMobject misses attributes when rendered with OpenGL #3113

Open
@Papierkorb2292

Description

@Papierkorb2292

Description of bug / unexpected behavior

When using adding an ImageMobject to a scene rendered with OpenGL, an error is raised about it missing the should_render attribute.

Expected behavior

The missing should_render attribute should be added by OpenGLImageMobject and the error thus not thrown.

How to reproduce the issue

Code for reproducing the problem

Run with manim -pql main.py OpenGLImage --renderer=opengl

class OpenGLImage(Scene):
    def construct(self):
        self.add(ImageMobject("path/to/any/image"))

Additional media files

Images/GIFs

Logs

Terminal output
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ PROJECT\venv\lib\site-pack │
│ ages\manim\cli\render\commands.py:97 in render                                                   │
│                                                                                                  │
│    94 │   │   │   │   for SceneClass in scene_classes_from_file(file):                           │
│    95 │   │   │   │   │   with tempconfig({}):                                                   │
│    96 │   │   │   │   │   │   scene = SceneClass(renderer)                                       │
│ ❱  97 │   │   │   │   │   │   rerun = scene.render()                                             │
│    98 │   │   │   │   │   if rerun or config["write_all"]:                                       │
│    99 │   │   │   │   │   │   renderer.num_plays = 0                                             │
│   100 │   │   │   │   │   │   continue                                                           │
│                                                                                                  │
│ PROJECT\venv\lib\site-pack │
│ ages\manim\scene\scene.py:233 in render                                                          │
│                                                                                                  │
│    230 │   │   │   return True                                                                   │
│    231 │   │   self.tear_down()                                                                  │
│    232 │   │   # We have to reset these settings in case of multiple renders.                    │
│ ❱  233 │   │   self.renderer.scene_finished(self)                                                │
│    234 │   │                                                                                     │
│    235 │   │   # Show info only if animations are rendered or to get image                       │
│    236 │   │   if (                                                                              │
│                                                                                                  │
│  PROJECT\venv\lib\site-pack │
│ ages\manim\renderer\opengl_renderer.py:489 in scene_finished                                     │
│                                                                                                  │
│   486 │   │                                                                                      │
│   487 │   │   if self.should_save_last_frame():                                                  │
│   488 │   │   │   config.save_last_frame = True                                                  │
│ ❱ 489 │   │   │   self.update_frame(scene)                                                       │
│   490 │   │   │   self.file_writer.save_final_image(self.get_image())                            │
│   491 │                                                                                          │
│   492 │   def should_save_last_frame(self):                                                      │
│                                                                                                  │
│  PROJECT\venv\lib\site-pack │
│ ages\manim\renderer\opengl_renderer.py:468 in update_frame                                       │
│                                                                                                  │
│   465 │   │   self.refresh_perspective_uniforms(scene.camera)                                    │
│   466 │   │                                                                                      │
│   467 │   │   for mobject in scene.mobjects:                                                     │
│ ❱ 468 │   │   │   if not mobject.should_render:                                                  │
│   469 │   │   │   │   continue                                                                   │
│   470 │   │   │   self.render_mobject(mobject)                                                   │
│   471                                                                                            │
│                                                                                                  │
│  PROJECT\venv\lib\site-pack │
│ ages\manim\mobject\mobject.py:660 in __getattr__                                                 │
│                                                                                                  │
│    657 │   │   │   return types.MethodType(setter, self)                                         │
│    658 │   │                                                                                     │
│    659 │   │   # Unhandled attribute, therefore error                                            │
│ ❱  660 │   │   raise AttributeError(f"{type(self).__name__} object has no attribute '{attr}'")   │
│    661 │                                                                                         │
│    662 │   @property                                                                             │
│    663 │   def width(self):                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: ImageMobject object has no attribute 'should_render'

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Microsoft Windows 10 Pro 10.0.19044
  • RAM: 16GB
  • Python version (python/py/python3 --version): Python 3.9.0
  • Installed modules (provide output from pip list):
Package             Version
------------------- ------------
certifi             2022.12.7
charset-normalizer  2.1.1
click               8.1.3
click-default-group 1.2.2
cloup               0.13.1
colorama            0.4.6
colour              0.1.5
commonmark          0.9.1
decorator           5.1.1
ffmpeg-python       0.2.0
filelock            3.9.0
future              0.18.2
glcontext           2.3.7
gTTS                2.3.0
huggingface-hub     0.11.1
humanhash3          0.0.6
idna                3.4
isosurfaces         0.1.0
manim               0.17.2
manim-voiceover     0.2.1.post1
ManimPango          0.4.3
mapbox-earcut       1.0.1
moderngl            5.7.4
moderngl-window     2.4.2
more-itertools      9.0.0
multipledispatch    0.6.0
mutagen             1.46.0
networkx            2.8.8
numpy               1.24.1
packaging           22.0
Pillow              9.3.0
pip                 21.3.1
playsound           1.3.0
PyAudio             0.2.13
pycairo             1.23.0
pydub               0.25.1
pyglet              2.0.2.1
Pygments            2.14.0
pynput              1.7.6
pyrr                0.10.3
python-dotenv       0.21.0
PyYAML              6.0
regex               2022.10.31
requests            2.28.1
rich                13.0.0
scipy               1.9.3
screeninfo          0.8.1
setuptools          60.2.0
six                 1.16.0
skia-pathops        0.7.4
sox                 1.4.1
srt                 3.5.2
stable-ts           1.0.1
svgelements         1.9.0
tokenizers          0.13.2
torch               1.13.1
torchaudio          0.13.1+cu116
torchvision         0.14.1+cu116
tqdm                4.64.1
transformers        4.25.1
typing_extensions   4.4.0
urllib3             1.26.13
watchdog            2.2.1
wheel               0.37.1
whisper             1.0
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020): NONE
  • Installed LaTeX packages:
FFMPEG

Output of ffmpeg -version:

ffmpeg version 5.1.2-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil      57. 28.100 / 57. 28.100
libavcodec     59. 37.100 / 59. 37.100
libavformat    59. 27.100 / 59. 27.100
libavdevice    59.  7.100 / 59.  7.100
libavfilter     8. 44.100 /  8. 44.100
libswscale      6.  7.100 /  6.  7.100
libswresample   4.  7.100 /  4.  7.100
libpostproc    56.  6.100 / 56.  6.100

Additional comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions