Fix chaperone profiles not loading correctly

Saving a profile with only visibility changed, the saved struct looks
like
bools\1\bools=false
bools\2\bools=true
bools\3\bools=false
bools\4\bools=false

The load function expects 2 bool values before loading
`includesVisibility`, leading it to getting a false value (actually
includesFadeDistance).

Making the struct save the `chaperoneGeometryQuadsValid` that it expects
to be saved there fixes the issue.

This bug highlights issues with the current object settings system, in
that debugging is unnecessarily tedious and difficult.
This commit is contained in:
Vasily
2020-05-31 08:50:48 +02:00
committed by username223
parent 410cbd65b9
commit 4b94a4bd27
+4 -2
View File
@@ -80,7 +80,10 @@ struct ChaperoneProfile : settings::ISettingsObject
o.addValue( includesChaperoneGeometry );
o.addValue( static_cast<int>( chaperoneGeometryQuadCount ) );
if ( chaperoneGeometryQuadCount > 0 )
const auto chaperoneGeometryQuadsValid = chaperoneGeometryQuadCount > 0;
o.addValue( chaperoneGeometryQuadsValid );
if ( chaperoneGeometryQuadsValid )
{
for ( auto& arrayMember : chaperoneGeometryQuads )
{
@@ -157,7 +160,6 @@ struct ChaperoneProfile : settings::ISettingsObject
chaperoneGeometryQuadCount
= static_cast<unsigned>( obj.getNextValueOrDefault( 0 ) );
// chaperoneGeometryQuads = nullptr;
const auto chaperoneGeometryQuadsValid
= obj.getNextValueOrDefault( false );
if ( chaperoneGeometryQuadsValid )