Skip to content

Add classes MethodWithArgs, SceneInteractContinue and SceneInteractRerun inside new module manim.data_structures #4315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

chopan050
Copy link
Contributor

@chopan050 chopan050 commented Jun 27, 2025

Overview: What does this pull request change?

  • Add classes MethodWithArgs, SceneInteractContinue and SceneInteractRerun. Currently, they all exist inside a new manim.data_structures file, although I intend to move SceneInteractContinue and SceneInteractRerun into scene.py if PR Move configure_pygui into a Scene method and remove manim.gui #4314 is merged first.
  • Make the items of Scene.queue, _AnimationBuilder.methods and _MethodAnimation.methods objects of these classes instead of tuples.

Motivation and Explanation: Why and how do your changes improve the library?

Scene.queue, _AnimationBuilder.methods and _MethodAnimation.methods contain tuples where the first element represents a method to be called, the second one is its args and the third one is its kwargs. Moreover, in the case of Scene.queue, the first element (a string) might not necessarily represent a method: it can be a key starting with "rerun" (in which case the args are not used and only some key-value pairs are extracted from the kwargs) or with "exit" (in which case neither the args nor the kwargs are used). On first sight, this might be very confusing. Previously, there were no docs for this behavior and I asked for them to be added in a comment I made while reviewing PR #4260. Now, I believe that it would be better if those were different objects from different classes altogether.

Links to added or changed documentation pages

Further Information and Comments

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@chopan050 chopan050 marked this pull request as draft June 27, 2025 05:49
@chopan050 chopan050 marked this pull request as ready for review June 28, 2025 02:38
@chopan050 chopan050 changed the title Add classes MethodWithArgs, SceneInteractRerun and SceneInteractExit inside new module manim.data_structures Add classes MethodWithArgs, SceneInteractContinue and SceneInteractRerun inside new module manim.data_structures Jun 28, 2025
@chopan050
Copy link
Contributor Author

Note: it seems only "from_animation_number" from SceneInteractRerun.kwargs is being used. The other kwargs are unused. Thus, the structure could be simplified to directly contain an attribute .from_animation_number instead of .kwargs, but this requires discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant