I’m running into an issue with my switch and null operators. I’m trying to create a video chooser menu where users choose a video to watch using a key press, and I’m working on having it so that when the chosen video ends, it automatically returns to the menu screen so users can watch another video.
I have it working to where it displays the menu screen immediately after the last frame of the video plays, however, when this happens, it severs the connection between my switch and null operators. Meaning that it’s impossible for the user to continue viewing the rest of the videos.
This is the code that I have in my CHOP Execute DAT to achieve this:
def offToOn(channel, sampleIndex, val, prev):
if val == 1:
op('switch1').par.index = 0
Is there any way for me to keep the switch and null operators connected once this runs, or is there another way to achieving this goal altogether? Thanks.
It’s difficult to debug this using just the image, but here’s a couple ideas:
It looks like your chopexec1 DAT is reading data from the merge CHOP that has data for all of your videos. Without knowing if you’re doing any sort of masking to filter out irrelevant channel data.
There are alerts on all your video player TOPs, can you tell us what they say?
I see, so you’re using an expression to get the current value of null1 into the switch index, but then overwriting it with a constant when your chopexec runs.
The issue is that the expression is cleared by your chopexec. The easiest way to fix this without reworking the whole setup would be to create another chopexec and bind it to your null1. Then have that set the op('switch1').par.index value the same way as the other chop exec.
Is this what you were talking about? (I duplicated the chopexec and connected it to null1), sadly for some reason it still severs the connection between null1 and switch1 after the first video plays.
The connection line will break, because you’re changing the mode of the parameter from using the expression to using a constant value that’s assigned with the python script.
Here’s a link to the doc page about parameter modes: Parameter Modes