6227 Commits

Author SHA1 Message Date
dd0aa14442 Clean up get_module_with_inserted_embed_line, only accept line number as embed arg 2024-12-06 10:39:02 -06:00
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
dd251ab8c2 Remove "preview" as a scene parameter, just look for whether window is None 2024-12-06 09:54:14 -06:00
2e49c60148 Use config.get_resolution for constants 2024-12-06 09:49:21 -06:00
33c7f6d063 Factor out resolution from get_camera_config 2024-12-06 09:46:26 -06:00
53b6c34ebe Create Window outside of Scene, and pass it in as an argument 2024-12-06 09:39:12 -06:00
49c2b5cfe0 Check if animation.mobject is in the full family of scene mobjects before adding 2024-12-06 08:51:08 -06:00
09fb8d324e Merge branch 'master' of github.com:3b1b/manim into video-work 2024-12-05 18:18:28 -06:00
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
e05cae6775 Merge branch 'master' of github.com:3b1b/manim into video-work 2024-12-05 16:51:35 -06:00
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
0e83c9c0d9 Merge branch 'master' into video-work 2024-12-05 16:50:13 -06:00
5a70d67b98 Update coordinate_systems.py (#2258) 2024-12-05 14:49:16 -08:00
66862db9b2 Drop pyrr (#2256) 2024-12-05 14:43:14 -08:00
5d3f730824 Cleaning up some imports + Minor Bug fixed in VectorField (#2253)
* cleaning up imports

* sample_points -> sample_coords
2024-12-05 14:42:46 -08:00
3cd3e8cedc Add new pip requirements 2024-12-05 15:56:29 -06:00
08acfa6f1f Easier use of subdirectories in configuration 2024-12-05 15:52:39 -06:00
75527563de Update where downloads go 2024-12-05 15:27:57 -06:00
c96734ace0 Remove get_downloads_dir reference from register_font 2024-12-05 15:14:37 -06:00
71e440be93 Get rid of (no longer used) mobject_data directory reference 2024-12-05 15:08:25 -06:00
8098149006 Remove display_during_execution 2024-12-05 15:05:37 -06:00
4251ff436a No longer any need for custom hash_seeds in Tex and Text 2024-12-05 15:05:26 -06:00
85f8456228 If it's worth caching to disk, then might as well do so in memory too during development 2024-12-05 14:56:35 -06:00
e0031c63bc Minor clean up 2024-12-05 14:55:28 -06:00
361d9d0652 Minor clean up 2024-12-05 14:42:22 -06:00
1d14bae092 Add clarifying message to note what exactly is being reloaded 2024-12-05 14:37:14 -06:00
8dfd4c1c4e Use newer extract_scene.main interface 2024-12-05 14:36:43 -06:00
96a4a4b76f Factor out configuration to be passed into a scene vs. that used to run a scene 2024-12-05 14:36:21 -06:00
0496402c55 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.
2024-12-05 14:17:53 -06:00
fc32f162a0 Remove stray prints 2024-12-05 13:46:47 -06:00
3b9ef57b22 Remove utils/customization.py 2024-12-05 11:59:01 -06:00
b593cde317 Make the default size for hash_string an option 2024-12-05 11:53:55 -06:00
34ad61d013 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.
2024-12-05 11:53:18 -06:00
cfb7d2fa47 Remove stray prints 2024-12-05 10:09:48 -06:00
43821ab2ba Make caching on disk a decorator, and update implementations for Tex and Text mobjects 2024-12-05 10:09:15 -06:00
89ddfadf6b Allow for a configurable cache location 2024-12-04 20:50:42 -06:00
0c385e820f Get rid of get_tex_dir and get_text_dir 2024-12-04 20:33:43 -06:00
ac01b144e8 Clean up tex_file_writing 2024-12-04 20:30:53 -06:00
129e512b0c Add caching functionality, and have Tex and Text both use it for saved svg strings 2024-12-04 19:51:01 -06:00
88370d4d5d 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
2024-12-04 19:11:21 -06:00
671a31b298 Add default fallback monitor for when no monitors are detected 2024-12-03 15:14:48 -06:00
f8280a12be Change where exception mode is set, to be quieter 2024-11-30 10:08:54 -06:00
d78fe93743 Remove print("Reloading...") 2024-11-30 10:08:41 -06:00
8239f1bf35 Update README.md for better readability (#2246) 2024-11-26 10:11:04 -08:00
1fa17030a2 Add reload() command for interactive scene reloading (#2240)
* Init reload command (lots of things not working yet)

* Add back in class line (accidentally deleted)

* Add back in key modifiers (accidentally deleted)

* Unpack tuple from changed `get_module`

* Init MainRunManager & respawn IPython shell

* Init cleanup of scenes from manager

* Restore string quotes

* Still take `self.preview` into account

* Remove left-over code from module experimentation

* Remove double window activation

* Reset scenes array in RunManager

* Move self.args None check up

* Use first available window

* Don't use constructor for RunManager

* Use self. syntax

* Init moderngl context manually

* Add some comments for failed attempts to reset scene

* Reuse existing shell (this fixed the bug 🎉)

* Remove unused code

* Remove unnecessary intermediate ReloadSceneException

* Allow users to finally exit

* Rename main_run_manager to reload_manager

* Add docstrings to `ReloadManager`

* Improve reset management in window

* Clarify why we use magic exit_raise command

* Add comment about window reuse

* Improve docstrings in ReloadManager & handle case of 0 scenes

* Set scene and title earlier

* Run linter suggestions
2024-11-26 10:09:43 -08:00
530cb4f104 Merge pull request #2250 from 3b1b/video-work
Video work
2024-11-25 13:44:08 -06:00
85638d88dc Update parameter range for sphere 2024-11-25 12:39:41 -07:00
fbce0b132c Temporary band-aide for degenerate normal vector calculations
This solution is a bit too specific to the case of spheres.
2024-11-25 12:39:32 -07:00
dd51b696e5 Only apply non-flat-stroke correction in non-zero joint angle vertices 2024-11-25 12:35:32 -07:00
9cd6a87ff8 Make sure VMobject uniform flat_stroke matches the use inside the quadratic_bezier/stroke/geom.glsl code 2024-11-25 12:28:31 -07:00