Skip to content

Commit

Permalink
Fix chaperone profiles not loading correctly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
username223 committed May 31, 2020
1 parent 410cbd6 commit 4b94a4b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tabcontrollers/ChaperoneTabController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit 4b94a4b

Please sign in to comment.