POV-Ray : Newsgroups : povray.general : New Get macro Server Time
29 Mar 2024 06:00:08 EDT (-0400)
  New Get macro (Message 11 to 16 of 16)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: New Get macro
Date: 24 Aug 2020 14:15:01
Message: <web.5f4402af4810ab9f1f9dae300@news.povray.org>
> I thought I could find the section anyway, but the shipped unix html to
> the online documentation looks scrambled somehow. I couldn't find the
> equivalent section on line in a reasonable amount of thrashing about.
> When online I look at section 3.3 by link online I end up in Windows
> Section 3...

I know what you mean - I can never find what I'm looking for.

http://www.povray.org/documentation/3.7.0/r3_2.html
3.2.4.2 Output File Name
....
The default output filename is created from the scene name and need not be
specified. The scene name is the input name with all drive, path, and extension
information stripped. For example if the input file name is
c:\povray3\mystuff\myfile.pov the scene name is myfile. The proper extension is
appended to the scene name based on the file type. For example myfile.tga or
myfile.png might be used.

You may override the default output name using Output_File_Name=file or +Ofile.
For example:

Input_File_Name=myinput.pov
Output_File_Name=myoutput.tga
If an output file name of "-" is specified (a single minus sign), then the image
will be written to standard output, usually the screen. The output can then be
piped into another program or to a GUI if desired.

If the file specified is actually a path or directory or folder name and not a
file name, then the default output name is used but it is written to the
specified directory. For example:

Input_File_Name=myscene.pov
Output_File_Name=c:\povray3\myimages\
This will create c:\povray3\myimages\myscene.tga as the output file.



3.2.5.2 Input File Name
Input_File_Name=file Sets input file name to file
+Ifile Same as Input_File_Name=file
Note: There may be no space between +I and file.

You will probably always set this option but if you do not the default input
filename is object.pov. If you do not have an extension then .pov is assumed. On
case-sensitive operating systems both .pov and .POV are tried. A full path
specification may be used (on MS-DOS systems +Ic:\povray3\mystuff\myfile.pov is
allowed for example). In addition to specifying the input file name this also
establishes the scene name.

The scene name is the input name with drive, path and extension stripped. In the
above example the scene name is myfile. This name is used to create a default
output file name and it is referenced other places.

Note: As of version 3.5 you can now specify a POV file on the command-line
without the use of the +i switch (i.e. it works the same way as specifying an
INI file without a switch), the POV file then should be the last on the
command-line.

If you use "-" as the input file name the input will be read from standard
input. Thus you can pipe a scene created by a program to POV-Ray and render it
without having a scene file.

3.2.6.1 String Substitution in Shell Commands
It could get cumbersome to change the Post_Scene_Command every time you changed
scene names. POV-Ray can substitute various values into a command string for
you. For example:

Post_Scene_Command=tga2gif -d -m %s
POV-Ray will substitute the %s with the scene name in the command. The scene
name is the Input_File_Name or +I setting with any drive, directory and
extension removed. For example:

Input_File_Name=c:\povray3\scenes\waycool.pov

In an animation it may be necessary to have the exact output file name with the
frame number included. The string %o will substitute the output file name.


Here is the complete list of substitutions available for a command string.

%o Output file name with extension and embedded frame number if any
%s Scene name derived by stripping path and ext from input name
%n Frame number of this frame
%k Clock value of this frame
%h Height of image in pixels
%w Width of image in pixels
%% A single % sign.


Maybe we could have a %p and/or %f for "full pathname" of input / output file.


Until then, maybe I can figure out a way to test for a file, and then if it
doesn't exist, abort the scene with an #error directive.
Then I could use the fatal error action to do something like
pwd > path.txt

User_Abort_Return=s Set user abort return actions
Fatal_Error_Return=s Set fatal return actions

But that of course requires that the scene be initiated with the .ini file.


Post a reply to this message

From: Bald Eagle
Subject: Re: New Get macro
Date: 24 Aug 2020 14:15:02
Message: <web.5f44039a4810ab9f1f9dae300@news.povray.org>
The actual variable used in a scene via SDL is located in the STRINGS section.

http://wiki.povray.org/content/Reference:Strings

Built-in Variables
At the moment there is only one built-in string variable. You can use it to
specify values or to create expressions but you cannot re-declare it to change
it's value.

File-related are:

STRING_BUILT-IN_IDENT:
  input_file_name
input_file_name
The name of the scene input file.


Post a reply to this message

From: jr
Subject: Re: New Get macro
Date: 24 Aug 2020 16:20:04
Message: <web.5f4420b04810ab9f4d00143e0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> ...
> Maybe we could have a %p and/or %f for "full pathname" of input / output file.
>
> Until then, maybe I can figure out a way to test for a file, and then if it
> doesn't exist, abort the scene with an #error directive.

when using 'file_exists()', you can use absolute file names.

> ...


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: New Get macro
Date: 24 Aug 2020 16:55:07
Message: <web.5f4428864810ab9f1f9dae300@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:

> when using 'file_exists()', you can use absolute file names.

We can,
but the idea was to check for a file that contains the full path created by the
pwd command.
If it doesn't exist, it will be created, after the render is forcibly
terminated.
Then the scene can be run a second time  - or it can be auto-run by the ini
command line thing, so there's very little discernable hiccup on the first
render.

Presumably if I want to run a series of commands from the ini, it has to be in
the form of a shell script?


Post a reply to this message

From: jr
Subject: Re: New Get macro
Date: 24 Aug 2020 17:45:07
Message: <web.5f4434af4810ab9f4d00143e0@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "jr" <cre### [at] gmailcom> wrote:
> > when using 'file_exists()', you can use absolute file names.
>
> We can,
> but the idea was to check for a file that contains the full path created by the
> pwd command.

not sure I understand.  "file contains", like you want to 'grep' file(s) for
some path?

> If it doesn't exist, it will be created, after the render is forcibly
> terminated.

does the 'post_scene_command' get run when POV-Ray terminates with an error?

> Then the scene can be run a second time  - or it can be auto-run by the ini
> command line thing, so there's very little discernable hiccup on the first
> render.
>
> Presumably if I want to run a series of commands from the ini, it has to be in
> the form of a shell script?

yes.  (anything "executable")

given the above, perhaps even a controlling (shell) script which invokes POV-Ray
as and when needed?


regards, jr?


Post a reply to this message

From: Bald Eagle
Subject: Re: New Get macro
Date: 24 Aug 2020 18:30:01
Message: <web.5f443f1d4810ab9f1f9dae300@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> hi,
>
> "Bald Eagle" <cre### [at] netscapenet> wrote:
> > "jr" <cre### [at] gmailcom> wrote:
> > > when using 'file_exists()', you can use absolute file names.
> >
> > We can,
> > but the idea was to check for a file that contains the full path created by the
> > pwd command.
>
> not sure I understand.  "file contains", like you want to 'grep' file(s) for
> some path?

No, I want to use the shell to write the PWD environment variable to a text file
using > to redirect the output, since the user can't access that directly
through POV-Ray.

pwd stands for Print Working Directory. It prints the path of the working
directory, starting from the root.
pwd is shell built-in command(pwd) or an actual binary(/bin/pwd).
$PWD is an environment variable which stores the path of the current directory.

>
> > If it doesn't exist, it will be created, after the render is forcibly
> > terminated.
>
> does the 'post_scene_command' get run when POV-Ray terminates with an error?

It does not, but a terminal error command does, which is presumably what #error
invokes/creates.


> yes.  (anything "executable")

Well, single command lines can be defined right there in the ini file statement.
I didn't know if one could just make a list of them and they'd all be executed,
or if I needed to do that outside of the ini file.

>
> given the above, perhaps even a controlling (shell) script which invokes POV-Ray
> as and when needed?

Maybe.  But that's presently outside my area of experience / expertise.

Though it does give me some cool ideas with regard to invoking POV-Ray from a
spreadsheet...


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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