fix: can't unset the default value for bool parameter (#1121)

This commit is contained in:
nekobako 2024-09-14 10:04:20 +09:00 committed by GitHub
parent 29177f2c5a
commit 38384a3c70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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_True = "ON";
private const string V_False = "OFF"; private const string V_False = "OFF";
@ -27,7 +28,7 @@ namespace nadena.dev.modular_avatar.core.editor
_hasExplicitDefaultSetField = new Toggle(); _hasExplicitDefaultSetField = new Toggle();
_boolField = new DropdownField(); _boolField = new DropdownField();
_boolField.choices.Add(""); _boolField.choices.Add(V_None);
_boolField.choices.Add(V_True); _boolField.choices.Add(V_True);
_boolField.choices.Add(V_False); _boolField.choices.Add(V_False);
@ -66,7 +67,7 @@ namespace nadena.dev.modular_avatar.core.editor
else else
_defaultValueField.value = 0; _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; string boolStr;
if (!hasExplicitValue) if (!hasExplicitValue)
boolStr = ""; boolStr = V_None;
else if (value > 0.5) else if (value > 0.5)
boolStr = V_True; boolStr = V_True;
else else