-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Currently, the Scene Caching Mechanism considers three hashes to check if a scene and its contents have changed:
- hash corresponding to the arguments passed to scene.play (or scene.wait).
- hash obtained with all the mobjects present in scene, including those not in the current play/wait call
- hash obtained from camera_config.
However, using just these three hashes is not specific enough in some contexts.
Consider the following test scene:
class Test(Scene):
def construct(self):
T1 = TextMobject("M")
self.play(Write(T1))After the first render, if the T1 TextMobject is changed to some other letter, say Q, the scene caching mechanism will not recognise this change, and will still show the original animation of the letter M being written.
A possible solution to this would be to also hash the attributes of all the mobjects present in the Scene, or at least those mobjects being animated, and add that to the list of hashes used.
cc-ing @huguesdevimeux
EDIT : Original issue :
Okay, so this works as intended for the first render, and produces the video as required, but doesn't re-render if the Vector Field is changed.
Let's take the same script I used in #302 :
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)It's output should be something like:
If I change four_swirls_function to something else, like result = ((y**2 - 4 * y) * RIGHT + (x**3 - 16 * x) * UP)*0.05,
the output should be something like:

But, the scene caching mechanism still uses the previous cached file.
EDIT: I don't think this is due to the bug that this PR fixes, but a more specific case of what I described in #320.
Originally posted by @Aathish04 in #315 (comment)
