Profiles - Fix brush properties being carried over from previous brush

This commit is contained in:
Robert committed 2022-07-30 21:55:28 +02:00
1 parent 3625d1ad11
commit eec2419005
5 files changed
+18 -8

No files matched your search

+1 -2
View File
@@ -793,8 +793,7 @@ namespace Artemis.Core
General.BrushReference.SetCurrentValue(layerBrush != null ? new LayerBrushReference(layerBrush.Descriptor) : null, null);
LayerBrush = layerBrush;
LayerEntity.LayerBrush = new LayerBrushEntity();
oldLayerBrush?.InternalDisable();
if (LayerBrush != null)
@@ -235,9 +235,20 @@ namespace Artemis.Core
if (_disposed)
throw new ObjectDisposedException("LayerProperty");
string json = CoreJson.SerializeObject(DefaultValue, true);
if (DefaultValue == null)
return;
KeyframesEnabled = false;
SetCurrentValue(CoreJson.DeserializeObject<T>(json)!, null);
// For value types there's no need to make a copy
if (DefaultValue.GetType().IsValueType)
SetCurrentValue(DefaultValue);
// Reference types make a deep clone (ab)using JSON
else
{
string json = CoreJson.SerializeObject(DefaultValue, true);
SetCurrentValue(CoreJson.DeserializeObject<T>(json)!);
}
}
internal void ReapplyUpdate()