diff --git a/Source/Editor/CustomEditors/CustomEditor.cs b/Source/Editor/CustomEditors/CustomEditor.cs index 54cea319f..2bc9aaac8 100644 --- a/Source/Editor/CustomEditors/CustomEditor.cs +++ b/Source/Editor/CustomEditors/CustomEditor.cs @@ -664,7 +664,7 @@ namespace FlaxEditor.CustomEditors } } - if (obj == null || Values.Type.IsInstanceOfType(obj)) + if ((obj == null && !Values.Type.IsValueType) || Values.Type.IsInstanceOfType(obj)) { result = obj; return true; @@ -676,20 +676,7 @@ namespace FlaxEditor.CustomEditors /// /// Gets a value indicating whether can paste value from the system clipboard to the property value container. /// - public bool CanPaste - { - get - { - try - { - return GetClipboardObject(out _, false); - } - catch - { - return false; - } - } - } + public bool CanPaste => !string.IsNullOrEmpty(Clipboard.Text); /// /// Sets the value from the system clipboard. diff --git a/Source/Editor/CustomEditors/Editors/GenericEditor.cs b/Source/Editor/CustomEditors/Editors/GenericEditor.cs index ec75926d9..f624600b4 100644 --- a/Source/Editor/CustomEditors/Editors/GenericEditor.cs +++ b/Source/Editor/CustomEditors/Editors/GenericEditor.cs @@ -474,32 +474,7 @@ namespace FlaxEditor.CustomEditors.Editors } if (layout.Editors.Count != 0) { - var sb = Clipboard.Text; - if (!string.IsNullOrEmpty(sb)) - { - try - { - var data = JsonSerializer.Deserialize(sb); - if (data == null || data.Length != layout.Editors.Count) - return false; - for (var i = 0; i < layout.Editors.Count; i++) - { - Clipboard.Text = data[i]; - if (!layout.Editors[i].CanPaste) - return false; - } - return true; - } - catch - { - return false; - } - finally - { - Clipboard.Text = sb; - } - } - return false; + return !string.IsNullOrEmpty(Clipboard.Text); } if (layout.Children.Any(x => x is LayoutElementsContainer)) { diff --git a/Source/Editor/Surface/VisjectSurface.CopyPaste.cs b/Source/Editor/Surface/VisjectSurface.CopyPaste.cs index 158492460..94d41a624 100644 --- a/Source/Editor/Surface/VisjectSurface.CopyPaste.cs +++ b/Source/Editor/Surface/VisjectSurface.CopyPaste.cs @@ -190,15 +190,7 @@ namespace FlaxEditor.Surface if (data == null || data.Length < 2) return false; - try - { - var model = JsonConvert.DeserializeObject(data); - return model?.Nodes != null && model.Nodes.Length != 0; - } - catch (Exception) - { - return false; - } + return true; } /// @@ -215,7 +207,15 @@ namespace FlaxEditor.Surface try { // Load Mr Json - var model = FlaxEngine.Json.JsonSerializer.Deserialize(data); + DataModel model; + try + { + model = FlaxEngine.Json.JsonSerializer.Deserialize(data); + } + catch + { + return; + } if (model.Nodes == null) model.Nodes = new DataModelNode[0];