question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Counting number of scene.play and wait calls

See original GitHub issue

I’m refactoring the progressbar and t-values generation. See #183

I’m facing an issue ; I would like to be able to count the number of calls of scene.play or scene.wait in construct() defintion, because I need to know when is the last animation.

As far as I know there is no way to do it in manim, as right now manim just takes scene.play and scene.wait one after the other (so it does not need to get the total number of scene.play and scene.wait calls.

So, to do that, I think the only solution is to disassemble construct function to get the number CALL_FUNCTION instances with scene.play and scene.wait. Something like this https://stackoverflow.com/a/16042229/12009882

But my question is, is it good? Like, is it ok to have something like this? Because this method is slightly too much hacky in my mind (although it would work and is not very complicated).

Maybe this is totally fine and I’m just nitpicking, please tell me 😄

EDIT : Looking for CALL_FUNCTION in function’s instructions (disassembled) won’t work as the name of the function does not appear. Instead, we can look for LOAD_METHOD with argval ‘wait’ or ‘play’. Example :

Instruction(opname='LOAD_METHOD', opcode=160, arg=3, argval='wait', argrepr='wait', offset=22, starts_line=None, is_jump_target=False)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
huguesdevimeuxcommented, Aug 3, 2020

@kilacoda I first tought to do this only for construct(), but as obvious as it may seem I didn’t think to do it with the whole SceneClass lol, I’m stupid. So thank you very much for bringing up this idea.

The issue was/is that if these calls are outside the construct, then we won’t be able to detect them (except by doing a weird recursive thing that would take long). We should not have this issue if we take the source (or the disassembly) of the whole class as all the wait/play calls are supposedly within the latter.

0reactions
huguesdevimeuxcommented, Aug 28, 2020

So I think this is impossible (without rewriting the whole codebase) Closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How many lines should be in a scene in a play? - Quora
Counting lines is for insecure actors.
Read more >
How Long is a Piece of Theatre? - beewaxing - WordPress.com
On the Lazy Bee Scripts web site, we give an estimated length of each play based on Word Count. We use the same...
Read more >
Cyberpunk 2077 Judy Alvarez Romance Guide - PowerPyx.com
This guide shows how to romance Judy Alvarez in Cyberpunk 2077 (CP77). Find out how to start a relationship with Judy and get...
Read more >
Summary and Analysis Act II: Scene 5 - Twelfth Night
The thought of Malvolio's being "Count Malvolio" overwhelms him. He conjures up visions of himself — married to Olivia for three months and...
Read more >
Making of Django and Jimmie (Official Video) - YouTube
The Making of the Django and Jimmie album with Willie Nelson & Merle HaggardListen to Willie Nelson: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found