-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Implement :attr:.Mobject.always
, and move builders to their own file
#3852
base: main
Are you sure you want to change the base?
Conversation
This is actually very interesting, huge +1 for the API; I like it a lot! Will review in-depth over the weekend, but I strongly believe we should ship this with the next release. 🚀 |
Currently incomptaible with ValueTracker, on hold until ValueTracker is lazy! |
I think it might be better just to get it merged in its current state. Valuetrackers can be added in a later PR, but I would love to have this in 0.19.0 |
fff3921
to
1155e14
Compare
This now allows `mobj.always.method1().method2()`, which would add two updaters for `methd1()` and `method2()`
5ce2384
to
cff2181
Compare
if TYPE_CHECKING: | ||
from typing_extensions import Self | ||
|
||
from manim.animation.animation import Animation |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.animation.animation
manim.mobject.builders
definition
import
'Animation' may not be defined if module
manim.animation.animation
manim.mobject.builders
definition
import
'Animation' may not be defined if module
manim.animation.animation
manim.mobject.builders
definition
import
'Animation' may not be defined if module
manim.animation.animation
manim.mobject.builders
definition
import
'Animation' may not be defined if module
manim.animation.animation
manim.mobject.builders
definition
import
from typing_extensions import Self | ||
|
||
from manim.animation.animation import Animation | ||
from manim.mobject.mobject import Mobject |
Check notice
Code scanning / CodeQL
Unused import Note
from typing_extensions import Self | ||
|
||
from manim.animation.animation import Animation | ||
from manim.mobject.mobject import Mobject |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.mobject.mobject
manim.mobject.builders
definition
import
'Mobject' may not be defined if module
manim.mobject.mobject
manim.mobject.builders
definition
import
'Mobject' may not be defined if module
manim.mobject.mobject
manim.mobject.builders
definition
import
|
||
from manim.animation.animation import Animation | ||
from manim.mobject.mobject import Mobject | ||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject |
Check notice
Code scanning / CodeQL
Unused import Note
|
||
from manim.animation.animation import Animation | ||
from manim.mobject.mobject import Mobject | ||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.mobject.opengl.opengl_mobject
manim.mobject.builders
definition
import
@@ -38,6 +38,7 @@ | |||
from ..utils.iterables import list_update, remove_list_redundancies | |||
from ..utils.paths import straight_path | |||
from ..utils.space_ops import angle_between_vectors, normalize, rotation_matrix | |||
from .builders import _AnimationBuilder, _UpdaterBuilder |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.mobject.builders
manim.mobject.mobject
definition
import
'_AnimationBuilder' may not be defined if module
manim.mobject.builders
manim.mobject.mobject
definition
import
@@ -38,6 +38,7 @@ | |||
from ..utils.iterables import list_update, remove_list_redundancies | |||
from ..utils.paths import straight_path | |||
from ..utils.space_ops import angle_between_vectors, normalize, rotation_matrix | |||
from .builders import _AnimationBuilder, _UpdaterBuilder |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.mobject.builders
manim.mobject.mobject
definition
import
'_UpdaterBuilder' may not be defined if module
manim.mobject.builders
manim.mobject.mobject
definition
import
@@ -16,6 +16,7 @@ | |||
|
|||
from manim import config, logger | |||
from manim.constants import * | |||
from manim.mobject.builders import _UpdaterBuilder |
Check failure
Code scanning / CodeQL
Module-level cyclic import Error
manim.mobject.builders
manim.mobject.opengl.opengl_mobject
definition
import
'_UpdaterBuilder' may not be defined if module
manim.mobject.builders
manim.mobject.opengl.opengl_mobject
definition
import
'_UpdaterBuilder' may not be defined if module
Motivation
Allows for syntax like
Changelog
_UpdaterBuilder
_AnimationBuilder
and_UpdaterBuilder
to their own file._AnimationBuilder
generic in it's mobject, to match experimentalNote
I opted to allow imports of
_UpdaterBuilder
/_AnimationBuilder
from Mobject itself, even though they're in their own file (manim.mobject.builders
).Warning
.always
is a thin wrapper aroundadd_updater
, as such the usual caveats apply. If two updaters are added that affect the position, weird things could happen.Documentation
https://manimce--3852.org.readthedocs.build/en/3852/reference/manim.mobject.mobject.Mobject.html#manim.mobject.mobject.Mobject.always