Skip to content

Commit 2964326

Browse files
authored
Fix opengl finish transform (#2676)
1 parent 7f464cc commit 2964326

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

manim/mobject/opengl/opengl_mobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2729,7 +2729,6 @@ def __call__(self, **kwargs):
27292729

27302730
def __getattr__(self, method_name):
27312731
method = getattr(self.mobject.target, method_name)
2732-
self.methods.append(method)
27332732
has_overridden_animation = hasattr(method, "_override_animate")
27342733

27352734
if (self.is_chaining and has_overridden_animation) or self.overridden_animation:
@@ -2747,6 +2746,7 @@ def update_target(*method_args, **method_kwargs):
27472746
**method_kwargs,
27482747
)
27492748
else:
2749+
self.methods.append([method, method_args, method_kwargs])
27502750
method(*method_args, **method_kwargs)
27512751
return self
27522752

tests/test_scene_rendering/opengl/test_play_logic_opengl.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,19 @@ def test_t_values_save_last_frame(using_temp_opengl_config):
101101
scene.update_to_time = Mock()
102102
scene.render()
103103
scene.update_to_time.assert_called_once_with(1)
104+
105+
106+
def test_animate_with_changed_custom_attribute(using_temp_opengl_config):
107+
"""Test that animating the change of a custom attribute
108+
using the animate syntax works correctly.
109+
"""
110+
111+
class CustomAnimateScene(Scene):
112+
def construct(self):
113+
vt = ValueTracker(0)
114+
vt.custom_attribute = "hello"
115+
self.play(vt.animate.set_value(42).set(custom_attribute="world"))
116+
assert vt.get_value() == 42
117+
assert vt.custom_attribute == "world"
118+
119+
CustomAnimateScene().render()

0 commit comments

Comments
 (0)