POV-Ray : Newsgroups : povray.programming : Passing custom key presses to a POV scene? : Re: Passing custom key presses to a POV scene? Server Time
6 May 2024 00:20:06 EDT (-0400)
  Re: Passing custom key presses to a POV scene?  
From: clipka
Date: 15 Oct 2009 23:38:59
Message: <4ad7ead3@news.povray.org>
stbenge schrieb:
> 
> I don't :/ My program simply writes to an .inc file every time an arrow 
> key is pressed. I might be able to optimize this by writing only once if 
> a key is still being pressed.

You might do it as follows:

- In your program, update the .inc file only after verifying that a 
certain "acknowledge marker" ("ACK") file does exist; after having 
written the .inc file, have the program delete the ACK file.

- In your scene file, use the file_exists() function to check whether 
the ACK file does exist; if not, include the .inc file, then use 
#fopen/#write to generate/overwrite a temporary .inc file to contain the 
very same data, and after that use the same mechanism to create the ACK 
file. If however the ACK file does exist already, simply include the 
temporary .inc file instead.

I think that should do the trick without conflicts.

Make sure to init the system properly (e.g. by making sure the ACK file 
is not present, and the main .inc file exists and has some content that 
makes sense), and to provide for a way to recover in case the system 
should become "stuck" for some unexpected reason (e.g. time out if the 
POV-Ray script fails to create the ACK file in due time; you can also 
put the current frame number into the temporary .inc file and cross 
check, to create a timeout mechanism on the POV-Ray side in case the 
program fails to clear the ACK file at regular intervals)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.