|
|
Found a v3.8 onward bug(*) while running a scene Kenneth posted in this
thread:
https://news.povray.org/povray.binaries.programming/thread/%3C65b14502%40news.povray.org%3E/
The internal version defaulting sometimes does not run leaving the
values which should be set by the defaulting mechanism to whatever
defaulting is otherwise done on the creation of initial scene data.
In parser.cpp and the function Parser::Run() there is a call to
InitDefaults(). Whether InitDefaults() does anything depends on whether
the initial version selects the DefaultsVersion::kLegacy set or the
DefaultsVersion::k380 set; Further, after the selection, whether the set
of version defaults is different than that set just above the call to
InitDefaults() pointed to with the variable defaultsVersion.
If the defaultVersion aligns with DefaultsVersion, InitDefaults() does
nothing. There are only two states, so half the time it doesn't do the
initialization it should(*). We need three DefaultsVersion states to
force InitDefaults() to always run at least once at the start of parsing.
The fix
-------
In parser.h change:
enum class DefaultsVersion : char
{
kLegacy, ///< Pre-v3.8 defaults.
k380, ///< v3.8.0 defaults.
};
to:
enum class DefaultsVersion : char
{
kInvalid, ///< Use in Parser::Run() as initial default.
kLegacy, ///< Pre-v3.8 defaults.
k380, ///< v3.8.0 defaults.
};
In parser.cpp and Parser::Run(), before the InitDefaults() call, change:
defaultsVersion = DefaultsVersion::kLegacy;
or
defaultsVersion = DefaultsVersion::k380;
to:
defaultsVersion = DefaultsVersion::kInvalid;
(*) - There are many ways the bug can be hidden by option and scene
settings. It might be too, even if tripping the bug, the internal
defaulting of values outside of InitDefaults() aligns with the
particular scene being run - and so no ill effects are seen.
Bill P.
Post a reply to this message
|
|