Skip to content
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

Allow :meth:.VGroup.add to use iterables of VMobjects #3556

Closed

Conversation

JasonGrace2282
Copy link
Member

@JasonGrace2282 JasonGrace2282 commented Dec 29, 2023

Closes #3540

Allows for statements like:

VGroup(
    Square(),
    [Circle()],
    (x.shift(RIGHT) for x in [Star(), Triangle()])
)

Also added a test for this.

As MrDiver said, it's annoying to have to unpack iterables with the * operator.

@JasonGrace2282 JasonGrace2282 added the new feature Enhancement specifically adding a new feature (feature request should be used for issues instead) label Dec 29, 2023
@JasonGrace2282 JasonGrace2282 added this to the v0.18.1 milestone Dec 29, 2023
@JasonGrace2282 JasonGrace2282 marked this pull request as draft December 29, 2023 03:32
@JasonGrace2282 JasonGrace2282 changed the title :meth:.Mobject.add allows iterables of Mobjects Allow :meth:.VGroup.add to use iterables of VMobjects Dec 29, 2023
JasonGrace2282 and others added 4 commits December 28, 2023 23:13
Turns out VGroups (and all things it inherits from) are iterables... oops!
@@ -31,6 +31,7 @@
from typing_extensions import Self

from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
from manim.mobject.opengl.opengl_mobject import OpenGLMobject

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
manim.mobject.opengl.opengl_mobject
begins an import cycle.
@JasonGrace2282 JasonGrace2282 removed this from the v0.18.1 milestone Jan 15, 2024
@JasonGrace2282
Copy link
Member Author

Closing this as the performance hit for checking if an object is not a VMobject is a bit excessive.

@JasonGrace2282 JasonGrace2282 deleted the vgroup_iterables branch February 1, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Enhancement specifically adding a new feature (feature request should be used for issues instead)
Projects
Status: Rejected
Development

Successfully merging this pull request may close these issues.

VGroup should parse iterables
1 participant