From 4f5c541ade082a8057d9f5c1e94be8fef34aefdf Mon Sep 17 00:00:00 2001 From: Victor Chelaru Date: Wed, 31 Jan 2024 20:24:53 -0700 Subject: [PATCH] Fixed codegen for colors in states fixes #1342 --- .../ViewModels/StateCategoryViewModel.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/FRBDK/Glue/OfficialPlugins/StateDataPlugin/ViewModels/StateCategoryViewModel.cs b/FRBDK/Glue/OfficialPlugins/StateDataPlugin/ViewModels/StateCategoryViewModel.cs index 964ce9c5d..93530586c 100644 --- a/FRBDK/Glue/OfficialPlugins/StateDataPlugin/ViewModels/StateCategoryViewModel.cs +++ b/FRBDK/Glue/OfficialPlugins/StateDataPlugin/ViewModels/StateCategoryViewModel.cs @@ -322,10 +322,19 @@ private object Convert(object whatToConvert, CustomVariable variable) { var valueAsString = whatToConvert?.ToString(); - if(TypeManager.TryConvertStringValue(variable.Type, valueAsString, out object convertedValue)) + // If this is a color like "White", we want to keep that named color + if(variable.Type == "Color") { - return convertedValue; + // keep this as-is. } + else + { + if(TypeManager.TryConvertStringValue(variable.Type, valueAsString, out object convertedValue)) + { + return convertedValue; + } + } + return whatToConvert; } catch