mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Pressing CTRL+D (duplicate) threw editorgui exception "Getting control 0s position in a group with only 3 controls when doing ValidateCommand".
comparing to https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/SceneHierarchyWindow.cs : row 211, the proper use of the event was not made. also fixed spelling of Dublicate to Duplicate.
This commit is contained in:
parent
e2549808cc
commit
d405b97278
@ -278,9 +278,21 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.ValidateCommand:
|
case EventType.ValidateCommand:
|
||||||
if (e.commandName == "SoftDelete") RemoveSelectedNodes();
|
case EventType.ExecuteCommand:
|
||||||
else if (SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX && e.commandName == "Delete") RemoveSelectedNodes();
|
if (e.commandName == "SoftDelete") {
|
||||||
else if (e.commandName == "Duplicate") DublicateSelectedNodes();
|
if (e.type == EventType.ExecuteCommand) RemoveSelectedNodes();
|
||||||
|
e.Use();
|
||||||
|
}
|
||||||
|
else if (SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX && e.commandName == "Delete")
|
||||||
|
{
|
||||||
|
if (e.type == EventType.ExecuteCommand) RemoveSelectedNodes();
|
||||||
|
e.Use();
|
||||||
|
}
|
||||||
|
else if (e.commandName == "Duplicate")
|
||||||
|
{
|
||||||
|
if (e.type == EventType.ExecuteCommand) DuplicateSelectedNodes();
|
||||||
|
e.Use();
|
||||||
|
}
|
||||||
Repaint();
|
Repaint();
|
||||||
break;
|
break;
|
||||||
case EventType.Ignore:
|
case EventType.Ignore:
|
||||||
@ -357,8 +369,8 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Dublicate selected nodes and select the dublicates </summary>
|
/// <summary> Aligns selected nodes to either left/right/top/bottom edge of nodes </summary>
|
||||||
public void DublicateSelectedNodes() {
|
public void DuplicateSelectedNodes() {
|
||||||
UnityEngine.Object[] newNodes = new UnityEngine.Object[Selection.objects.Length];
|
UnityEngine.Object[] newNodes = new UnityEngine.Object[Selection.objects.Length];
|
||||||
Dictionary<XNode.Node, XNode.Node> substitutes = new Dictionary<XNode.Node, XNode.Node>();
|
Dictionary<XNode.Node, XNode.Node> substitutes = new Dictionary<XNode.Node, XNode.Node>();
|
||||||
for (int i = 0; i < Selection.objects.Length; i++) {
|
for (int i = 0; i < Selection.objects.Length; i++) {
|
||||||
|
|||||||
@ -126,7 +126,7 @@ namespace XNodeEditor {
|
|||||||
contextMenu.AddItem(new GUIContent("Rename"), false, RenameSelectedNode);
|
contextMenu.AddItem(new GUIContent("Rename"), false, RenameSelectedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMenu.AddItem(new GUIContent("Duplicate"), false, DublicateSelectedNodes);
|
contextMenu.AddItem(new GUIContent("Duplicate"), false, DuplicateSelectedNodes);
|
||||||
contextMenu.AddItem(new GUIContent("Remove"), false, RemoveSelectedNodes);
|
contextMenu.AddItem(new GUIContent("Remove"), false, RemoveSelectedNodes);
|
||||||
|
|
||||||
// If only one node is selected
|
// If only one node is selected
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user