POV-Ray : Newsgroups : povray.general : Some more image to POV stuff in exchange for a good name Server Time
6 Jan 2025 15:35:35 EST (-0500)
  Some more image to POV stuff in exchange for a good name (Message 10 to 19 of 19)  
<<< Previous 9 Messages Goto Initial 10 Messages
From: Bald Eagle
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 24 Dec 2024 12:35:00
Message: <web.676af04ab095aa55d97b426e25979125@news.povray.org>
Ilya Razmanov <ily### [at] gmailcom> wrote:

> Hm, I've seen "Input_File_Name" in "Command-Line and INI-File Options",
> and I always assumed that all this work only with ini and stuff.

It does not control anything.  It's a defined identifier.

> So, it works within scene as well? Where can I learn more about this
> (beside thin NG, I mean.

Always the WIKI:
https://wiki.povray.org/content/Reference:Strings

It also looks like
the link for input_file_name at
https://wiki.povray.org/content/Reference:Keywords
is supposed to have a reference to this keyword - but doesn't.

> Surely I ask questions here sometimes, but
> still I understand that teaching me POVRay is not the main reason for
> this NG existence)?

No way.  Our time machine was invented just to go back and make it all for you!
:)
We all are learners being taught, and become teachers of our own little areas of
experience and expertise.

> There are ways to control stuff from the scene that
> are normally controlled from ini?

.. . . sort of.
If you look at the way the sample scenes get automagically generated from a
script, the script is actually doing the controlling, but it uses the image
sizes that it reads from within the scene file.

Also, if you look up my self-including include file, then you might invent a way
 to parse values in the scene, (over)write to the file, and then include it
again....

You might be able to (re)write the resolution.ini file, or something - but I
think POV-Ray generally doesn't allow for potentially malicious coding exploits.

- BW


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 26 Dec 2024 04:00:18
Message: <676d1b22$1@news.povray.org>
Well, as major Kaprov said, "if I did something wrong please report and 
then I will be thinking". I guess I will follow this old army procedure 
and be thinking :-)

> You might be able to (re)write the resolution.ini file, or something - but I
> think POV-Ray generally doesn't allow for potentially malicious coding exploits.

Don't worry, I'm famous for my capabilities to send PC into an infinite 
loop, filling all the memory. That's what recursions (see "Recursions") 
are invented for.

-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 27 Dec 2024 06:30:02
Message: <676e8fba$1@news.povray.org>
On 24.12.2024 20:32, Bald Eagle wrote:

> We all are learners being taught, and become teachers of our own little areas of
> experience and expertise.

Ok, I just discovered #ifndef which makes it easy to have defaults in 
.inc yet override them with .pov stub.

Dementia is great decease - no pain, and you learn something new every 
day! (c) local saying

-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 3 Jan 2025 10:38:25
Message: <67780471$1@news.povray.org>
On 24.12.2024 18:03, Bald Eagle wrote:

> So what you do is this:
> 
> #if (input_file_name = "MySceneFile.inc")
> 
>     Camera
>     Lights
>     whatever else
> 
> #end
> 
> Then rest of your scene is _just_ the include file.

Well, don't quite like this solution since it's not immune to simple 
file rename. But I started to think (yes, following comrade major 
scheme) and eventually and inevitably came to conclusion that

#declare extension = substr(input_file_name, strlen(input_file_name) - 3, 4)

#debug extension

shows me

.pov

and even subsequent

#if (extension = ".pov")
   #debug "Match!\n"
#end

says "Match!"

Combining it with your suggestion, I guess I can produce files that work 
as a whole scene when they are .pov, and as include after renaming to .inc

But this is not confirmed experimentally yet ;-)

-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

From: Bald Eagle
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 3 Jan 2025 10:55:00
Message: <web.677807f5b095aa55327467e125979125@news.povray.org>
Ilya Razmanov <ily### [at] gmailcom> wrote:

> Well, don't quite like this solution since it's not immune to simple
> file rename.

It ought to be.

Write a tiny .pov file that outputs the value of input_file_name to the debug
stream.   Rename the file.  Render it again.

Since you're opening the file as the main .pov file, that's what input_file_name
gets defined as.

If you write another .pov file that INCLUDES the first .pov file, then it's the
main file that gets its filename assigned to input_file_name.

That's why this ought to be a good solution for you.

Just try it - you'll see.

- BW


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 3 Jan 2025 11:28:37
Message: <67781035$1@news.povray.org>
On 03.01.2025 18:53, Bald Eagle wrote:
> 
> If you write another .pov file that INCLUDES the first .pov file, then it's the
> main file that gets its filename assigned to input_file_name.

Yep, already tried my idea with extensions out - oops, it seems like 
.inc file gets extension from master file, which is .pov, so my idea 
with extensions doesn't work. Guess it was just too beautiful for this 
world...

-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 3 Jan 2025 12:42:47
Message: <67782197$1@news.povray.org>
On 03.01.2025 18:53, Bald Eagle wrote:
> 
> That's why this ought to be a good solution for you.
> 

...on the other hand, I still may use extension trick to make 
self-rendering .inc as you suggested, but reacting to extension only 
rather that a whole file name...

-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

From: Leroy
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 3 Jan 2025 14:45:00
Message: <web.67783d99b095aa5536bcdbf3f712fc00@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Ilya Razmanov <ily### [at] gmailcom> wrote:
>
> Found it.
>
https://news.povray.org/povray.general/message/%3CXnsAC0E5196CA622seed7%40news.povray.org%3E/#%3CXnsAC0E5196CA622seed
7%
> 40news.povray.org%3E
>
> So what you do is this:
>
> #if (input_file_name = "MySceneFile.inc")
>
>    Camera
>    Lights
>    whatever else
>
> #end
>
> Then rest of your scene is _just_ the include file.
>
> That way, if you're including your file in another file, it doesn't run the
> extra scene setup code.
> But if you're running it as a standalone file, you obviously need the scene
> setup stuff to render anything - and so it's all right there.
>
> - BW

That works alright. But, I've use this for a long time

#ifndef(Get)
 do what ever
#end

Then define 'Get' in the calling file. This works even if you change the name of
 the inc file. Which I do often when I'm testing ideas.
I really should use the 'input_file_name' test more.
Have fun!


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 3 Jan 2025 16:19:01
Message: <67785445$1@news.povray.org>
On 03.01.2025 22:42, Leroy wrote:

> That works alright. But, I've use this for a long time
> 
> #ifndef(Get)
>   do what ever
> #end

LOL. That's too simple to think of it ;-)))


-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

From: Alain Martel
Subject: Re: Some more image to POV stuff in exchange for a good name
Date: 3 Jan 2025 16:28:35
Message: <67785683@news.povray.org>
Le 2025-01-03 à 16:19, Ilya Razmanov a écrit :
> On 03.01.2025 22:42, Leroy wrote:
> 
>> That works alright. But, I've use this for a long time
>>
>> #ifndef(Get)
>>   do what ever
>> #end
> 
> LOL. That's too simple to think of it ;-)))
> 
> 

The includes from the distribution use a trick like that.

#ifndef(Flag)
#declare Flag=version;
  do include stuff
#end

This prevent parsing the include multiple times if it get formally 
included and included by another include.


Post a reply to this message

<<< Previous 9 Messages Goto Initial 10 Messages

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