Wings 3D Development Forum
Hotkey for multiples actions ? - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Interface & Usage (https://www.wings3d.com/forum/forumdisplay.php?fid=3)
+--- Thread: Hotkey for multiples actions ? (/showthread.php?tid=2969)



Hotkey for multiples actions ? - sciroccorics - 10-03-2020

Hi everybody,

Is there a possibility in Wings3D to define some hotkey (i.e. keyboard shorcuts) to perform combined actions instead of a single one ?

I guess that this would not be possible using the standard binding process (Ctlr+Insert), where the user has to select ONE single menu entry when creating a new hotkey. But if I take a look at the "preferences.txt" file in the user configuration folder, or even in the "wings3D.pref" file generated by using "File -> Save Preference Subset", both files seem to show pure Erlang instructions (it's only a guess, because I don't know the Erlang programming language, my programming skills only include Python and C).

In these files, I can see statements like:

Code:
{{bindkey,{115,[ctrl]}},{file,save},user}.

which means "bind Ctrl+S to the File->Save" action, if I am right. So, it may be possible to add TWO sequential actions for a single hotkey using a similar syntax. But as I don't know the Erlang syntax, it is not clear for me how to add 2 actions in sequence in the same binding instruction.

Here is an example for the kind of multiple actions, I would like to include:
Alt+V = Put in Vertex mode AND align camera to current selection

I've got dozens of such multiple actions that I always perform in sequence, so it would be really cool to bind these sequence to a single hotkey, even if it means manually tweaking a config file, that's not really a problem.

No doubt that Micheus, as an Erlang expert, could provide some hints about this request.


RE: Hotkey for multiples actions ? - micheus - 10-03-2020

Hi. Good to know you are a coder too. Maybe you can add a new language to your portfolio. ;-)

I think you are looking for something like a macro command record or script - something usual for other apps using Phyton.
Someone already asked for that in the past.

There's no way you try to play with the Prefs and group shortcuts.

I'm not sure that could be implemented by a plugin, so to be on the core it's something that [b[dgud[/b] needs to approve. He is the Erlang expert.

About hotkeys, avoid to overlap them with the main menu ones. You can "redefine" the same for the different selection modes (vertex, edge, face, body) - you may get a warning.

By now, you still will need to hit [V] followed by [A] to get the Alt + V action.


RE: Hotkey for multiples actions ? - sciroccorics - 10-03-2020

You're right, a full macro/scripting mechanism would be a great addition to Wings, but this would be a tremendous amount of work for a software with such a small team of developpers. And you are also right when suggesting that learning Erlang would be a nice goal for me Wink as I would be very proud if I could propose some plugins or extensions for this wonderful piece of software that I really like very much. But for the moment, no enough free time in my life, well, at least for 2 or 3 months. I hope that constraints will be lighter at work in a couple of months...

To come back to the hotkey request. Actually, the bindings that I set up in my Wings configuration, redefine more that 90% of the standard bindings. As I mainly use Wings on my laptop with the integrated touchpad, I use the "Maya" camera mode which is MUCH easier to use than the "Wings3D" or "Blender" mode when the middle mouse button is missing (actually, I've configured my touchpad to perform MMB actions when simultaneously pressing LMB+RMB, but that's still a painful operation to be employed for frequent operations). So all my bindings follow the "Maya philosophy" : pressing 'Alt' means that you want to move the camera, releasing 'Alt' means that you want to edit your model. So I redefined all camera related stuff to hotkeys prefixed with 'Alt', which lets plenty of single keys (R,X,Y,Z,A....) to be reused for more common operations. At the end, this provides a very productive workflow, even when controlled by a good-old touchpad without multi-touch features. But of course, that's my way of thinking, I don't urge anybody to take my opinion as the ultimate one.

I agree with you that multiple actions can always be obtained by combining sequential keystrokes (that is what I'm using currently) but being able to simply chain two operations in the configuration file (I don't really need a full macro scripting solution) would offer such a great improvement in the way I use Wings3D. As I said previously, hacking the "preferences.txt" config file doesn't frighten me : to include all my new bindings, I simply added lines in that file with a text editor, instead of adding them one by one with the user interface.

When looking at the syntax of the key binding lines, you have a common pattern:

{{bindkey,{"keycode",["keymods"]}},{"menuname","menuentry"},user}.

where all quoted words are replaced by the corresponding value for each binding. I've tried to create a chain of 2 actions by hacking the file using the following syntax:

{{bindkey,{"keycode",["keymods"]}},{{"menuname1","menuentry1"},{"menuname2","menuentry2"}},user}.

but it does not work... Sad Maybe it's the "user" keyword that is not longer at the correct position (I don't know what the "user" keyword means in that context), or maybe it's just that the parser can only handle one menu entry. That's why I called for some hints on the forum...


RE: Hotkey for multiples actions ? - micheus - 10-03-2020

Quote:I've tried to create a chain of 2 actions by hacking the file using the following syntax:
Yeah, it doesn't work that way.
This is how we should look at it:
Quote:{ {bindkey,{"keycode",["keymods"]}}, {"menuname","menuentry"}, user }
a set of three elements: the hotkey, the menu command and the source.
The source can be default, user and plugin.

In case you didn't noticed, by using the Preferences sub set you can create multiples setups for hotkey and windows layouts. it can be useful sometimes.

Also, don't forget of Tweak mode. Move, Slide and Move normal are very easy to use with it enabled. Sometimes I forget of it too. Smile


RE: Hotkey for multiples actions ? - sciroccorics - 10-03-2020

Quote:a set of three elements: the hotkey, the menu command and the source.

Yes, that's why a inserted an extra pair of curly braces around the 2 menu commands, trying to fool the parser by creating a single group. But no luck with that hack Sad

No problemo by the way, I will stick on my double keystrokes for the moment... until I learn Erlang enough to modify the source code of the config file parser Wink