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

scene.wait_upto #2852

Open
George-Ogden opened this issue Jun 26, 2022 · 5 comments
Open

scene.wait_upto #2852

George-Ogden opened this issue Jun 26, 2022 · 5 comments
Labels
new feature Enhancement specifically adding a new feature (feature request should be used for issues instead)

Comments

@George-Ogden
Copy link

Description of proposed feature

This feature will allow you to wait until the scene has run for a specific duration.
Lots of people overlay audio onto their videos and this will make it easier to sync audio and animation.

How can the new feature be used?

# play animations
self.wait_upto(60)
# scene has run for 1 minute

# play more animations
self.wait_upto(90)
# another 30 seconds have passed

Additional comments

I've been using it in my own projects and would be happy to implement it and submit a PR when if that's fine.
I just want to get a go-ahead and any comments about things I might not have thought of.

@George-Ogden George-Ogden added the new feature Enhancement specifically adding a new feature (feature request should be used for issues instead) label Jun 26, 2022
@MrDiver
Copy link
Collaborator

MrDiver commented Jun 26, 2022

I find this an interesting idea but where is the benefit over just using your editing software to extend the animations?

And there is also a wait until function. That might be able to do something similar if I'm not completely mistaken.

@George-Ogden
Copy link
Author

I find this an interesting idea but where is the benefit over just using your editing software to extend the animations?

And there is also a wait until function. That might be able to do something similar if I'm not completely mistaken.

One of the benefits of this is that you can compile with ffmpeg for example, rather than using additional software that you have to pay for or has a watermark, etc. It also means you don't have to keep track of the runtimes of each individual animation as it runs.

The wait_until function is just a wrapper for the wait function and would not offer the same functionality:

  stop_condition
      A function without positional arguments that evaluates to a boolean.
      The function is evaluated after every new frame has been rendered.
      Playing the animation only stops after the return value is truthy.

@MrDiver MrDiver added this to Dev Board Nov 8, 2022
@MrDiver MrDiver moved this to 🆕 New in Dev Board Nov 8, 2022
@chopan050
Copy link
Contributor

chopan050 commented Dec 6, 2024

Since the PR #3997 introduced a time property for Scene, this feature would be easier to implement in a PR.

I like the idea, but the name doesn't really convince me. IMO, it's not clear at first sight that it refers to a final time, although .wait_until() also doesn't make it clear that it refers to a condition: it sounds more like a time.

Personally, I would like .wait_until(stop_condition) to be renamed to .wait_until_condition(stop_condition) or even .wait_while(continue_condition) before implementing this change, and I would call this .wait_until_time(final_time).

In the meantime, another option, since Scene.time is now implemented, is to call self.wait_until(lambda: self.time >= 60), although it is more verbose.

@George-Ogden
Copy link
Author

What about making it keyword-only?:

.wait_until(time=90) # valid
.wait_until(90) # invalid

@chopan050
Copy link
Contributor

What about making it keyword-only?

It could be an interesting idea, although it would require a complete rewriting on how .wait_until() works.

I'd like to read other people's opinions!

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: 🆕 New
Development

No branches or pull requests

3 participants