From 4fb4a2f07b5a0b09bb1a0d1556852b7735977147 Mon Sep 17 00:00:00 2001 From: Zach Vinless Date: Mon, 7 Nov 2016 14:21:31 -0800 Subject: [PATCH] Removed copy/cut/paste functionality for now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Removed copy/cut/paste functionality so that those commands can be implemented in a future PR -Removed unreferenced “DeleteBlock” function --- .../Fungus/Scripts/Editor/FlowchartWindow.cs | 74 +------------------ 1 file changed, 1 insertion(+), 73 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs index be03da99..5de4942c 100644 --- a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs +++ b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs @@ -39,8 +39,6 @@ namespace Fungus.EditorUtils protected Vector2 startSelectionBoxPosition = -Vector2.one; protected List mouseDownSelectionState = new List(); - protected List copyList = new List(); - // Context Click occurs on MouseDown which interferes with panning // Track right click positions manually to show menus on MouseUp protected Vector2 rightClickDown = -Vector2.one; @@ -67,7 +65,6 @@ namespace Fungus.EditorUtils nodeStyle.wordWrap = true; addTexture = Resources.Load("Icons/add_small") as Texture2D; - copyList.Clear(); } protected virtual void OnInspectorUpdate() @@ -511,8 +508,6 @@ namespace Fungus.EditorUtils // Use a copy because flowchart.SelectedBlocks gets modified var blockList = new List(flowchart.SelectedBlocks); - menu.AddItem(new GUIContent ("Copy"), false, () => Copy(flowchart)); - menu.AddItem(new GUIContent ("Cut"), false, () => Cut(flowchart)); menu.AddItem(new GUIContent ("Duplicate"), false, DuplicateBlocks, blockList); menu.AddItem(new GUIContent ("Delete"), false, DeleteBlocks, blockList); } @@ -520,17 +515,7 @@ namespace Fungus.EditorUtils else { DeselectAll(flowchart); - menu.AddItem(new GUIContent("Add Block"), false, () => CreateBlock(flowchart, mousePosition / flowchart.Zoom - flowchart.ScrollPos)); - - if (copyList.Count > 0) - { - menu.AddItem(new GUIContent("Paste"), false, () => Paste(flowchart, mousePosition)); - } - else - { - menu.AddDisabledItem(new GUIContent("Paste")); - } } var menuRect = new Rect(); @@ -792,18 +777,6 @@ namespace Fungus.EditorUtils return newBlock; } - protected virtual void DeleteBlock(Flowchart flowchart, Block block) - { - var commandList = block.CommandList; - foreach (var command in commandList) - { - Undo.DestroyObjectImmediate(command); - } - - Undo.DestroyObjectImmediate((Block)block); - flowchart.ClearSelectedCommands(); - } - protected virtual void DrawWindow(int windowId) { var block = windowBlockMap[windowId]; @@ -1172,48 +1145,18 @@ namespace Fungus.EditorUtils return Event.current.shift || EditorGUI.actionKey; } - protected virtual void Copy(Flowchart flowchart) - { - copyList.Clear(); - flowchart.SelectedBlocks.ForEach(block => copyList.Add(block)); - } - - protected virtual void Cut(Flowchart flowchart) - { - Copy(flowchart); - Undo.RecordObject(flowchart, "Cut"); - DeleteBlocks(flowchart.SelectedBlocks); - } - - // Center is position in unscaled window space - protected virtual void Paste(Flowchart flowchart, Vector2 center) - { - var copiedCenter = GetBlockCenter(flowchart, copyList.ToArray()) + flowchart.ScrollPos; - var delta = (center / flowchart.Zoom - copiedCenter); - - Undo.RecordObject(flowchart, "Paste"); - DuplicateBlocks(copyList, delta); - } - protected virtual void ValidateCommands(Flowchart flowchart) { if (Event.current.type == EventType.ValidateCommand) { var c = Event.current.commandName; - if (c == "Copy" || c == "Cut" || c == "Delete" || c == "Duplicate") + if (c == "Delete" || c == "Duplicate") { if (flowchart.SelectedBlocks.Count > 0) { Event.current.Use(); } } - else if (c == "Paste") - { - if (copyList.Count > 0) - { - Event.current.Use(); - } - } else if (c == "SelectAll") { Event.current.Use(); @@ -1227,21 +1170,6 @@ namespace Fungus.EditorUtils { switch (Event.current.commandName) { - case "Copy": - Copy(flowchart); - Event.current.Use(); - break; - - case "Cut": - Cut(flowchart); - Event.current.Use(); - break; - - case "Paste": - Paste(flowchart, position.center - position.position); - Event.current.Use(); - break; - case "Delete": DeleteBlocks(flowchart.SelectedBlocks); Event.current.Use();