-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
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 :D
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)