Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Remove dead code from `scene.py` and `vector_space_scene.py` (#4310)

Henrik Skov Midtibyc4b7a8025839
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
index de4a1d11c..17cab5ccc 100644
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -13,7 +13,6 @@ import platform
import random
import threading
import time
-import types
from queue import Queue
import srt
@@ -127,8 +126,6 @@ class Scene:
self.widgets = []
self.dearpygui_imported = dearpygui_imported
self.updaters = []
- self.point_lights = []
- self.ambient_light = None
self.key_to_function_map = {}
self.mouse_press_callbacks = []
self.interactive_mode = False
@@ -175,52 +172,7 @@ class Scene:
if k == "camera_class":
setattr(result, k, v)
setattr(result, k, copy.deepcopy(v, clone_from_id))
- result.mobject_updater_lists = []
- # Update updaters
- for mobject in self.mobjects:
- cloned_updaters = []
- for updater in mobject.updaters:
- # Make the cloned updater use the cloned Mobjects as free variables
- # rather than the original ones. Analyzing function bytecode with the
- # dis module will help in understanding this.
- # https://docs.python.org/3/library/dis.html
- # TODO: Do the same for function calls recursively.
- free_variable_map = inspect.getclosurevars(updater).nonlocals
- cloned_co_freevars = []
- cloned_closure = []
- for free_variable_name in updater.__code__.co_freevars:
- free_variable_value = free_variable_map[free_variable_name]
-
- # If the referenced variable has not been cloned, raise.
- if id(free_variable_value) not in clone_from_id:
- raise Exception(
- f"{free_variable_name} is referenced from an updater "
- "but is not an attribute of the Scene, which isn't "
- "allowed.",
- )
-
- # Add the cloned object's name to the free variable list.
- cloned_co_freevars.append(free_variable_name)
-
- # Add a cell containing the cloned object's reference to the
- # closure list.
- cloned_closure.append(
- types.CellType(clone_from_id[id(free_variable_value)]),
- )
-
- cloned_updater = types.FunctionType(
- updater.__code__.replace(co_freevars=tuple(cloned_co_freevars)),
- updater.__globals__,
- updater.__name__,
- updater.__defaults__,
- tuple(cloned_closure),
- )
- cloned_updaters.append(cloned_updater)
- mobject_clone = clone_from_id[id(mobject)]
- mobject_clone.updaters = cloned_updaters
- if len(cloned_updaters) > 0:
- result.mobject_updater_lists.append((mobject_clone, cloned_updaters))
return result
def render(self, preview: bool = False):
diff --git a/manim/scene/vector_space_scene.py b/manim/scene/vector_space_scene.py
index be7515147..63a312a29 100644
--- a/manim/scene/vector_space_scene.py
+++ b/manim/scene/vector_space_scene.py
@@ -79,7 +79,7 @@ class VectorScene(Scene):
self.add(plane)
return plane
- def add_axes(self, animate: bool = False, color: bool = WHITE, **kwargs):
+ def add_axes(self, animate: bool = False, color: bool = WHITE):
"""
Adds a pair of Axes to the Scene.