03-30-2009 01:35 PM
Solved! Go to Solution.
03-30-2009 02:00 PM
PSU,
Right now, you are just using nested while loops to do a grab and save to avi. This is expected to do exactly what you are describing. If you want to only record video when an action has happened, I would reccomend an event structure.
The events would be whatever your action is (lets say a GO button) and a timeout. So, if nothing is pressed, or no events happen, the code just keeps doing nothing, and running in a loop. However, if the user hits the GO button, you will do exactly what your nested while loop does, and save your frames to an AVI for the elapsed time.
Also, as a side note, not that it matters:
Why did you change the conditional to "continue if true" and use a not or instead of leaving it as the default stop if true with an or. Both work, just curious.
03-30-2009 02:02 PM
Also, you don't want to keep initializing and closing inside of a loop, its poor coding, and will eat up resources.
Just initialize everything before your loop, and close everything after, the meat can all take place inside the loop though.
03-30-2009 02:10 PM
03-30-2009 02:22 PM - edited 03-30-2009 02:23 PM
Ahh, gotcha
I would try the attached screenshot to see if it does what you want, but you still don't want to put all of your initialization inside of the loop, thats just poor programming.
03-30-2009 02:55 PM
03-30-2009 03:00 PM
Ahh, if you don't want that, just remove the wire to the or.
This will force the loop to end on your last "recording" but won't stop it until the time has elapsed.
03-30-2009 03:05 PM
03-30-2009 03:12 PM
You'll have to make sure that the button stays "depressed" by changing the mechanical action of it.
"Switch when pressed" should work, but you'll have to wire up a property node changing it back to false at the end of the code. If you are just latching it or using "switch until released" the program wont see that its been triggered to true.
04-02-2009 01:03 PM
Chris_VH wrote:Also, you don't want to keep initializing and closing inside of a loop, its poor coding, and will eat up resources.
Just initialize everything before your loop, and close everything after, the meat can all take place inside the loop though.
Just curious, what exactly does the "meat" consist of?