Commit graph

6305 commits

Author SHA1 Message Date
Grant Sanderson
178cca0ca5 Factor out get_window_position 2024-12-10 10:35:31 -06:00
Grant Sanderson
c02259a39e Remove import 2024-12-10 10:35:21 -06:00
Grant Sanderson
1276724891 Pull out the initial Window.to_default_position from init_for_scene 2024-12-10 10:14:59 -06:00
Grant Sanderson
9e77b0dcdd Consolidate window configuration 2024-12-10 10:10:58 -06:00
Grant Sanderson
1a14a6bd0d
Merge pull request #2262 from 3b1b/video-work
Refactor scene creation
2024-12-10 09:53:18 -06:00
Grant Sanderson
950ac31b9b Replace IGNORE_MANIMLIB_MODULES constant with a piece of global configuration 2024-12-09 16:57:55 -06:00
Grant Sanderson
8706ba1589 No real need to track ReloadManager.scenes
This was to be able to loop through an tear them down, but tear down is primarily about ending any file writing, and potentially cleaning up a window, which for the sake of reusing a window we don't want to do anyway.
2024-12-09 16:46:13 -06:00
Grant Sanderson
dd508b8cfc No need to track ReloadManager.start_at_line 2024-12-09 16:43:08 -06:00
Grant Sanderson
88bae476ce Don't print filename that is being reloaded 2024-12-09 16:25:18 -06:00
Grant Sanderson
7a69807ce6 Remove mobject.save_to_file
This simply didn't work, and had no resilience to changes to the library. For cases where this might be useful, it's likely much better deliberately save specific data which is time-consuming to generate on the fly.
2024-12-09 16:24:50 -06:00
Grant Sanderson
6d0b23f914 Slightly simplify ReloadManager 2024-12-09 16:14:27 -06:00
Grant Sanderson
bf81d94362 Don't make reload_manager a global variable 2024-12-09 15:54:16 -06:00
Grant Sanderson
5b315d5c70 Get rid of the (hacky) solution to redefining Scene methods, since reload handles it better 2024-12-09 14:02:22 -06:00
Grant Sanderson
cb3e115a6c Minor cleaning 2024-12-09 14:01:34 -06:00
Grant Sanderson
40b5c7c1c1 Slightly clean up interactive_scene_embed 2024-12-09 13:56:33 -06:00
Grant Sanderson
636fb3a45b Factor interactive embed logic out of Scene class 2024-12-09 13:53:03 -06:00
Grant Sanderson
ea3f77e3f1 Add blank line 2024-12-09 11:59:22 -06:00
Grant Sanderson
0692afdfec Bug fix 2024-12-09 11:59:16 -06:00
Grant Sanderson
14c6fdc1d9 Slight refactor of get_indent 2024-12-09 09:49:48 -06:00
Grant Sanderson
89bf0b1297 Track all mobjects as a set in Scene. begin_animations 2024-12-07 08:21:33 -07:00
Grant Sanderson
2e8a282cc7 Merge branch 'master' of github.com:3b1b/manim into video-work 2024-12-07 08:15:11 -07:00
Grant Sanderson
5fa99b7723 Set default log level to "WARNING" 2024-12-07 08:14:56 -07:00
Benjamín Ubilla
df1e067480
Fix 3D overlap when animating by checking Mobject family members recursively instead of self.mobjects (#2254)
* Add Animation.setup_scene method to make Animation more customizable

* Remove Animation.setup_scene method and let scene check all mobject family members
2024-12-07 07:13:35 -08: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
2e49c60148 Use config.get_resolution for constants 2024-12-06 09:49:21 -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
Grant Sanderson
49c2b5cfe0 Check if animation.mobject is in the full family of scene mobjects before adding 2024-12-06 08:51:08 -06:00
Grant Sanderson
09fb8d324e Merge branch 'master' of github.com:3b1b/manim into video-work 2024-12-05 18:18:28 -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
e05cae6775 Merge branch 'master' of github.com:3b1b/manim into video-work 2024-12-05 16:51:35 -06: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
0e83c9c0d9
Merge branch 'master' into video-work 2024-12-05 16:50:13 -06:00
Iñaki Rabanillo
5a70d67b98
Update coordinate_systems.py (#2258) 2024-12-05 14:49:16 -08:00
henri-gasc
66862db9b2
Drop pyrr (#2256) 2024-12-05 14:43:14 -08:00
Varniex
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
Grant Sanderson
3cd3e8cedc Add new pip requirements 2024-12-05 15:56:29 -06:00
Grant Sanderson
08acfa6f1f Easier use of subdirectories in configuration 2024-12-05 15:52:39 -06:00
Grant Sanderson
75527563de Update where downloads go 2024-12-05 15:27:57 -06:00
Grant Sanderson
c96734ace0 Remove get_downloads_dir reference from register_font 2024-12-05 15:14:37 -06:00
Grant Sanderson
71e440be93 Get rid of (no longer used) mobject_data directory reference 2024-12-05 15:08:25 -06:00
Grant Sanderson
8098149006 Remove display_during_execution 2024-12-05 15:05:37 -06:00
Grant Sanderson
4251ff436a No longer any need for custom hash_seeds in Tex and Text 2024-12-05 15:05:26 -06:00