Skip to content

Non/duplication of subobject inconsistencyย #4407

@MathiasSven

Description

@MathiasSven

Description of bug / unexpected behavior

When attempting to animate a subobjects, it seems only the first object added to scene, or the first object after a call to self.clear(), is subject to duplication.

Expected behavior

I am not sure what the intended behaviour for attempting to animate a subobject, however I believe it should either always duplicate, or never duplicate.

How to reproduce the issue

Code for reproducing the problem
from manim import *

class Test(Scene):
    def run_test(self):
        self.play(
            *(Indicate(obj[1], scale_factor=0) for obj in self.myobjs),
            run_time=2,
        )
        self.wait(1)
        self.clear()

    def construct(self):
        a = Square(0.8).add(Text("A"))
        b = Square(0.8).add(Text("B"))
        c = VGroup(Square(0.8), Text("C"))
        d = Square(0.8).add(Text("D"))
        self.myobjs = VGroup(a, b, c, d).scale(2).arrange(buff=1)

        self.add(a, b, c, d) # <- a is first, so it has the issue
        self.run_test()
        self.add(b, a, c, d) # <- b is frist, so it has the issue
        self.run_test()
        self.add(c, a, b, d) # <- c is first, no issues, different definition
        self.run_test()
        self.add(d) # <- d is first, so it has the issue
        self.add(a, b, c)
        self.run_test()

Additional media files

Images/GIFs
Test.mp4

Logs

Terminal output
Manim Community v0.19.0

[08/22/25 03:00:25] DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.028515 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  1185818338_2803755490_2662545146                                                                        hashing.py:367
                    INFO     Animation 0 : Using cached data (hash : 1185818338_2803755490_2662545146)                                           cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146']                           cairo_renderer.py:98
                    DEBUG    Animation with empty mobject                                                                                            animation.py:190
                    DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.027663 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  624642324_1432596116_3505779155                                                                         hashing.py:367
                    INFO     Animation 1 : Using cached data (hash : 624642324_1432596116_3505779155)                                            cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146',                           cairo_renderer.py:98
                             '624642324_1432596116_3505779155']                                                                                                      
                    DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.026762 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  624642324_569150730_3956832517                                                                          hashing.py:367
                    INFO     Animation 2 : Using cached data (hash : 624642324_569150730_3956832517)                                             cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146',                           cairo_renderer.py:98
                             '624642324_1432596116_3505779155', '624642324_569150730_3956832517']                                                                    
                    DEBUG    Animation with empty mobject                                                                                            animation.py:190
                    DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.027674 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  624642324_1432596116_1684246318                                                                         hashing.py:367
                    INFO     Animation 3 : Using cached data (hash : 624642324_1432596116_1684246318)                                            cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146',                           cairo_renderer.py:98
                             '624642324_1432596116_3505779155', '624642324_569150730_3956832517', '624642324_1432596116_1684246318']                                 
                    DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.028798 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  624642324_569150730_1555325028                                                                          hashing.py:367
                    INFO     Animation 4 : Using cached data (hash : 624642324_569150730_1555325028)                                             cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146',                           cairo_renderer.py:98
                             '624642324_1432596116_3505779155', '624642324_569150730_3956832517', '624642324_1432596116_1684246318',                                 
                             '624642324_569150730_1555325028']                                                                                                       
                    DEBUG    Animation with empty mobject                                                                                            animation.py:190
                    DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.027896 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  624642324_1432596116_1998345094                                                                         hashing.py:367
                    INFO     Animation 5 : Using cached data (hash : 624642324_1432596116_1998345094)                                            cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146',                           cairo_renderer.py:98
                             '624642324_1432596116_3505779155', '624642324_569150730_3956832517', '624642324_1432596116_1684246318',                                 
                             '624642324_569150730_1555325028']                                                                                                       
                    DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.062823 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  624642324_569150730_1375063100                                                                          hashing.py:367
                    INFO     Animation 6 : Using cached data (hash : 624642324_569150730_1375063100)                                             cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146',                           cairo_renderer.py:98
                             '624642324_1432596116_3505779155', '624642324_569150730_3956832517', '624642324_1432596116_1684246318',                                 
                             '624642324_569150730_1555325028']                                                                                                       
                    DEBUG    Animation with empty mobject                                                                                            animation.py:190
                    DEBUG    Hashing ...                                                                                                               hashing.py:352
                    DEBUG    Hashing done in 0.026839 s.                                                                                               hashing.py:364
                    DEBUG    Hash generated :  624642324_1432596116_2740782278                                                                         hashing.py:367
                    INFO     Animation 7 : Using cached data (hash : 624642324_1432596116_2740782278)                                            cairo_renderer.py:89
                    DEBUG    List of the first few animation hashes of the scene: ['1185818338_2803755490_2662545146',                           cairo_renderer.py:98
                             '624642324_1432596116_3505779155', '624642324_569150730_3956832517', '624642324_1432596116_1684246318',                                 
                             '624642324_569150730_1555325028']                                                                                                       
                    INFO     Combining to Movie file.                                                                                        scene_file_writer.py:739
                    DEBUG    Partial movie files to combine (8 files):                                                                       scene_file_writer.py:622
                             ['/home/mathiassven/Desktop/manim_env/misc/media/videos/testsFile/480p15/partial_movie_files/Test/1185818338_28                         
                             03755490_2662545146.mp4',                                                                                                               
                             '/home/mathiassven/Desktop/manim_env/misc/media/videos/testsFile/480p15/partial_movie_files/Test/624642324_1432                         
                             596116_3505779155.mp4',                                                                                                                 
                             '/home/mathiassven/Desktop/manim_env/misc/media/videos/testsFile/480p15/partial_movie_files/Test/624642324_5691                         
                             50730_3956832517.mp4',                                                                                                                  
                             '/home/mathiassven/Desktop/manim_env/misc/media/videos/testsFile/480p15/partial_movie_files/Test/624642324_1432                         
                             596116_1684246318.mp4',                                                                                                                 
                             '/home/mathiassven/Desktop/manim_env/misc/media/videos/testsFile/480p15/partial_movie_files/Test/624642324_5691                         
                             50730_1555325028.mp4']                                                                                                                  
                    INFO                                                                                                                     scene_file_writer.py:886
                             File ready at '/home/mathiassven/Desktop/manim_env/misc/media/videos/testsFile/480p15/Test.mp4'                                         
                                                                                                                                                                     
                    INFO     Rendered Test                                                                                                               scene.py:255
                             Played 8 animations                                                                                                                     

System specifications

System Details
  • OS: NixOS Unstable
  • RAM: 32GB
  • Python version: Python 3.12.9
  • Installed modules : Just manim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ๐Ÿ†• New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions