I’m trying Polyscope 3.5.1 and I found out that generateScript method was called twice when playing a robot program for the same ProgramNodeContribution, generating an exception in my code (which assumes that the method is only called once).
This doesn’t happen every time I play a robot program (in fact it only happened once so far).
I know that this is effectively happening because every ProgramNodeContribution has a static integer assigned when it is created, and on generateScript method, I log Generating scripts for instance X. So when I pressed ‘play’ this is what I got:
Generating scripts for instance 1
Generating scripts for instance 1
Generating scripts for instance 2
Generating scripts for instance 2
I have played/ saved many robot programs in Polyscope 3.4 and I never saw anything like this. Is this by any chance a known issue for Polyscope 3.5? Any ideas?
In general, the code should be able to handle multiple calls to the generateScript method.
It can be called when program is saved, or typically when the program is played.
At play instance, it could happen, if the user double-taps (debounce) on the Play button.
Note: generateScript is only called, when all nodes in a program context return true on their respective isDefined calls.
Thanks for your reply!
Just to clarify, usually when I tap “play”, Polyscope calls generateScript once per node, one after the other. So for example if I have 3 nodes, I get
Node 1 called
Node 2 called
Node 3 called
And if I tap twice (really fast), I usually get:
Node 1 called
Node 2 called
Node 3 called
Node 1 called
Node 2 called
Node 3 called
The situation described above is exceptional and that’s why I thought about posting it here. So can it be that generateScript is called twice for the same node when pressing play only once?