-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Total time updaters #1520
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
Total time updaters #1520
Conversation
for more information, see https://pre-commit.ci
…er/manim into total_time_updaters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-commit is complaining about these -- applying these changes
Applied pre-commit suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, this PR functions as intended from my tests/usage of the new feature. I'll approve now as it works and this could be added to the 0.7.0 release, but I've offered some suggestions to consider.
pass_relative_times | ||
Whether the time information passed to the updater should be relative | ||
(usually the time since last call) or absolute (sum of all relative times | ||
since the updater was added). If ``pass_relative_times`` is ``None`` | ||
relative times get passed, except if the second parameter of the updater is | ||
named ``t`` or ``time``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather pass_relative_times have a default argument of True
than be None
and later make it False
if necessary. Also, I don't particularly like the feature of changing the updater to total time if the second argument is t
/time
... seems a bit hacky.
update_function: Updater, | ||
updater: Updater, | ||
*, | ||
pass_relative_times: Optional[bool] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass_relative_times: Optional[bool] = None, | |
pass_relative_times: optional[bool] = True, |
if parameters[1] not in ["t", "time"] and pass_relative_times is None: | ||
pass_relative_times = True | ||
pass_relative_times = bool(pass_relative_times) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, I don't particularly like this hard coded check for the second argument, but with a default of True
, you can simplify the logic to only check for if it should be set to False
if parameters[1] not in ["t", "time"] and pass_relative_times is None: | |
pass_relative_times = True | |
pass_relative_times = bool(pass_relative_times) | |
if parameters[1] in ["t", "time"]: | |
pass_relative_times = False |
Hi, are you still planning on working on this? |
We will come back to this with a fresh view if the issue get's relevant again. This PR is already linked in the original issue So i will close this for now. Feel free to open this PR again or a new PR which fixes the issue if you want to work on it again! |
Changelog / Overview
Mobject.add_updater
has a new parameterpass_relative_times
determining if the updater should get passed relative or absolute time values.dt
.call_updater=True
no longer causes an error with non-time-based updaters.Mobject.update
toMobject._apply_updaters
and deprecatedupdate
.Motivation
From time to time you don't need the time difference since last updater call, but the total time... Now you without a problem.
Closes #321
Includes parts of the feature requested in #851
Explanation for Changes
Documentation Reference
Checklist
Reviewer Checklist