13 次代码提交 99493fc4f7 ... 0c7c9dee93

作者 SHA1 备注 提交日期
  Grant Sanderson 0c7c9dee93 Merge branch 'master' of github.com:3b1b/manim into video-work 4 天之前
  Grant Sanderson 1a65498f97 Merge pull request #2218 from 3b1b/3b1b-patch-1 4 天之前
  Grant Sanderson a34c4482f6 Update setup.cfg 4 天之前
  Grant Sanderson e3e87f6110 Update Pango requirement 4 天之前
  Grant Sanderson aaa28a2712 Discard transparent parts of textured surfaces 4 天之前
  Grant Sanderson d499544366 Merge pull request #2180 from fofoni/fix-ipython-scope 1 周之前
  Pedro Fonini 2dd0256af6 Instantiate the IPython shell without a local ns 1 周之前
  Grant Sanderson d4080b8978 Merge pull request #2179 from 3b1b/3b1b-patch-1 1 周之前
  Grant Sanderson 23c9e67fa4 Reference workflow documentation 1 周之前
  Grant Sanderson cce4ffbb60 Merge pull request #2177 from 3b1b/video-work 1 周之前
  Grant Sanderson 81b17dd63e Merge pull request #2168 from zhujisheng/patch-1 1 周之前
  Grant Sanderson 15e5d8a07a Merge pull request #2176 from 3b1b/video-work 1 周之前
  zhujisheng ccb9977a67 Update scene.py to make scene.time more accurate 4 周之前
共有 5 个文件被更改,包括 21 次插入22 次删除
  1. 3 3
      README.md
  2. 11 14
      manimlib/scene/scene.py
  3. 1 0
      manimlib/shaders/textured_surface/frag.glsl
  4. 1 1
      requirements.txt
  5. 5 4
      setup.cfg

文件差异内容过多而无法显示
+ 3 - 3
README.md


+ 11 - 14
manimlib/scene/scene.py

@@ -220,14 +220,14 @@ class Scene(object):
         self.save_state()
         self.show_animation_progress = show_animation_progress
 
-        # Create embedded IPython terminal to be configured
-        shell = InteractiveShellEmbed.instance()
-
-        # Use the locals namespace of the caller
+        # Create embedded IPython terminal configured to have access to
+        # the local namespace of the caller
         caller_frame = inspect.currentframe().f_back
-        local_ns = dict(caller_frame.f_locals)
+        module = get_module(caller_frame.f_globals["__file__"])
+        shell = InteractiveShellEmbed(user_module=module)
 
-        # Add a few custom shortcuts
+        # Add a few custom shortcuts to that local namespace
+        local_ns = dict(caller_frame.f_locals)
         local_ns.update(
             play=self.play,
             wait=self.wait,
@@ -244,6 +244,9 @@ class Scene(object):
             notouch=lambda: shell.enable_gui(None),
         )
 
+        # Update the shell module with the caller's locals + shortcuts
+        module.__dict__.update(local_ns)
+
         # Enables gui interactions during the embed
         def inputhook(context):
             while not context.input_is_ready():
@@ -278,13 +281,7 @@ class Scene(object):
         shell.magic(f"xmode {self.embed_exception_mode}")
 
         # Launch shell
-        shell(
-            local_ns=local_ns,
-            # Pretend like we're embeding in the caller function, not here
-            stack_depth=2,
-            # Specify that the present module is the caller's, not here
-            module=get_module(caller_frame.f_globals["__file__"])
-        )
+        shell()
 
         # End scene when exiting an embed
         if close_scene_on_exit:
@@ -541,7 +538,7 @@ class Scene(object):
         if self.skip_animations and not override_skip_animations:
             return [run_time]
 
-        times = np.arange(0, run_time, 1 / self.camera.fps)
+        times = np.arange(0, run_time, 1 / self.camera.fps) + 1 / self.camera.fps
 
         self.file_writer.set_progress_display_description(sub_desc=desc)
 

+ 1 - 0
manimlib/shaders/textured_surface/frag.glsl

@@ -26,6 +26,7 @@ void main() {
         float alpha = smoothstep(-dark_shift, dark_shift, dp);
         color = mix(dark_color, color, alpha);
     }
+    if (color.a == 0) discard;
 
     frag_color = finalize_color(
         color,

+ 1 - 1
requirements.txt

@@ -2,7 +2,7 @@ colour
 ipython>=8.18.0
 isosurfaces
 fontTools
-manimpango>=0.4.0.post0,<0.5.0
+manimpango>=0.6.0
 mapbox-earcut
 matplotlib
 moderngl

+ 5 - 4
setup.cfg

@@ -1,6 +1,6 @@
 [metadata]
 name = manimgl
-version = 1.6.1
+version = 1.7.0
 author = Grant Sanderson
 author_email= grant@3blue1brown.com
 description = Animation engine for explanatory math videos
@@ -30,10 +30,10 @@ packages = find:
 include_package_data = True
 install_requires =
     colour
-    ipython
+    ipython>=8.18.0
     isosurfaces
-    manimpango>=0.4.0.post0,<0.5.0
-    mapbox-earcut
+    fontTools
+    manimpango>=0.6.0
     matplotlib
     moderngl
     moderngl_window
@@ -51,6 +51,7 @@ install_requires =
     svgelements>=1.8.1
     sympy
     tqdm
+    typing-extensions; python_version < "3.11"
     validators
 
 [options.entry_points]