Fix copy/paste for UI brushes

This commit is contained in:
Wojtek Figat
2024-02-14 12:17:02 +01:00
parent 6548ca1148
commit 31437e6dde

View File

@@ -543,10 +543,11 @@ namespace FlaxEditor.CustomEditors
try
{
string text;
var value = Values[0];
if (ParentEditor is Dedicated.ScriptsEditor)
{
// Script
text = JsonSerializer.Serialize(Values[0]);
text = JsonSerializer.Serialize(value);
// Remove properties that should be ignored when copy/pasting data
if (text == null)
@@ -576,12 +577,12 @@ namespace FlaxEditor.CustomEditors
else if (ScriptType.FlaxObject.IsAssignableFrom(Values.Type))
{
// Object reference
text = JsonSerializer.GetStringID(Values[0] as FlaxEngine.Object);
text = JsonSerializer.GetStringID(value as FlaxEngine.Object);
}
else
{
// Default
text = JsonSerializer.Serialize(Values[0]);
text = JsonSerializer.Serialize(value, TypeUtils.GetType(Values.Type));
}
Clipboard.Text = text;
}