274 Commits

Author SHA1 Message Date
f9fc543b07 Merge branch 'master' of github.com:3b1b/manim into video-work 2024-12-11 10:36:52 -06:00
13fdc9629d No need for the shortcuts into the manim_config 2024-12-11 09:58:51 -06:00
5fcb668f07 fixing get_ipython import error 2024-12-11 16:40:56 +05:30
9fcdd0de5f Use pyglet.window.key for key constant values 2024-12-10 20:00:03 -06:00
c9b6ee57a8 Make default_wait_time a piece of scene configuration 2024-12-10 19:21:16 -06:00
1d67768a13 Move reload out of Scene, instead have it directly update the global run configuration 2024-12-10 14:34:46 -06:00
f9fa8ac846 Make scene configuration part of the global configuration 2024-12-10 13:58:03 -06:00
bcc4235e2f Move embed configuration out of Scene, and get rid of error sound option 2024-12-10 12:43:29 -06:00
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
bf81d94362 Don't make reload_manager a global variable 2024-12-09 15:54:16 -06:00
40b5c7c1c1 Slightly clean up interactive_scene_embed 2024-12-09 13:56:33 -06:00
636fb3a45b Factor interactive embed logic out of Scene class 2024-12-09 13:53:03 -06:00
89bf0b1297 Track all mobjects as a set in Scene. begin_animations 2024-12-07 08:21:33 -07:00
dd251ab8c2 Remove "preview" as a scene parameter, just look for whether window is None 2024-12-06 09:54:14 -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
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
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
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
1248abd922 Merge pull request #2233 from mitkonikov/modifier-keys-fix
Properly check modifier keys.
2024-11-25 10:09:10 -06:00
af923a2327 Add docstring to user-facing focus() method 2024-11-10 19:10:53 +01:00
97b6e39abb Init new focus() command 2024-11-10 18:48:33 +01:00
693a859caf revert changes in mobject.py and camera.py 2024-10-27 14:10:12 -03:00
1738876f43 fix bad 3D overlapping using z_index 2024-10-27 14:06:35 -03:00
dc731f8bf2 Properly check modifier keys. 2024-10-25 00:01:30 +02:00
2dd0256af6 Instantiate the IPython shell without a local ns 2024-10-12 22:02:43 -03:00
81b17dd63e Merge pull request #2168 from zhujisheng/patch-1
Update scene.py to make scene.time more accurate
2024-10-10 12:24:05 -07:00
154a473a12 Get rid of globals update locals hack
It seems this issues is no longer there in the case of list constructors(?). Although it still exists for functions defined within a cell, that can be circumvented with more explicit function arguments.
2024-10-10 14:05:43 -05:00
ccb9977a67 Update scene.py to make scene.time more accurate
When the time intervals are (0, dt, 2dt, ...), during the first frame processing, only the video is inserted, but the update parameter is 0, which causes scene.time to be inaccurate. The correct time intervals should be (dt, 2dt, ...)
2024-09-23 23:48:18 +08:00
1f55832a6a Clean up around z_index 2024-09-06 12:20:26 -05:00
aebf2220a6 Merge pull request #2057 from germanzhu/add-zorder-mobject
add zorder to mobject
2024-09-06 10:11:40 -07:00
08f7cb8d3e zorder -> z_index 2024-09-06 10:11:31 -07:00
55a798676a Always stop skipping after checkpoint_paste 2024-08-26 11:41:50 -05:00
51de1fb650 For some reason RenderGroups must be groups for camera reorientation to function 2024-08-23 14:56:35 -05:00
a823901b98 Only form render groups from Mobjects of the same type
I.e. bias against forming such groups
2024-08-23 14:45:27 -05:00
fcc5dc00f9 Treat objects fixed in frame as having flat stroke 2024-08-23 14:17:26 -05:00
11df256369 Fix error rect 2024-08-21 16:49:08 -05:00
7474ae17b0 Change default to flat stroke, except in 3d situations 2024-08-20 11:52:05 -05:00
f12b143d16 Unify get_shader_wrapper_list, and and better subdivide render groups by ShaderWrapper ids 2024-08-20 08:53:51 -05:00
08e33faab8 Ensure scene properly updates on an embed 2024-08-19 21:49:39 -05:00
21c0bcb8b6 Don't wait for animations while skipping 2024-08-16 12:20:49 -05:00
902a4f264e Add white space after assert statements 2024-08-16 12:15:55 -05:00
65d5947966 Change ignore_skipping name to force_draw 2024-08-15 14:05:32 -05:00
a5ba721f96 Cease useless rendering
Change so that with a live window, rendering only happens if there has been an event (mouse motion, key press, etc.) to respond to.
2024-08-15 14:03:16 -05:00
bbc89d13e9 Don't save state after each embed cell call 2024-07-31 15:32:08 +02:00
c1efd14904 Add touch and notouch to embed vocabulary 2024-07-31 15:24:50 +02:00
a07ccf4aca Include *args, **kwargs in embed shell event pre_cell and post_cell functions 2024-06-24 15:22:22 -07:00
83cd5d6246 Clean up updater matters, prune unused functions 2024-03-07 16:07:39 -03:00
9432a73a9f Let checkpoint_paste work on methods of the current scene 2024-03-02 16:49:54 -05:00
ffbe5c8114 Add type hints for affects_mobject_list 2024-03-02 16:49:35 -05:00