From 38384a3c701d9e086df92b40eb052d839bc787dc Mon Sep 17 00:00:00 2001 From: nekobako Date: Sat, 14 Sep 2024 10:04:20 +0900 Subject: [PATCH] fix: can't unset the default value for bool parameter (#1121) --- Editor/Inspector/Parameters/DefaultValueField.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Editor/Inspector/Parameters/DefaultValueField.cs b/Editor/Inspector/Parameters/DefaultValueField.cs index 6cae5283..d044a9b1 100644 --- a/Editor/Inspector/Parameters/DefaultValueField.cs +++ b/Editor/Inspector/Parameters/DefaultValueField.cs @@ -12,6 +12,7 @@ namespace nadena.dev.modular_avatar.core.editor { } + private const string V_None = " "; private const string V_True = "ON"; private const string V_False = "OFF"; @@ -27,7 +28,7 @@ namespace nadena.dev.modular_avatar.core.editor _hasExplicitDefaultSetField = new Toggle(); _boolField = new DropdownField(); - _boolField.choices.Add(""); + _boolField.choices.Add(V_None); _boolField.choices.Add(V_True); _boolField.choices.Add(V_False); @@ -66,7 +67,7 @@ namespace nadena.dev.modular_avatar.core.editor else _defaultValueField.value = 0; - _hasExplicitDefaultSetField.value = evt.newValue != ""; + _hasExplicitDefaultSetField.value = evt.newValue != V_None; }); @@ -96,7 +97,7 @@ namespace nadena.dev.modular_avatar.core.editor string boolStr; if (!hasExplicitValue) - boolStr = ""; + boolStr = V_None; else if (value > 0.5) boolStr = V_True; else