POV-Ray : Newsgroups : povray.advanced-users : Get image file name from the code : Re: Get image file name from the code Server Time
8 Jul 2024 19:19:06 EDT (-0400)
  Re: Get image file name from the code  
From: Christian Froeschlin
Date: 28 Aug 2007 17:25:13
Message: <46d492b9$1@news.povray.org>
> I have been programming during 25 years and I learnt that assumimg things in 
> the code is not a good practice. I just wanted to be sure that hardcoding 
> the file name was the only way to do it and that there is not a constant or 
> system variable that gives the name of the file.

I suppose there is no way to do that in POVRay itself, but you can
call it from the command line to get external control over the render
and file name. You can even pass parameters to the scene file, although
this does not seem to work for string parameters. You can get around
that by writing the string into a file.

For example, to create a web page button for a given caption I used:

@echo off
echo "%1" > caption.txt
CALL render_image 0
move button.png buttons\%1_normal.png
CALL render_image 1
move button.png buttons\%1_highlighted.png
CALL render_image 2
move button.png buttons\%1_pressed.png

where render_image.bat was just

pvengine -D +a0.2 +w100 +h20 +FN +UA /EXIT button.pov Declare=STATE=%1

and button.pov reading caption.txt, with "STATE" set from command line.

And yes, it's a bit annoying that each invocation pops up the GUI,
makes it impossible to run this in the background, although MegaPOV
might not have this issue ;)


Post a reply to this message

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