Commit graph

112 commits

Author SHA1 Message Date
Grant Sanderson
4cc2e5ed17 Consolidate camera configuration 2024-12-10 11:39:13 -06:00
Grant Sanderson
d4c5c4736a Move logic for window size and position into Window class 2024-12-10 11:07:54 -06:00
Grant Sanderson
178cca0ca5 Factor out get_window_position 2024-12-10 10:35:31 -06:00
Grant Sanderson
9e77b0dcdd Consolidate window configuration 2024-12-10 10:10:58 -06:00
Grant Sanderson
0ef12ad7e4 Move FRAME_HEIGHT back to constants
Where it belongs
2024-12-06 12:35:39 -07:00
Grant Sanderson
09c27a654f Minor cleaning of imports 2024-12-06 12:26:54 -07:00
Grant Sanderson
90dfb02cc6 Move get_scene_module logic to extract_scene.py 2024-12-06 12:24:16 -07:00
Grant Sanderson
e270f5c3d3 Change from get_module_with_inserted_embed_line to insert_embed_line_to_module
Rather than taking in a file_name and reading it in, directly take the module and edit its code.
2024-12-06 11:59:18 -07:00
Grant Sanderson
fadd045fc1 Don't write new file when inserting embed line
Instead, load the relevant module of the true file, and execute the modified code within that.

This also cleans up some of the previous now-unnecessary code around get_module_with_inserted_embed_line
2024-12-06 11:05:57 -07:00
Grant Sanderson
dd0aa14442 Clean up get_module_with_inserted_embed_line, only accept line number as embed arg 2024-12-06 10:39:02 -06:00
Grant Sanderson
d357e21c1d Change how ModuleLoader receives is_reload information
Use on the fly import of reload_manager rather than altering the args
2024-12-06 10:07:07 -06:00
Grant Sanderson
dd251ab8c2 Remove "preview" as a scene parameter, just look for whether window is None 2024-12-06 09:54:14 -06:00
Grant Sanderson
33c7f6d063 Factor out resolution from get_camera_config 2024-12-06 09:46:26 -06:00
Grant Sanderson
53b6c34ebe Create Window outside of Scene, and pass it in as an argument 2024-12-06 09:39:12 -06:00
Splines
6196daa5ec
Reload user-defined modules during reload() (#2257)
* Experiment a lot with module loading

* Extract methods out of experimental mess

* Fix get module return type

* Only reload() modules during reload() command

* Remove unnecessary default parameter

* Add docstrings and logging statements

* Delete unwanted printout

* Improve logging messages

* Extract methods to a new class ModuleLoader

* Remove unused builtins import

* exec_module in any case at the end

* Clarify docstrings & move get_module method up in file

* Add more additionally excluded modules as array

* Distinguish between user-defined modules and external libraries like numpy

* Improved tracked_import docstring

* Remove _insert_embed suffix before logging

* Fix args.is_reload not defined error

* Refine logic to determine whether module is user-defined or not

* Fix list vs. set type annotations

* Improve docstrings & change order of early return

* Fix spelling mistake of "Reloading"

* Try out custom deep reload

* Make deep reload more robust

* Also reload modules imported as classes

* Move early return up to greatly improve performance

* Clean up comments

* Make methods of Module Loader "private"

* Add backticks around function in docstring

---------

Co-authored-by: Grant Sanderson <grant@3blue1brown.com>
2024-12-05 16:18:10 -08:00
Grant Sanderson
94f6f0aa96
Cleaner local caching of Tex/Text data, and partially cleaned up configuration (#2259)
* Remove print("Reloading...")

* Change where exception mode is set, to be quieter

* Add default fallback monitor for when no monitors are detected

* Have StringMobject work with svg strings rather than necessarily writing to file

Change SVGMobject to allow taking in a string of svg code as an input

* Add caching functionality, and have Tex and Text both use it for saved svg strings

* Clean up tex_file_writing

* Get rid of get_tex_dir and get_text_dir

* Allow for a configurable cache location

* Make caching on disk a decorator, and update implementations for Tex and Text mobjects

* Remove stray prints

* Clean up how configuration is handled

In principle, all we need here is that manim looks to the default_config.yaml file, and updates it based on any local configuration files, whether in the current working directory or as specified by a CLI argument.

* Make the default size for hash_string an option

* Remove utils/customization.py

* Remove stray prints

* Consolidate camera configuration

This is still not optimal, but at least makes clearer the way that importing from constants.py kicks off some of the configuration code.

* Factor out configuration to be passed into a scene vs. that used to run a scene

* Use newer extract_scene.main interface

* Add clarifying message to note what exactly is being reloaded

* Minor clean up

* Minor clean up

* If it's worth caching to disk, then might as well do so in memory too during development

* No longer any need for custom hash_seeds in Tex and Text

* Remove display_during_execution

* Get rid of (no longer used) mobject_data directory reference

* Remove get_downloads_dir reference from register_font

* Update where downloads go

* Easier use of subdirectories in configuration

* Add new pip requirements
2024-12-05 14:51:14 -08:00
Grant Sanderson
6d23df0497 Clean up changes associated with fixing aspect ratio issue 2024-09-06 12:50:19 -05:00
Grant Sanderson
2178ec2b85
Merge branch 'master' into fix-aspect-ratio 2024-09-06 10:24:42 -07:00
Grant Sanderson
09bed1f8f4 Allow more file_writer configuration in default_config.yml 2024-08-22 14:24:26 -05:00
Grant Sanderson
d1314e5a3c Catch screeninfo.ScreenInfoError error 2024-07-31 15:23:41 +02:00
german2020
65e7943ff7 fix aspect_ratio other than 16:9 issue 2023-08-27 13:51:54 +08:00
Grant Sanderson
557cb66c52 Fix transparent background videos 2023-02-15 09:38:35 -08:00
Grant Sanderson
e1bb360e0b Add CLI args for setting video codec and pixel forma 2023-02-03 12:46:01 -08:00
Grant Sanderson
b25f022859 Make it an option (default to false) to prerun a scene to calculate its number of frames 2023-02-03 11:06:07 -08:00
Grant Sanderson
a1595a9e2f Use separate fbo for writing to file when window is active 2023-01-25 22:34:11 -08:00
Grant Sanderson
8a6deb4068 Enable recording during a Scene embed 2023-01-23 17:10:18 -08:00
Grant Sanderson
03080a10a7 Small style tweaks 2023-01-23 15:05:10 -08:00
Grant Sanderson
71815fd7de Add (optional) error sound for exceptions in Scene.embed 2022-12-29 14:58:40 -08:00
Grant Sanderson
cba101995f Allow for customizable exception display mode with Scene.embed 2022-12-29 14:38:25 -08:00
Grant Sanderson
623aef41f8 Rename get_camera_configuration -> get_camera_config 2022-12-20 09:36:07 -08:00
Grant Sanderson
9f71f87278 Refactor config.py 2022-12-20 09:31:02 -08:00
Grant Sanderson
a26fe605b3 Slight refactor for inserted_embed_line 2022-12-19 21:17:44 -08:00
Grant Sanderson
5c7caee902 Go back to writing a new file for insert_embed, but edit the module's __file__ attribute 2022-12-19 21:14:29 -08:00
Grant Sanderson
99dbf6b8c3 Edited insert_embed_line to write over existing file rather than creating a new one
Otherwise behavior of things like __file__ is not as expected.
2022-12-18 10:50:17 -08:00
Grant Sanderson
c00af3c1bf Rename config_ops -> dict_ops 2022-12-16 18:59:23 -08:00
Grant Sanderson
0c75d79080 Have window default to half monitor width instead of half height 2022-09-13 11:46:33 -07:00
Grant Sanderson
69bb4f026c Make sure Window matches aspect ratio of Camera 2022-07-19 12:57:25 -07:00
Grant Sanderson
0406557b5c Make sure CLI resolution updates will work 2022-07-19 12:46:45 -07:00
Grant Sanderson
77309a634b Fix to embed insertion 2022-05-29 16:37:00 -07:00
Grant Sanderson
6decb0c32a Rename frame_rate -> fps 2022-05-14 17:47:31 -07:00
Grant Sanderson
dd5d239971 Change convention for how camera_qualities are represented in default_config.yml 2022-05-14 17:29:07 -07:00
Grant Sanderson
584e259b44 Bug fix for mirrored directories 2022-05-11 12:44:51 -07:00
Grant Sanderson
c4d452248a Move mirror output path logic to config.py 2022-05-04 21:21:49 -07:00
Grant Sanderson
602fbd1a9f Fix -e for first line of scene 2022-05-01 15:31:31 -04:00
Grant Sanderson
52259af5df Don't show animation progress bar by default 2022-04-27 11:19:20 -07:00
Grant Sanderson
efe051b8e1 Revert to -e to create a new temporary file, rather than writing over the original 2022-04-24 10:28:53 -07:00
Grant Sanderson
d733687834 Have -e write over original source file, then correct 2022-04-23 10:16:11 -07:00
Grant Sanderson
2ba9243067 Merge branch 'master' of github.com:3b1b/manim into video-work 2022-04-23 09:03:53 -07:00
Grant Sanderson
71c14969df Refactor -e flag hackiness 2022-04-22 15:41:23 -07:00
Grant Sanderson
bb7fa2c8aa Update behavior of -e flag to take in (optional) strings as inputs 2022-04-22 10:17:15 -07:00