Skip to content

Commit c4b7a80

Browse files
Remove dead code from scene.py and vector_space_scene.py (#4310)
1 parent 0cec802 commit c4b7a80

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

manim/scene/scene.py

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import random
1414
import threading
1515
import time
16-
import types
1716
from queue import Queue
1817

1918
import srt
@@ -127,8 +126,6 @@ def __init__(
127126
self.widgets = []
128127
self.dearpygui_imported = dearpygui_imported
129128
self.updaters = []
130-
self.point_lights = []
131-
self.ambient_light = None
132129
self.key_to_function_map = {}
133130
self.mouse_press_callbacks = []
134131
self.interactive_mode = False
@@ -175,52 +172,7 @@ def __deepcopy__(self, clone_from_id):
175172
if k == "camera_class":
176173
setattr(result, k, v)
177174
setattr(result, k, copy.deepcopy(v, clone_from_id))
178-
result.mobject_updater_lists = []
179175

180-
# Update updaters
181-
for mobject in self.mobjects:
182-
cloned_updaters = []
183-
for updater in mobject.updaters:
184-
# Make the cloned updater use the cloned Mobjects as free variables
185-
# rather than the original ones. Analyzing function bytecode with the
186-
# dis module will help in understanding this.
187-
# https://docs.python.org/3/library/dis.html
188-
# TODO: Do the same for function calls recursively.
189-
free_variable_map = inspect.getclosurevars(updater).nonlocals
190-
cloned_co_freevars = []
191-
cloned_closure = []
192-
for free_variable_name in updater.__code__.co_freevars:
193-
free_variable_value = free_variable_map[free_variable_name]
194-
195-
# If the referenced variable has not been cloned, raise.
196-
if id(free_variable_value) not in clone_from_id:
197-
raise Exception(
198-
f"{free_variable_name} is referenced from an updater "
199-
"but is not an attribute of the Scene, which isn't "
200-
"allowed.",
201-
)
202-
203-
# Add the cloned object's name to the free variable list.
204-
cloned_co_freevars.append(free_variable_name)
205-
206-
# Add a cell containing the cloned object's reference to the
207-
# closure list.
208-
cloned_closure.append(
209-
types.CellType(clone_from_id[id(free_variable_value)]),
210-
)
211-
212-
cloned_updater = types.FunctionType(
213-
updater.__code__.replace(co_freevars=tuple(cloned_co_freevars)),
214-
updater.__globals__,
215-
updater.__name__,
216-
updater.__defaults__,
217-
tuple(cloned_closure),
218-
)
219-
cloned_updaters.append(cloned_updater)
220-
mobject_clone = clone_from_id[id(mobject)]
221-
mobject_clone.updaters = cloned_updaters
222-
if len(cloned_updaters) > 0:
223-
result.mobject_updater_lists.append((mobject_clone, cloned_updaters))
224176
return result
225177

226178
def render(self, preview: bool = False):

manim/scene/vector_space_scene.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def add_plane(self, animate: bool = False, **kwargs):
7979
self.add(plane)
8080
return plane
8181

82-
def add_axes(self, animate: bool = False, color: bool = WHITE, **kwargs):
82+
def add_axes(self, animate: bool = False, color: bool = WHITE):
8383
"""
8484
Adds a pair of Axes to the Scene.
8585

0 commit comments

Comments
 (0)