POV-Ray : Newsgroups : povray.general : #version directive Server Time
24 Nov 2024 18:52:49 EST (-0500)
  #version directive (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: Mike Horvath
Subject: #version directive
Date: 6 Feb 2018 21:23:20
Message: <5a7a6318$1@news.povray.org>
Does `#version 3.7` have to appear at the very top of a scene file? Or 
can I store it as a variable or use it in a condition first? E.g.


   #declare MyVersion = version;
   #if (something = true)
     #version 3.7
   #else
     #version 3.6
   #end

Thanks.

Mike


Post a reply to this message

From: Bald Eagle
Subject: Re: #version directive
Date: 7 Feb 2018 05:35:01
Message: <web.5a7ad640c5234a595cafe28e0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> Does `#version 3.7` have to appear at the very top of a scene file? Or
> can I store it as a variable or use it in a condition first? E.g.
>
>
>    #declare MyVersion = version;
>    #if (something = true)
>      #version 3.7
>    #else
>      #version 3.6
>    #end

Both.
POV-Ray expects to fins a #version directive (and a global settings block with
gamma) at the beginning of every file, and will issue a warning is those are not
present.
You can, however, then go on to change the version the parser uses to interpret
your code by issuing another #version directive.
IIRC, this is done with some include files or macros, where the current version
is stored like you do above, and then after that block of code is run, the
version is restored by
#version MyVersion

Hope that makes sense.


Post a reply to this message

From: Stephen
Subject: Re: #version directive
Date: 7 Feb 2018 07:13:12
Message: <5a7aed58$1@news.povray.org>
On 07/02/2018 10:34, Bald Eagle wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>> Does `#version 3.7` have to appear at the very top of a scene file? Or
>> can I store it as a variable or use it in a condition first? E.g.
>>
>>
>>     #declare MyVersion = version;
>>     #if (something = true)
>>       #version 3.7
>>     #else
>>       #version 3.6
>>     #end
> 
> Both.
> POV-Ray expects to fins a #version directive (and a global settings block with
> gamma) at the beginning of every file, and will issue a warning is those are not
> present.
> You can, however, then go on to change the version the parser uses to interpret
> your code by issuing another #version directive.
> IIRC, this is done with some include files or macros, where the current version
> is stored like you do above, and then after that block of code is run, the
> version is restored by
> #version MyVersion
> 
> Hope that makes sense.
> 
> 
Parse Warning: This scene had other declarations preceding the first 
#version directive. Please be aware that as of Pov-Ray 3.7, un1ess 
a1ready specified via an INI option, a #version is expected as the first 
declaration in a scene file. If this is not done, POV—Ray may apply 
compatibility settings to some features that are intended to make pre - 
3.7 scenes render as designed. You are strongly encouraged to add a 
#version statement to the scene to make your intent c1ear. Future 
versions of Pov-Ray may make the presence of a #ver51on mandatory.

Which means it might not work in the future.

-- 

Regards
     Stephen


Post a reply to this message

From: Mike Horvath
Subject: Re: #version directive
Date: 7 Feb 2018 15:03:22
Message: <5a7b5b8a$1@news.povray.org>
On 2/7/2018 7:13 AM, Stephen wrote:
> Parse Warning: This scene had other declarations preceding the first 
> #version directive. Please be aware that as of Pov-Ray 3.7, un1ess 
> a1ready specified via an INI option, a #version is expected as the first 
> declaration in a scene file. If this is not done, POV—Ray may apply 
> compatibility settings to some features that are intended to make pre - 
> 3.7 scenes render as designed. You are strongly encouraged to add a 
> #version statement to the scene to make your intent c1ear. Future 
> versions of Pov-Ray may make the presence of a #ver51on mandatory.
> 
> Which means it might not work in the future.
> 

Yes, that's what I was worried about.

Mike


Post a reply to this message

From: dick balaska
Subject: Re: #version directive
Date: 7 Feb 2018 15:42:51
Message: <5a7b64cb$1@news.povray.org>
On 02/07/2018 03:03 PM, Mike Horvath wrote:
> On 2/7/2018 7:13 AM, Stephen wrote:
>> Parse Warning: This scene had other declarations preceding the first 
>> #version directive. Please be aware that as of Pov-Ray 3.7, un1ess 
>> a1ready specified via an INI option, a #version is expected as the 
>> first declaration in a scene file. If this is not done, POV—Ray may 
>> apply compatibility settings to some features that are intended to 
>> make pre - 3.7 scenes render as designed. You are strongly encouraged 
>> to add a #version statement to the scene to make your intent c1ear. 
>> Future versions of Pov-Ray may make the presence of a #ver51on mandatory.
>>
>> Which means it might not work in the future.
>>
> 
> Yes, that's what I was worried about.
> 
> Mike

You could open with
#version 3.7

and then ignore it and do your calculated version when you're ready (I 
mean, like 5 lines below the initial #version).  That should satisfy the 
parser and work like you expect.

-- 
dik
Rendered 920576 of 921600 pixels (99%)


Post a reply to this message

From: Stephen
Subject: Re: #version directive
Date: 7 Feb 2018 15:48:51
Message: <5a7b6633$1@news.povray.org>
On 07/02/2018 20:03, Mike Horvath wrote:
> On 2/7/2018 7:13 AM, Stephen wrote:
>> Parse Warning: This scene had other declarations preceding the first 
>> #version directive. Please be aware that as of Pov-Ray 3.7, un1ess 
>> a1ready specified via an INI option, a #version is expected as the 
>> first declaration in a scene file. If this is not done, POV—Ray may 
>> apply compatibility settings to some features that are intended to 
>> make pre - 3.7 scenes render as designed. You are strongly encouraged 
>> to add a #version statement to the scene to make your intent c1ear. 
>> Future versions of Pov-Ray may make the presence of a #ver51on mandatory.
>>
>> Which means it might not work in the future.
>>
> 
> Yes, that's what I was worried about.
> 

Me too as I use a modeller and the version correction is done after the 
global settings.

-- 

Regards
     Stephen


Post a reply to this message

From: clipka
Subject: Re: #version directive
Date: 7 Feb 2018 15:52:28
Message: <5a7b670c$1@news.povray.org>
Am 07.02.2018 um 03:23 schrieb Mike Horvath:
> Does `#version 3.7` have to appear at the very top of a scene file? Or
> can I store it as a variable or use it in a condition first? E.g.
> 
> 
>   #declare MyVersion = version;
>   #if (something = true)
>     #version 3.7
>   #else
>     #version 3.6
>   #end
> 
> Thanks.

If you want your scene to automatically adapt to whatever version is
used, it is recommended to use

    #version version;

as the first line and continue from there.


Post a reply to this message

From: clipka
Subject: Re: #version directive
Date: 7 Feb 2018 15:55:50
Message: <5a7b67d6$1@news.povray.org>
Am 07.02.2018 um 21:48 schrieb Stephen:
> On 07/02/2018 20:03, Mike Horvath wrote:
>> On 2/7/2018 7:13 AM, Stephen wrote:
>>> Parse Warning: This scene had other declarations preceding the first
>>> #version directive. Please be aware that as of Pov-Ray 3.7, un1ess
>>> a1ready specified via an INI option, a #version is expected as the
>>> first declaration in a scene file. If this is not done, POV—Ray may
>>> apply compatibility settings to some features that are intended to
>>> make pre - 3.7 scenes render as designed. You are strongly encouraged
>>> to add a #version statement to the scene to make your intent c1ear.
>>> Future versions of Pov-Ray may make the presence of a #ver51on
>>> mandatory.
>>>
>>> Which means it might not work in the future.
>>>
>>
>> Yes, that's what I was worried about.
>>
> 
> Me too as I use a modeller and the version correction is done after the
> global settings.

As long as the `#version` statement specifies a value of 3.7 or lower,
this will continue to work even in future versions.


Post a reply to this message

From: Kenneth
Subject: Re: #version directive
Date: 8 Feb 2018 05:55:00
Message: <web.5a7c2b99c5234a59a47873e10@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

>
> If you want your scene to automatically adapt to whatever version is
> used, it is recommended to use
>
>     #version version;
>
> as the first line and continue from there.

I didn't realize this, even after re-reading the docs; the combination of the
#version directive and  version keyword has always been a little mysterious to
me. So, no matter what version of POV-Ray I'm using (or what version my scene
was originally written with), if I use

#version version

then the scene file will automatically be processed *as if* it was written in
the currently-running POV-Ray version? (I hope I'm being clear.) Disregarding
any compatibility problems that might arise, of course, if the scene file is an
old one. In other words, if I'm currently using a specific v3.7.1 beta, then

#version version
is basically a 'shorthand' way of specifying

#version 3.71;

?

The thing is, the docs say this:
"As of version 3.7, there has been a requirement implemented. In order to obtain
full version 3.7 functionality, you MUST specify the #version 3.7".  Or 3.71,
etc. But there, it doesn't mention the   #version version   trick (or rather,
the short explanation is not totally clear that it can be used instead.)

Also, this:
"...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
error to use #version 3.71 or higher in a main scene file that does not start
with a #version directive."

Maybe it's just me, but that sounds confusing. "#version 3.71" is in GREEN there
(like the other keywords used in those paragraphs), but is it meant to be? I'm
wondering if the sentence is actually trying to say something like this:

"...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
error to run a scene file in v3.7.1 or higher that does not start with a
#version directive."  ??

And continuing... (the forward slashes are mine):
"If you do need to do some processing /before you decide/ on a version
compatibility option, start your scene with the following construct:
  #version version;

That could possibly be interpreted as meaning a 'real' #version number needs to
be added later in the scene.

If I'm wrong about any of this, I apologize for possibly confusing the issue
further ;-)


Post a reply to this message

From: Bald Eagle
Subject: Re: #version directive
Date: 8 Feb 2018 10:20:01
Message: <web.5a7c6a73c5234a59c437ac910@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
> clipka <ano### [at] anonymousorg> wrote:
>
> >
> > If you want your scene to automatically adapt to whatever version is
> > used, it is recommended to use
> >
> >     #version version;
> >
> > as the first line and continue from there.
>
> I didn't realize this, even after re-reading the docs; the combination of the
> #version directive and  version keyword has always been a little mysterious to
> me. So, no matter what version of POV-Ray I'm using (or what version my scene
> was originally written with), if I use
>
> #version version
>
> then the scene file will automatically be processed *as if* it was written in
> the currently-running POV-Ray version? (I hope I'm being clear.)

Essentially, yes.
I think that the term keyword blurs certain things, and would like to see a
change to something more descriptive _like_ "POV-Ray reserved constant."

>Disregarding
> any compatibility problems that might arise, of course, if the scene file is an
> old one. In other words, if I'm currently using a specific v3.7.1 beta, then
>
> #version version
> is basically a 'shorthand' way of specifying
>
> #version 3.71;
>
> ?

Again, yes.
The thing to do would be to write a short SDL script that sends the value of
version to the debug stream.
Then do #version 3.5, do #version version again, and see what version equals.
In that case, if version winds up being 3.5, then version is a "POV-Ray
predefined variable", rather than a constant that reflects the version of the
build.

Perhaps there ought to be a secondary "software_version" or "current_version"
constant that immutably reflects the software version.

> The thing is, the docs say this:
> "As of version 3.7, there has been a requirement implemented. In order to obtain
> full version 3.7 functionality, you MUST specify the #version 3.7".  Or 3.71,
> etc. But there, it doesn't mention the   #version version   trick (or rather,
> the short explanation is not totally clear that it can be used instead.)

Right, well, there's kind of a lot of that in the docs.

> Also, this:
> "...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
> error to use #version 3.71 or higher in a main scene file that does not start
> with a #version directive."
>
> Maybe it's just me, but that sounds confusing. "#version 3.71" is in GREEN there
> (like the other keywords used in those paragraphs), but is it meant to be? I'm
> wondering if the sentence is actually trying to say something like this:
>
> "...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
> error to run a scene file in v3.7.1 or higher that does not start with a
> #version directive."  ??

I do believe you are correct, and that should be changed.

> And continuing... (the forward slashes are mine):
> "If you do need to do some processing /before you decide/ on a version
> compatibility option, start your scene with the following construct:
>   #version version;
>
> That could possibly be interpreted as meaning a 'real' #version number needs to
> be added later in the scene.

Well, version is a "real" version number, it may just not be the desired one, or
one appropriate for correctly parsing a section of the SDL.

> If I'm wrong about any of this, I apologize for possibly confusing the issue
> further ;-)


The real trick here would be to somehow summarize WHY you'd want to specify an
earlier version, and list all of the directives that are "parsed / interpreted /
executed differently" depending on the version specified.

Ugh.


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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