|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I was going through my old POV files and ran across my Get macro.
Before I tell you about it I need to tell ya why I needed it.
I got tired of have two files for every object file I made. The file itself and
one to display or test what it does.
So I combine them by using the Get variable. If the Get variable was not
defined then a display would show what the file did. If included from another
file with Get defined, there was no display. Which works for a single call to
a file or a group of files. The trouble comes when you have nest several these
'Get' files.It can be hard to Test just part of the nested group.
What the Get macro does is keep track of how many files have been include and
kills the Get variable when it is no longer needed. Here it is!
#ifndef(Get_Mac_Ver)
#declare Get_Mac_Ver=1.1;
#ifdef(Get) #undef Get #end
#macro StrFill(Str,C,N)//helps display
#local I=1;
#while(I<=N) #declare Str=concat(Str,C); #local I=I+1;#end
#end
#macro GET(Str)
#ifndef(Get_Stack_Count) #declare Get_Stack_Count=1;
#else #declare Get_Stack_Count=Get_Stack_Count+1;
#end
#ifdef(View_POV_Include_Stack)
#local A="";StrFill(A," ",Get_Stack_Count*2)
#debug concat(A,"Getting ",Str,"\n")
#end
#declare Get=1;
#include Str
#declare Get_Stack_Count=Get_Stack_Count-1;
#if(Get_Stack_Count=0)
#ifdef(Get) #undef Get #end
#end
#ifndef(Get_File_Count) #declare Get_File_Count=1;
#else #declare Get_File_Count=Get_File_Count+1;
#end
#end
#end
This can use #debug.inc to display what files where got.
I was wondering if I should put it on my web site.
Any comment would be helpful
Have Fun!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Leroy" <whe### [at] gmailcom> wrote:
> So I combine them by using the Get variable. If the Get variable was not
> defined then a display would show what the file did. If included from another
> file with Get defined, there was no display. Which works for a single call to
> a file or a group of files. The trouble comes when you have nest several these
> 'Get' files.It can be hard to Test just part of the nested group.
>
> What the Get macro does is keep track of how many files have been include and
> kills the Get variable when it is no longer needed. Here it is!
So - this seems very much like how I set up a lot of my include files - using an
"SDL" variable - which if set, ignores the leading code block of the file, and
if not, #declares all of the usual things one needs to render the file (as a
standalone scene) like #version, camera, light_source, etc.
You've gone an extra step and created a macro and stack - which is what I've
been playing with in another set of files that is under development.
I think what you have is good - and would benefit from being supplemented with a
series of files to demonstrate the function and utility of the macro, and
highlight the tricky situation(s) that might exist and which the macro and stack
solves.
Then wrap it up in a [version-marked] zip file.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> So - this seems very much like how I set up a lot of my include files - using an
> "SDL" variable - which if set, ignores the leading code block of the file, and
> if not, #declares all of the usual things one needs to render the file (as a
> standalone scene) like #version, camera, light_source, etc.
>
> You've gone an extra step and created a macro and stack - which is what I've
> been playing with in another set of files that is under development.
>
> I think what you have is good - and would benefit from being supplemented with a
> series of files to demonstrate the function and utility of the macro, and
> highlight the tricky situation(s) that might exist and which the macro and stack
> solves.
> Then wrap it up in a [version-marked] zip file.
Thanks for your advice. I have a bunch files I used to test the macro. I just
need to clean them up and create an read me file. I showed the macro here as
kind of a teaser, just to show its basic set up. So people could evaluate it.
It's hard for me to decided just what I should put on my website that other
people can use. There are things there that should be dropped or reworked.
I don't get on the net to often (as you can tell by this late reply) and when I
do there is so much stuff to do that I don't chat as much as I should. So I
don't get a good feel of what is useful to other users of POV-ray.
Have Fun!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
in news:web.5f0cba1a35748460e3ef795d0@news.povray.org Leroy wrote:
> So I combine them by using the Get variable. If the Get variable was
> not
This is what I add to the bottom of my include files
#if(input_file_name="yourfile.inc")
put the test scene here
#end
When the .inc file is included from somewhere it does not render the test
scene. If run solo it renders the test.
Ingo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 8/3/20 2:01 AM, ingo wrote:
> in news:web.5f0cba1a35748460e3ef795d0@news.povray.org Leroy wrote:
>
>> So I combine them by using the Get variable. If the Get variable was
>> not
>
> This is what I add to the bottom of my include files
>
> #if(input_file_name="yourfile.inc")
>
> put the test scene here
>
> #end
>
> When the .inc file is included from somewhere it does not render the test
> scene. If run solo it renders the test.
>
> Ingo
>
Thank you! A neat trick. Happens I was recently thinking about the lack
of general testing of the shipped include files. I have Worries a few
macros might not be working properly glancing at the code.
Bill P.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 8/3/20 9:04 AM, William F Pokorny wrote:
> On 8/3/20 2:01 AM, ingo wrote:
...
>> This is what I add to the bottom of my include files
>>
>> #if(input_file_name="yourfile.inc")
>>
>> put the test scene here
>>
>> #end
>>
>> When the .inc file is included from somewhere it does not render the test
>> scene. If run solo it renders the test.
>>
...
> Thank you! A neat trick. Happens I was recently thinking about the lack
> of general testing of the shipped include files. I have Worries a few
> macros might not be working properly glancing at the code.
...
>
FYI. If using this self test trick on includes which switch versions
internally as do the standard shipped includes, one needs to set the
version ahead of the version change inside the include file. In other
words, your command line needs to be something like:
povray +mv3.8 +irand.inc
otherwise, POV-Ray v3.7 onward stops with an error because the #version
directive isn't the first line in the include file.
Bill P.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
William F Pokorny <ano### [at] anonymousorg> wrote:
> > #if(input_file_name="yourfile.inc")
> Thank you! A neat trick.
> Bill P.
Is there a way to display the directory or full path name of the input file?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ingo <ing### [at] tagpovrayorg> wrote:
> in news:web.5f0cba1a35748460e3ef795d0@news.povray.org Leroy wrote:
>
> > So I combine them by using the Get variable. If the Get variable was
> > not
>
> This is what I add to the bottom of my include files
>
> #if(input_file_name="yourfile.inc")
>
> put the test scene here
>
> #end
>
> When the .inc file is included from somewhere it does not render the test
> scene. If run solo it renders the test.
>
> Ingo
I like it!
So my Get macro need not be.
I started using that 'Get' way back when... I think 3.0 dos.
I just didn't know 'input_file_name' could be access from a POV render file.
Let's face it there is a lot to POV!
Have Fun!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Leroy" <whe### [at] gmailcom> wrote:
> ingo <ing### [at] tagpovrayorg> wrote:
> > #if(input_file_name="yourfile.inc")
> I just didn't know 'input_file_name' could be access from a POV render file.
I know that the full pathname is accessible / can be used from within an ini
file, but is the same true for a scene file?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 8/23/20 5:38 PM, Bald Eagle wrote:
> "Leroy" <whe### [at] gmailcom> wrote:
>> ingo <ing### [at] tagpovrayorg> wrote:
>
>>> #if(input_file_name="yourfile.inc")
>
>> I just didn't know 'input_file_name' could be access from a POV render file.
>
> I know that the full pathname is accessible / can be used from within an ini
> file, but is the same true for a scene file?
>
I just tried my functions.inc povr self test with:
povr2 +mv3.8 +i/tmp/functions.inc
where the code compared with:
#if(input_file_name="/tmp/functions.inc")
and it did not work. If the compare is the usual:
#if(input_file_name="functions.inc")
you can specify the full path or let POV-Ray find a functions.inc file
in the active library paths and the compare works OK. In other words,
the input_file name looks to only be the file name tail - which the unix
html documentation does not mention that I can see.
---- v3.8 doc issues...
Aside: In the local unix docs(1), 3.3 Scene Description Language has the
following sentence in the second paragraph:
"Files are created in plain ASCII text using an editor of your choice."
which is no longer true with utf8 support.
(1) - In the online http://wiki.povray.org/content/Reference:Keywords
the input_file_name index entry never takes me to a section with
input_file_name documentation! Rather I always end up in the section:
http://wiki.povray.org/content/Reference:Numeric_Expressions#Built-in_Variables
which has nothing about input_file_name.
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...
Bill P.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |