Instant Mode Test Project

Yes, indeed, I must have mixed up several things.

The general idea is not mine; six years ago, I tried to implement this library:

It gave me a headache too, I never managed to get it working, too complicated for me.

Today, I simplified it as much as possible, and it works as I described above.
If it can help give you some ideas, here is how I did it.

        OnKeyDown
            Add to the snapshot all the pressed keys:
            if (_mode == INSTANT_MODE && _IsInstantKey (key))
                _snapshots.AddKey (key);
            
        OnKeyUp
            Memorize the pressed key combination and move to the next combination:
            if (_mode == INSTANT_MODE && _IsInstantKey (key))
                _snapshots.NextCombination ();

                After a delay, execute the key sequences.
                _debouncer.Debounce (_HandleSnapshots);

And here, the stupid class that does almost everything.

    readonly SnapshotRecorder _snapshots = new ();

    class SnapshotRecorder
    {
        byte _seq = 0;
        readonly byte[] _count = new byte[5];
        readonly Keys[][] _combinations = new Keys[5][];

        public SnapshotRecorder ()
        {
            for (var i = 0 ; i < 5 ; i++ ) {
                _combinations[i] = new Keys[5];
                for (var j = 0 ; j < 5 ; j++ )
                    _combinations[i][j] = Keys.None;
            }
        }

        /// Move to the next combination only if the current combination has pressed keys.
        public void NextCombination ()
        {
            if (_count[_seq] > 0 && _seq < 4)
                _seq++;
        }

        /// Add a pressed key to the current combination.
        public void AddKey (Keys key)
        {
            if (_count[_seq] < 4) {
                _combinations[_seq][_count[_seq]++] = key;
            }
        }

        /// Reset all combinations.
        public void Clear ()
        {
            for (var i = 0 ; i <= _seq ; i++ )
            {
                for (var j = 0 ; j <= _count[i] ; j++ )
                    _combinations[i][j] = Keys.None;
                _count[i] = 0;
            }
            _seq = 0;
        }
    }

It might be a bit pretentious to imagine that this piece of code could be useful,
but compared to Globalmousekeyhook, the simplicity of this code for similar results surprised me.

Hello,

I’ve been refining my experiment with a pseudo-functional plugin. I’ve implemented the logic to always keep Rhino in instant mode and to write command lines by pressing the spacebar. I find it quite confusing, but I guess it’s just a matter of getting used to it. GitHub - corbane/InstantMode

I have very little time to devote to it, so any contribution is welcome. While waiting for Rhino 9, this plugin has the advantage of working with version 7 and probably versions 6 and 8 as well.

jmv

1 Like

I just installed it, but how to get access to the key commands and customize them?

OK, I found the way. Run the ShowInstantModeOptions command, then a pop-up window appears. From there, click on the “Import” button and browse to the directory where the plug-in was saved. Then import the file named “Alias.xml”.

Any idea how to change Num5 to switch to the default Perspective view?

yes, sorry I didn’t really document it, but there is a video in the “doc” folder
https://github.com/corbane/InstantMode/raw/main/doc/InstantMode-v0.2.mp4

Also, there is a bug that I haven’t found yet.
Logically all commands can be modified by double-clicking on them.
But in some cases you will have to close the options window and reopen it.
(I show it in the video).

Also note that only alpha-numeric keys are accepted.
jmv

1 Like

I ended up removing the plug-in, because it causes interference with my 3d mouse and the custom commands assigned to its multiple customizable keys. They use command line commands, so basically the plug-in stopped all of them, unless I press the Spacebar to activate them again.

An ideal solution would be to implement the instant aliases as 300 ms single-tap commands up to 2 letters long that will not require pressing of Enter for confirmation, whereas typing 3 or more characters during the initial 300 ms would be interpret as a native Rhino command. This means that the Command line dropdown list with suggested commands could be displayed with a 300 ms delay.

I hadn’t thought about that.

if I understood correctly this is what Steve does with version 9

after doing this test, i realize that i use the right mouse button as much as the enter key or the space bar. it has become a reflex I found that not having the space bar is painful. it forces you to relearn Rhino. which is strange because on other software this does not pose any problem for me.

I guess this is what we call a muscle memory? :smiley:

1 Like