A community-maintained Python framework for creating mathematical animations.
Reset change to manim source code, to separate the PRs
MysaaJava9bb2a6cfbff9
diff --git a/manim/constants.py b/manim/constants.pyindex 63151a51b..2f13f226e 100644--- a/manim/constants.py+++ b/manim/constants.py@@ -6,6 +6,17 @@ import numpy as np# Messages+NOT_SETTING_FONT_MSG = """+You haven't set font.+If you are not using English, this may cause text rendering problem.+You set font like:+text = Text('your text', font='your font')+or:+class MyText(Text):+ CONFIG = {+ 'font': 'My Font'+ }+"""SCENE_NOT_FOUND_MESSAGE = """{} is not in the script"""diff --git a/manim/mobject/svg/text_mobject.py b/manim/mobject/svg/text_mobject.pyindex 45fac31e3..906be3d17 100644--- a/manim/mobject/svg/text_mobject.py+++ b/manim/mobject/svg/text_mobject.py@@ -307,9 +307,8 @@ class CairoText(SVGMobject):line_spacing = self.line_spacing * 10if self.font == "":- logger.warning(- "You haven't set a font, non-english characters may not be rendered correctly"- )+ if NOT_SETTING_FONT_MSG:+ logger.warning(NOT_SETTING_FONT_MSG)dir_name = file_writer_config["text_dir"]if not os.path.exists(dir_name):@@ -935,5 +934,8 @@ class Text(CairoText):"""def __init__(self, text, **config):- logger.warning("Text currently uses Cairo Toy API, but will soon use PangoText")+ logger.warning(+ "Using Text uses Cairo Toy API to Render Text."+ "Using PangoText is recommended and soon Text would point to PangoText"+ )CairoText.__init__(self, text, **config)diff --git a/manim/mobject/types/image_mobject.py b/manim/mobject/types/image_mobject.pyindex 1210541fa..e0bb9c94f 100644--- a/manim/mobject/types/image_mobject.py+++ b/manim/mobject/types/image_mobject.py@@ -49,38 +49,6 @@ class AbstractImageMobject(Mobject):class ImageMobject(AbstractImageMobject):- """Displays an Image from a numpy array or a file.-- Examples- --------- .. manim:: ImageFromArray- :save_last_frame:-- class ImageFromArray(Scene):- def construct(self):- image = ImageMobject(np.uint8([[0, 100, 30, 200],- [255, 0, 5, 33]]))- image.set_height(7)- self.add(image)-- .. manim:: ImageFromFile- :save_last_frame:-- class ImageFromFile(Scene):- def construct(self):- # Use PIL when you want to import an image from the web- import requests- from PIL import Image- img = Image.open(requests.get("https://raw.githubusercontent.com/ManimCommunity/manim/master/logo/cropped.png",- stream=True).raw)- img_mobject = ImageMobject(img)- # this line, when you want to import your Image on your machine- # img_mobject = ImageMobject("<your image address>")- img_mobject.scale(3)- self.add(img_mobject)-- """-CONFIG = {"invert": False,"image_mode": "RGBA",diff --git a/manim/scene/scene.py b/manim/scene/scene.pyindex 5ccfcf79c..108725cf6 100644--- a/manim/scene/scene.py+++ b/manim/scene/scene.py@@ -781,10 +781,8 @@ class Scene(Container):Parameters----------- args- Animation or mobject with mobject method and params- kwargs- named parameters affecting what was passed in ``args`` e.g. ``run_time``, ``lag_ratio`` etc.+ *args : Animation or mobject with mobject method and params+ **kwargs : named parameters affecting what was passed in *args e.g run_time, lag_ratio etc."""if len(args) == 0:warnings.warn("Called Scene.play with no animations")diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.pyindex bde2caaa8..e11647715 100644--- a/manim/scene/scene_file_writer.py+++ b/manim/scene/scene_file_writer.py@@ -77,48 +77,46 @@ class SceneFileWriter(object):)if file_writer_config["write_to_movie"]:- pass- if file_writer_config["video_dir"]:+ if file_writer_config["video_dir"]:+ if not file_writer_config["custom_folders"]:+ movie_dir = guarantee_existence(+ os.path.join(+ file_writer_config["video_dir"],+ module_directory,+ self.get_resolution_directory(),+ )+ )+ else:+ movie_dir = guarantee_existence(+ os.path.join(file_writer_config["video_dir"])+ )+ self.movie_file_path = os.path.join(+ movie_dir,+ add_extension_if_not_present(+ default_name, file_writer_config["movie_file_extension"]+ ),+ )+ self.gif_file_path = os.path.join(+ movie_dir,+ add_extension_if_not_present(default_name, GIF_FILE_EXTENSION),+ )if not file_writer_config["custom_folders"]:- movie_dir = guarantee_existence(+ self.partial_movie_directory = guarantee_existence(os.path.join(- file_writer_config["video_dir"],- module_directory,- self.get_resolution_directory(),+ movie_dir,+ "partial_movie_files",+ default_name,))else:- movie_dir = guarantee_existence(- os.path.join(file_writer_config["video_dir"])- )- self.movie_file_path = os.path.join(- movie_dir,- add_extension_if_not_present(- default_name, file_writer_config["movie_file_extension"]- ),- )- self.gif_file_path = os.path.join(- movie_dir,- add_extension_if_not_present(default_name, GIF_FILE_EXTENSION),- )- # The partial movie directory has to be set even if we do not write to movie- if not file_writer_config["custom_folders"]:- self.partial_movie_directory = guarantee_existence(- os.path.join(- movie_dir,- "partial_movie_files",- default_name,- )- )- else:- self.partial_movie_directory = guarantee_existence(- os.path.join(- file_writer_config["media_dir"],- "temp_files",- "partial_movie_files",- default_name,+ self.partial_movie_directory = guarantee_existence(+ os.path.join(+ file_writer_config["media_dir"],+ "temp_files",+ "partial_movie_files",+ default_name,+ ))- )def add_partial_movie_file(self, hash_animation):"""Adds a new partial movie file path to scene.partial_movie_files from an hash. This method will compute the path from the hash.@@ -484,14 +482,11 @@ class SceneFileWriter(object)::class:`bool`Whether the file exists."""- if hasattr(self, "partial_movie_directory"):- path = os.path.join(- self.partial_movie_directory,- "{}{}".format(hash_invocation, self.movie_file_extension),- )- return os.path.exists(path)- else:- return False # If there is no partial movie directory, then the file is not cached+ path = os.path.join(+ self.partial_movie_directory,+ "{}{}".format(hash_invocation, self.movie_file_extension),+ )+ return os.path.exists(path)def combine_movie_files(self):"""