From 4b94a4bd273d3489f5717903f5239af86395539c Mon Sep 17 00:00:00 2001 From: Vasily Date: Sat, 30 May 2020 15:45:01 +0200 Subject: [PATCH] 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. --- src/tabcontrollers/ChaperoneTabController.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tabcontrollers/ChaperoneTabController.h b/src/tabcontrollers/ChaperoneTabController.h index a5823f5..443ce9f 100644 --- a/src/tabcontrollers/ChaperoneTabController.h +++ b/src/tabcontrollers/ChaperoneTabController.h @@ -80,7 +80,10 @@ struct ChaperoneProfile : settings::ISettingsObject o.addValue( includesChaperoneGeometry ); o.addValue( static_cast( 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( obj.getNextValueOrDefault( 0 ) ); - // chaperoneGeometryQuads = nullptr; const auto chaperoneGeometryQuadsValid = obj.getNextValueOrDefault( false ); if ( chaperoneGeometryQuadsValid )