How to pause script for x seconds while let viewport update; also how to set viewport snapshot size?
Hi all, thanks for any help-
I've built a quick script that rotates around an object "turntable" style, and either renders or takes a viewport grab. I would like for the viewport grab to wait a second or two on each frame, before taking the snapshot, so the Nitrous view can update and look nice and sexy.
I tried "sleep", no luck there, it waits but does not update the view. Is there a simple "time" class/etc that I can access? Or another way of sleeping the script for a few seconds?
Second, I need to set the size of the viewport screenshot, having a lot of trouble finding how to do this. Seems I might have to go fairly low-level to accomplish it, and that's fine, I'll learn it- just can't find what I need yet!
Thanks much!
Comments
Another update: made a quick
Another update: made a quick bit of test code which can be ran independantly to check if the viewport is rendering "properly":
(
enableSceneRedraw()
theRotation = eulerAngles 20 20 20
rotate $ theRotation
completeRedraw()
startTime = timeStamp()
elapsedTime = 0
while elapsedTime < 3 do
(
enableSceneRedraw()
nowTime = timeStamp()
elapsedTime = ((nowTime - startTime) / 1000)
)
viewSize = getViewSize()
imageFile = bitmap viewSize.x viewSize.y filename:"C:/FileTesting/waitTest.jpg"
screenGrab = gw.getViewportDib()
copy screenGrab imageFile
save imageFile
)
Still no luck :( I'm just hacking things in at this point, ie the double "enableSceneRedraw()"
Any help?? :(
Hi guys, figured I'd post the
Hi guys, figured I'd post the code I have so far, in case it helps clear things up:
else --just doing preview renders
(
completeRedraw()
startTime = timeStamp()
elapsedTime = 0
while elapsedTime < spin_sleepTime.value do
(
nowTime = timeStamp()
elapsedTime = ((nowTime - startTime) / 1000)
)
viewSize = getViewSize()
imageFile = bitmap viewSize.x viewSize.y filename:saveName
screenGrab = gw.getViewportDib()
copy screenGrab imageFile
save imageFile
)
My "timer" didn't help, the viewport still doesn't update. In fact, max pretty much just locks instantly after the first frame...