Exemple #1
0
        private void HandleEvents()
        {
            Event     current = Event.current;
            EventType type    = current.type;

            if (type != EventType.ValidateCommand)
            {
                if (type != EventType.ExecuteCommand)
                {
                    if (type == EventType.KeyDown)
                    {
                        if (current.keyCode == KeyCode.Delete)
                        {
                            this.DeleteSelection();
                            current.Use();
                        }
                    }
                }
                else
                {
                    if (current.commandName == "SoftDelete" || current.commandName == "Delete")
                    {
                        this.DeleteSelection();
                        current.Use();
                    }
                    if (current.commandName == "Copy")
                    {
                        this.CopySelectionToPasteboard();
                        current.Use();
                    }
                    else if (current.commandName == "Paste")
                    {
                        Unsupported.PasteToStateMachineFromPasteboard(this.activeStateMachine, this.tool.animatorController, this.tool.selectedLayerIndex, Vector3.zero);
                        current.Use();
                    }
                    else if (current.commandName == "Duplicate" && this.CopySelectionToPasteboard())
                    {
                        Vector3 zero = Vector3.zero;
                        if (this.selection.Count > 0)
                        {
                            zero.Set(this.selection[0].position.x, this.selection[0].position.y, 0f);
                        }
                        Unsupported.PasteToStateMachineFromPasteboard(this.activeStateMachine, this.tool.animatorController, this.tool.selectedLayerIndex, zero + new Vector3(40f, 40f, 0f));
                        current.Use();
                    }
                }
            }
            else if (current.commandName == "SoftDelete" || current.commandName == "Delete" || current.commandName == "Copy" || current.commandName == "Paste" || current.commandName == "Duplicate")
            {
                current.Use();
            }
        }
Exemple #2
0
 private void PasteCallback(object data)
 {
     Undo.RegisterCompleteObjectUndo(this.activeStateMachine, "Paste");
     Unsupported.PasteToStateMachineFromPasteboard(this.activeStateMachine, this.tool.animatorController, this.tool.selectedLayerIndex, (Vector2)data);
     AnimatorControllerTool.tool.RebuildGraph();
 }