Difference between revisions of "Reference Talk:Version Directive"
Jholsenback (talk | contribs) (initial v3.8 overhaul) |
Jholsenback (talk | contribs) m (incremental save) |
||
Line 3: | Line 3: | ||
{{#indexentry:#version}} | {{#indexentry:#version}} | ||
{{#indexentry:version}} | {{#indexentry:version}} | ||
− | <p> | + | <p>Since POV-Ray has evolved over the years from version 1.0 through 3.8 we have made every effort to maintain some amount of backwards compatibility with earlier versions. Some old or obsolete features can be handled directly without any special consideration by the user. Some old or obsolete features can no longer be handled at all. However <em>some</em> old features can still be used if you warn POV-Ray that this is an older scene. The <code>#version</code> directive can be used to switch version compatibility, or change default settings several times throughout a scene file.</p> |
<p>The syntax is:</p> | <p>The syntax is:</p> | ||
Line 12: | Line 12: | ||
</pre> | </pre> | ||
− | <p>As of version 3.7 the following <em>requirement</em> has been implemented. In order to obtain full version 3.7 functionality | + | <p>There must be a semi-colon after the float expression in a <code>#version</code> directive. This semi-colon is introduced in POV-Ray version 3.1. If omitted, it generates a warning and some macros may not work properly. Unless the version compatibility option has explicitly been set by the INI file option <code>Version=</code><em>n.n</em> or by the <code>+MV</code><em>n.n</em> command-line switch, <code>version</code> evaluates to the actual POV-Ray software version when used inside the first <code>#version</code> statement, even in version 3.8 or later where it evaluates to the effective version compatibility option anywhere else. Additionally you may use the <code>Version=</code><em>n.n</em> option or the <code>+MV</code><em>n.n</em> switch to establish the <em>initial</em> setting. See <!--<linkto "Language Version">Language Version</linkto>--->[[Reference:Scene Parsing Options#Language Version|Language Version]] for details. For example, one feature introduced in 2.0 that was incompatible with any 1.0 scene files is the parsing of float expressions. Using <code>#version 1.0</code> turns off expression parsing as well as many warning messages so that nearly all 1.0 files will still work. Some obsolete or re-designed features <em>are totally unavailable in the current version of POV-Ray REGARDLESS OF THE VERSION SETTING.</em> Details on these features are noted throughout this documentation.</p> |
+ | |||
+ | <p>As of version 3.7 the following <em>requirement</em> has been implemented. In order to obtain full version 3.7 functionality you <em>MUST</em> specify the <code>#version 3.7</code> directive in your scene file. Prior to a <code>#version</code> directive appearing, the version defaults to 3.62, additionally, if the first <code>#version</code> directive appears after any other declaration, or a <code>#version</code> directive does not appear at all, a post-parse warning is issued. A {{Change}} as of POV-Ray 3.8 now makes it an outright error to use <code>#version 3.8</code> or higher in a main scene file that does not start with a <code>#version</code> directive.</p> | ||
+ | |||
+ | <p class="Note"><strong>Note:</strong> The version directive and command-line setting no longer provides compatibility with most rendering bugs in versions prior to POV-Ray 3.5. However, compatibility with the scene language is provided for scenes as old as POV-Ray 1.0 just as in all previous versions of POV-Ray. Nevertheless, we strongly recommend you update scenes at least to POV-Ray 3.7 syntax if you plan to use them in future versions of POV-Ray.</p> | ||
<p>If you do need to do some processing before you decide on a version compatibility option, start your scene with the following | <p>If you do need to do some processing before you decide on a version compatibility option, start your scene with the following | ||
Line 20: | Line 24: | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<p>The built-in float identifier <code>version</code> contains the current setting of the version compatibility option. See | <p>The built-in float identifier <code>version</code> contains the current setting of the version compatibility option. See | ||
− | Float Expressions: [[Reference:Numeric Expressions#Built-in Variables|:Float, built-in variables|Built-in Variables]]. Together with the built-in <code>version</code> identifier the <code>#version</code> directive allows you to save and restore the previous values of this compatibility setting. The | + | Float Expressions: [[Reference:Numeric Expressions#Built-in Variables|:Float, built-in variables|Built-in Variables]]. Together with the built-in <code>version</code> identifier the <code>#version</code> directive allows you to save and restore the previous values of this compatibility setting. The <code>#local</code> identifier option is especially useful here. For example, suppose <code>mystuff.inc</code> is in version 3.5 format. At the top of the file you could put:</p> |
<pre> | <pre> | ||
#local Temp_Vers = version; // Save previous value | #local Temp_Vers = version; // Save previous value | ||
Line 38: | Line 32: | ||
#version Temp_Vers; // Restore previous version | #version Temp_Vers; // Restore previous version | ||
</pre> | </pre> | ||
− | |||
− |
Revision as of 13:44, 30 September 2018
Since POV-Ray has evolved over the years from version 1.0 through 3.8 we have made every effort to maintain some amount of backwards compatibility with earlier versions. Some old or obsolete features can be handled directly without any special consideration by the user. Some old or obsolete features can no longer be handled at all. However some old features can still be used if you warn POV-Ray that this is an older scene. The #version
directive can be used to switch version compatibility, or change default settings several times throughout a scene file.
The syntax is:
VERSION_DIRECTIVE: #version FLOAT;
There must be a semi-colon after the float expression in a #version
directive. This semi-colon is introduced in POV-Ray version 3.1. If omitted, it generates a warning and some macros may not work properly. Unless the version compatibility option has explicitly been set by the INI file option Version=
n.n or by the +MV
n.n command-line switch, version
evaluates to the actual POV-Ray software version when used inside the first #version
statement, even in version 3.8 or later where it evaluates to the effective version compatibility option anywhere else. Additionally you may use the Version=
n.n option or the +MV
n.n switch to establish the initial setting. See Language Version for details. For example, one feature introduced in 2.0 that was incompatible with any 1.0 scene files is the parsing of float expressions. Using #version 1.0
turns off expression parsing as well as many warning messages so that nearly all 1.0 files will still work. Some obsolete or re-designed features are totally unavailable in the current version of POV-Ray REGARDLESS OF THE VERSION SETTING. Details on these features are noted throughout this documentation.
As of version 3.7 the following requirement has been implemented. In order to obtain full version 3.7 functionality you MUST specify the #version 3.7
directive in your scene file. Prior to a #version
directive appearing, the version defaults to 3.62, additionally, if the first #version
directive appears after any other declaration, or a #version
directive does not appear at all, a post-parse warning is issued. A Change as of POV-Ray 3.8 now makes it an outright error to use #version 3.8
or higher in a main scene file that does not start with a #version
directive.
Note: The version directive and command-line setting no longer provides compatibility with most rendering bugs in versions prior to POV-Ray 3.5. However, compatibility with the scene language is provided for scenes as old as POV-Ray 1.0 just as in all previous versions of POV-Ray. Nevertheless, we strongly recommend you update scenes at least to POV-Ray 3.7 syntax if you plan to use them in future versions of POV-Ray.
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;
The built-in float identifier version
contains the current setting of the version compatibility option. See
Float Expressions: Built-in Variables. Together with the built-in version
identifier the #version
directive allows you to save and restore the previous values of this compatibility setting. The #local
identifier option is especially useful here. For example, suppose mystuff.inc
is in version 3.5 format. At the top of the file you could put:
#local Temp_Vers = version; // Save previous value #version 3.5; // Change to 3.5 mode ... // Version 3.5 stuff goes here... #version Temp_Vers; // Restore previous version