Merge branch 'customeditor_fixes' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-customeditor_fixes
This commit is contained in:
@@ -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;
|
result = obj;
|
||||||
return true;
|
return true;
|
||||||
@@ -676,20 +676,7 @@ namespace FlaxEditor.CustomEditors
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether can paste value from the system clipboard to the property value container.
|
/// Gets a value indicating whether can paste value from the system clipboard to the property value container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CanPaste
|
public bool CanPaste => !string.IsNullOrEmpty(Clipboard.Text);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return GetClipboardObject(out _, false);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the value from the system clipboard.
|
/// Sets the value from the system clipboard.
|
||||||
|
|||||||
@@ -474,32 +474,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
}
|
}
|
||||||
if (layout.Editors.Count != 0)
|
if (layout.Editors.Count != 0)
|
||||||
{
|
{
|
||||||
var sb = Clipboard.Text;
|
return !string.IsNullOrEmpty(Clipboard.Text);
|
||||||
if (!string.IsNullOrEmpty(sb))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var data = JsonSerializer.Deserialize<string[]>(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;
|
|
||||||
}
|
}
|
||||||
if (layout.Children.Any(x => x is LayoutElementsContainer))
|
if (layout.Children.Any(x => x is LayoutElementsContainer))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -190,15 +190,7 @@ namespace FlaxEditor.Surface
|
|||||||
if (data == null || data.Length < 2)
|
if (data == null || data.Length < 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
try
|
return true;
|
||||||
{
|
|
||||||
var model = JsonConvert.DeserializeObject<DataModel>(data);
|
|
||||||
return model?.Nodes != null && model.Nodes.Length != 0;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -215,7 +207,15 @@ namespace FlaxEditor.Surface
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Load Mr Json
|
// Load Mr Json
|
||||||
var model = FlaxEngine.Json.JsonSerializer.Deserialize<DataModel>(data);
|
DataModel model;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
model = FlaxEngine.Json.JsonSerializer.Deserialize<DataModel>(data);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (model.Nodes == null)
|
if (model.Nodes == null)
|
||||||
model.Nodes = new DataModelNode[0];
|
model.Nodes = new DataModelNode[0];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user