mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Conditions - Fixed static input border margin
Databinding modifiers - Fixed default parameter values for value types not being set
This commit is contained in:
1 parent
0f5c2b80c4
commit
f2e21bfe37
5 files changed
+22
-10
No files matched your search
@@ -109,6 +109,14 @@ namespace Artemis.Core
|
||||
$"it does not support this data binding's type {targetType.Name}");
|
||||
|
||||
ModifierType = modifierType;
|
||||
|
||||
// Ensure the right parameter static value is never null when the parameter type is a value type
|
||||
if (ParameterType == ProfileRightSideType.Static && modifierType.ParameterType != null)
|
||||
{
|
||||
if (modifierType.ParameterType.IsValueType && ParameterStaticValue == null)
|
||||
UpdateParameterStatic(modifierType.ParameterType.GetDefault());
|
||||
}
|
||||
|
||||
ValidateParameter();
|
||||
}
|
||||
|
||||
@@ -200,7 +208,7 @@ namespace Artemis.Core
|
||||
ParameterPath = new DataModelPath(null, Entity.ParameterPath);
|
||||
}
|
||||
// Static parameter
|
||||
else if (ParameterType == ProfileRightSideType.Static && Entity.ParameterStaticValue != null && ParameterStaticValue == null)
|
||||
else if (ParameterType == ProfileRightSideType.Static && Entity.ParameterStaticValue != null)
|
||||
{
|
||||
// Use the target type so JSON.NET has a better idea what to do
|
||||
Type parameterType = ModifierType?.ParameterType ?? DirectDataBinding.DataBinding.GetTargetType();
|
||||
@@ -217,7 +225,14 @@ namespace Artemis.Core
|
||||
staticValue = Activator.CreateInstance(parameterType);
|
||||
}
|
||||
|
||||
UpdateParameterStatic(staticValue);
|
||||
try
|
||||
{
|
||||
UpdateParameterStatic(staticValue);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DeserializationLogger.LogModifierDeserializationFailure(GetType().Name, new JsonSerializationException("The JSON deserialized into a mismatching type", e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user