From 012a9579c5ae26cf9c2841611727655dd712d3cb Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Mon, 8 May 2017 08:32:56 -0700 Subject: [PATCH] PiCreature scenes shouldn't break, though specific designs are still out of the public repo --- README.md | 33 +++++++++++++++++++ files/images/PiCreature/PiCreatures_plain.svg | 24 ++++++++++++++ topics/characters.py | 20 +++++++---- 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 files/images/PiCreature/PiCreatures_plain.svg diff --git a/README.md b/README.md index 4a32a46e..8dacec4e 100644 --- a/README.md +++ b/README.md @@ -39,3 +39,36 @@ Try running the following: python extract_scene.py -p example_scenes.py SquareToCircle -p gives a preview of an animation, -w will write it to a file, and -s will show/save the final image in the animation. + +Look through the old_projects folder to see the code for previous 3b1b videos. + +While developing a scene, the -s flag is helpful to just see what things look like at the end without having to generate the full animation. It can also be helpful to put self.force_skipping() at the top of the construct method, and self.revert_to_original_skipping_status() before the portion of the scene that you want to test, and run with the -p flag to just see a preview of one part of the scene. + +Scene with PiCreatures are somewhat 3b1b specific, so the specific designs for various expressions are not part of the public repo. You should still be able to run them, but they will fall back on using the "plain" expression for the creature. + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/files/images/PiCreature/PiCreatures_plain.svg b/files/images/PiCreature/PiCreatures_plain.svg new file mode 100644 index 00000000..552043d6 --- /dev/null +++ b/files/images/PiCreature/PiCreatures_plain.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/topics/characters.py b/topics/characters.py index d42785b3..817aad17 100644 --- a/topics/characters.py +++ b/topics/characters.py @@ -39,12 +39,20 @@ class PiCreature(SVGMobject): } def __init__(self, mode = "plain", **kwargs): self.parts_named = False - svg_file = os.path.join( - PI_CREATURE_DIR, - "PiCreatures_%s.svg"%mode - ) - digest_config(self, kwargs, locals()) - SVGMobject.__init__(self, file_name = svg_file, **kwargs) + try: + svg_file = os.path.join( + PI_CREATURE_DIR, + "PiCreatures_%s.svg"%mode + ) + SVGMobject.__init__(self, file_name = svg_file, **kwargs) + except: + warnings.warn("No PiCreature design with mode %s"%mode) + svg_file = os.path.join( + PI_CREATURE_DIR, + "PiCreatures_plain.svg" + ) + SVGMobject.__init__(self, file_name = svg_file, **kwargs) + if self.flip_at_start: self.flip() if self.start_corner is not None: