ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
26.7k stars 1.83k forks source link

Previewing manim output with option -n 0,0 #4012

Closed dan-whitman closed 1 week ago

dan-whitman commented 1 week ago

Description of bug / unexpected behavior

I am trying to set up macros on Sublime to automatically render and preview certain portions of my code. When I try to only preview the first animation of a scene using -pql -n 0,0, it renders all animations for the scene. Every other animation number I tried (-n 1,1; -n 2,2; etc.) worked as expected.

Expected behavior

I would expect -pql -n 0,0 to only preview the first animation of the scene.

How to reproduce the issue

Code for reproducing the problem ```py class SquareToCircle(Scene): def construct(self): circle = Circle() # create a circle circle.set_fill(PINK, opacity=0.5) # set the color and transparency square = Square() square.rotate(PI / 4) self.play(Create(square)) self.play(Transform(square, circle)) self.play(FadeOut(square)) ``` Running with command: manim {filepath}\{filename} SquareToCircle -pql --progress_bar none -n #,# in Windows command prompt. ## Additional media files
Images/GIFs ![SquareToCircle_ManimCE_v0 18 1](https://github.com/user-attachments/assets/27eb547f-7ba8-4450-9368-7b84c999b7f2)
## Logs
Terminal output ``` C:\Users\danie\OneDrive\Documents\Videos\Test>manim C:\Users\danie\OneDrive\Documents\Videos\Test\scene.py SquareToCircle -pql --progress_bar none -n 0,0 -v DEBUG --format gif Manim Community v0.18.1 [11/12/24 16:28:42] DEBUG Hashing ... hashing.py:352 DEBUG Hashing done in 0.005330 s. hashing.py:364 DEBUG Hash generated : 1185818338_1063976082_223132457 hashing.py:367 INFO Animation 0 : Using cached data (hash : cairo_renderer.py:88 1185818338_1063976082_223132457) DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:97 ['1185818338_1063976082_223132457'] DEBUG Hashing ... hashing.py:352 DEBUG Hashing done in 0.006418 s. hashing.py:364 DEBUG Hash generated : 624642324_166878160_3256495558 hashing.py:367 INFO Animation 1 : Using cached data (hash : cairo_renderer.py:88 624642324_166878160_3256495558) DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:97 ['1185818338_1063976082_223132457', '624642324_166878160_3256495558'] DEBUG Hashing ... hashing.py:352 DEBUG Hashing done in 0.003641 s. hashing.py:364 DEBUG Hash generated : 624642324_208288666_3256495558 hashing.py:367 INFO Animation 2 : Using cached data (hash : cairo_renderer.py:88 624642324_208288666_3256495558) DEBUG List of the first few animation hashes of the scene: cairo_renderer.py:97 ['1185818338_1063976082_223132457', '624642324_166878160_3256495558', '624642324_208288666_3256495558'] INFO Combining to Movie file. scene_file_writer.py:617 DEBUG Partial movie files to combine (3 files): scene_file_writer.py:561 ['C:\\Users\\danie\\OneDrive\\Documents\\Videos\\Test\\media\\vid eos\\scene\\480p15\\partial_movie_files\\SquareToCircle\\11858183 38_1063976082_223132457.mp4', 'C:\\Users\\danie\\OneDrive\\Documents\\Videos\\Test\\media\\vide os\\scene\\480p15\\partial_movie_files\\SquareToCircle\\624642324 _166878160_3256495558.mp4', 'C:\\Users\\danie\\OneDrive\\Documents\\Videos\\Test\\media\\vide os\\scene\\480p15\\partial_movie_files\\SquareToCircle\\624642324 _208288666_3256495558.mp4'] INFO scene_file_writer.py:737 File ready at 'C:\Users\danie\OneDrive\Documents\Videos\Test\media\videos\scene \480p15\SquareToCircle_ManimCE_v0.18.1.gif' INFO Rendered SquareToCircle scene.py:247 Played 3 animations INFO Previewed File at: file_ops.py:231 'C:\Users\danie\OneDrive\Documents\Videos\Test\media\videos\scene\480p15\S quareToCircle_ManimCE_v0.18.1.gif' ```
## System specifications
System Details - OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 10 v22H2 - RAM: 16 Gb - Python version (`python/py/python3 --version`): 3.12.7 - Installed modules (provide output from `pip list`): ``` asttokens 2.4.1 click 8.1.7 cloup 3.0.5 colorama 0.4.6 contourpy 1.3.0 cycler 0.12.1 decorator 5.1.1 executing 2.1.0 fonttools 4.54.1 glcontext 3.0.0 ipython 8.29.0 isosurfaces 0.1.2 jedi 0.19.2 kiwisolver 1.4.7 manim 0.18.1 ManimPango 0.6.0 mapbox_earcut 1.0.2 markdown-it-py 3.0.0 matplotlib 3.9.2 matplotlib-inline 0.1.7 mdurl 0.1.2 moderngl 5.12.0 moderngl-window 2.4.6 multipledispatch 1.0.0 networkx 3.4.2 numpy 1.26.4 packaging 24.2 parso 0.8.4 pillow 11.0.0 pip 24.3.1 prompt_toolkit 3.0.48 pure_eval 0.2.3 pycairo 1.27.0 pydub 0.25.1 pyglet 2.0.18 Pygments 2.18.0 pyparsing 3.2.0 pyrr 0.10.3 python-dateutil 2.9.0.post0 rich 13.9.4 scipy 1.14.1 screeninfo 0.8.1 six 1.16.0 skia-pathops 0.8.0.post2 srt 3.5.3 stack-data 0.6.3 svgelements 1.9.6 tqdm 4.66.6 traitlets 5.14.3 typing_extensions 4.12.2 watchdog 6.0.0 wcwidth 0.2.13 ```
## Additional comments
behackl commented 1 week ago

Thanks for the report! Indeed, this was a bug with how the flag was handled internally -- I've implemented a fix in #4013, should be fixed in the upcoming release. 👍

dan-whitman commented 1 week ago

Great! Thanks for being on top of it!