コード例 #1
0
        // CurveEditor uses an hardcoded shortcut to execute the FrameAll action, preventing the ShortcutManager from
        // ever picking it up. We have to hijack it to ensure our code is being run when framing inline curves.
        protected override bool KeyDown(Event evt, WindowState state)
        {
            var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve();

            if (inlineCurveEditor == null || !inlineCurveEditor.inlineCurvesSelected)
            {
                return(false);
            }

            // Not conflicting with the hardcoded value
            if (evt.keyCode != KeyCode.A)
            {
                return(false);
            }

            var combination = ShortcutManager.instance.GetShortcutBinding(Shortcuts.Timeline.frameAll)
                              .keyCombinationSequence.ToList();

            var shortcutCombination = combination.First();
            var currentCombination  = KeyCombination.FromKeyboardInput(evt);

            // User is not actually pressing the correct key combination for FrameAll
            if (combination.Count == 1 && shortcutCombination.Equals(currentCombination))
            {
                Action.InvokeWithSelected <FrameAllAction>();
            }

            return(true);
        }
コード例 #2
0
        protected override bool ExecuteCommand(Event evt, WindowState state)
        {
            if (state.IsCurrentEditingASequencerTextField())
            {
                return(false);
            }

            if (evt.commandName == EventCommandNames.SelectAll)
            {
                Action.InvokeWithSelected <SelectAllAction>();
                return(true);
            }

            if (evt.commandName == EventCommandNames.SoftDelete)
            {
                Action.InvokeWithSelected <DeleteAction>();
                return(true);
            }

            if (evt.commandName == EventCommandNames.FrameSelected)
            {
                Action.InvokeWithSelected <FrameSelectedAction>();
                return(true);
            }

            return(ActionManager.HandleShortcut(evt));
        }
コード例 #3
0
        protected override bool ExecuteCommand(Event evt, WindowState state)
        {
            if (state.IsCurrentEditingASequencerTextField())
            {
                return(false);
            }

            var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve();

            if (inlineCurveEditor == null || !inlineCurveEditor.inlineCurvesSelected)
            {
                return(false);
            }

            if (evt.commandName != EventCommandNames.FrameSelected)
            {
                return(false);
            }

            Action.InvokeWithSelected <FrameSelectedAction>();
            return(true);
        }