-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
pr:bugfixBug fix for use in PRs solving a specific issue:bugBug fix for use in PRs solving a specific issue:bug
Description
Consider the following test script, slightly shortened from one of Grant's older videos:
from manim import *
class TestVectorField(Scene):
def four_swirls_function(self,point):
x, y = point[:2]
result = ((y**3 - 4 * y) * RIGHT + (x**3 - 16 * x) * UP)*0.05
return result
def construct(self):
lines = StreamLines(self.four_swirls_function)
self.add(AnimatedStreamLines(
lines,
line_anim_class=ShowPassingFlash
))
self.wait(2)The scene above fails in the latest version of Manim in the master branch, and the traceback is as follows:
Traceback (most recent call last):
File "/Users/aathishs/Python/ManimEnv/manim/manim/__main__.py", line 168, in main
scene = SceneClass()
File "/Users/aathishs/Python/ManimEnv/manim/manim/scene/scene.py", line 73, in __init__
self.construct()
File "/Users/aathishs/Python/ManimEnv/projects/TestAnimatedStreamLines.py", line 15, in construct
self.wait(2)
File "/Users/aathishs/Python/ManimEnv/manim/manim/scene/scene.py", line 900, in wrapper
hash_wait = get_hash_from_wait_call(
File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 175, in get_hash_from_wait_call
current_mobjects_list_json = [
File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 176, in <listcomp>
get_json(x) for x in sorted(current_mobjects_list, key=lambda obj: str(obj))
File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 98, in get_json
return json.dumps(obj, cls=CustomEncoder)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 234, in dumps
return cls(
File "/Users/aathishs/Python/ManimEnv/manim/manim/utils/hashing.py", line 82, in encode
return super().encode(self._encode_dict(obj))
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
ValueError: Circular reference detected
I believe this is a Scene Caching bug, as the traceback points to the sections where Scene Caching was implemented.
Further confirming this is the fact that commit 9584dfe, the last commit before Scene Caching was merged, renders the scene just fine, but the commit after scene caching was merged fails with the exact same error.
Mentioning @huguesdevimeux since he PR'd Scene Caching.
Metadata
Metadata
Assignees
Labels
pr:bugfixBug fix for use in PRs solving a specific issue:bugBug fix for use in PRs solving a specific issue:bug