KeySwitcherGN
LScript version 2.3)
BRIEF KeySwitcherGN (KSGN) is a Layout Generic LScript that enables the user, not only to assign sequential commands to a single keystroke, but to bind many of those sequences into that keyboard shortcut. In brief, depending on a user-defined "mode" a keyboard shortcut would mean differently. Let's say you were in "Lighting Mode" - your SHIFT + C key could execute the LightColor command. If you switch over to "Animation Mode" that same SHIFT + C key could execute instead the EditCameras command.
INSTALLATION PART 1 Installing this 'switching system' is in two parts. 1.) From the zipped file, extract the KeySwitcherGN.ls and the Switcher folder and put it in your Generics LScript folder. You can, in fact, place this anywhere you want. Inside that Switcher folder is a file called Layout7_CS.txt. More on that at the next step. 2.) Install this LScript by adding it as a plug-in in Layout. Now while you are in Layout, execute a Save Command List (see your docs for details). Save it in the Switcher folder under the filename Layout7_CS.txt. While I provided my 'stock' Layout7_CS.txt, my custom scripts and plug-ins will not be the same as in your system and will refer to the wrong plug-in all the time. Layout7_CS.txt is what KSGN looks for to get its list of commands. KSGN will not continue without this text file. 3.) Decide on the modes you will be using. For example, I use "Mode_Standard", which refers to the default mode I would be using to navigate LightWave space. "Mode_Illumination" is for lighting, and "Mode_Action" is for animation. You can always introduce more modes as you go along, but it helps to have a couple to start with, to get the feel of the key assignments later on. I'd advise that you write the modes down. 4.) Decide on which keys that will remain 'universal.' In my system, for instance, keys 1-10 are mapped to my QuickSelect slots, and they are intended to be used regardless of what mode I am in. Again, I'd advise writing these keys down. This will make it easier for you to mark down what you will not assign in KSGN. 5.) Start assigning your shortcuts. This will be explained next, along with the interface.
INTERFACE When you start KSGN for the first time, you might get a requester asking you for the location of Layout7_CS.txt (see BUGS & LIMITATION section). Locate this file and KSGN will remember it in subsequent invocations. In your Modes Listbox, when you start a clean KSGN, you ought to see a Default_Mode set. There must always be one mode that exists, even if it's not being used. You can rename this mode by selecting the slot, typing in a new name and pressing the Re-name button. Furthermore, you can add and delete modes using the appropriate buttons. Note that there is a Confirm Delete checkbox. This is to avoid deleting modes inadvertedly. !!Important note!!: all actions executed in KSGN, like Delete Modes, Remove CS, etc. are always done deals. Changes are permanent. That's to say, also, that the OK and Cancel buttons you see below are meaningless. When you have created your modes you can start assigning your keys. 1.)
Select Default_Mode from the Modes Listbox(we'll use this one as an example). 2.)
Select the Space Key from the Key Slots Listbox. 3.)
Select the About CS Command from the Available CS list. 4.) Press the Assign CS button to assign. 5.) Create another mode. We'll call it Special_Mode. Type in Special_Mode in the Modes String Field and press the Add button. 6.) Click on the Special_Mode entry and make sure that the Current Modes Line reads: "Mode -> Special_Mode". 7.) You will notice that the About CS command you assigned earlier disappears. That's because you are no longer editing Default_Mode. 8.) Select the AboutOpenGL CS command and assign it. We pause again, to mention a couple of notes: Assign CS will take what ever is in the CS Command String Field. You can customize your command (command parameters can be seen in the CS list) directly in this String Field. Be aware that KSGN will allow you to input an invalid command, so be sure you know what you are doing when customizing any command. Due to a limitation in LScript's panels in relation to the way I programmed this, you wont see the Key Slots Listbox and the Modes Listbox being highlighted. Three status fields have been provided (e.g. Status Line, Current Mode Line, and Current Slot Line). Refer to these to verify your selection.
INSTALLATION PART 2 Navigate to the Switcher folder. Based on the key slots you assigned, you will see a corresponding LScript file of the same name. You will also notice that LScripts were created that correspond to your modes. 1.) Go over to Layout and open up the Add Plug-ins dialog.
5.) Run Default_Mode, and then run Space. The About command executes. 6.) Run Special_Mode, and then run Space again. The AboutOpenGL command, this time, is executed. I hope the example above makes it clear what's going on. In the next section, however, I will be explaining what really is going on.
HOW IT REALLY WORKS KSGN is really an LScript-maker. Based on the assignments you do, KSGN just writes out an LScript, whose filename is already mapped to a key in Layout. Any changes made to that LScript (through manual user revision, or through KSGN) will be reflected every time the script is run. KSGN also outputs LScripts to change the active mode whenever you create a new mode in the KSGN panel. Let's say SHIFT + A, whose pre-defined filename is SHIFT_a.ls, is assigned to two modes, Mode_Animate, Mode_Texture, each with a different CS command. Note that not only is SHIFT_a.ls created, but also a Mode_Animate.ls and a Mode_Texture.ls. These two LScripts are used to change the current mode. In SHIFT_a.ls, the commands are already housed within, but they are conditional: the script looks at current mode (in the registry) and decides whether or not any of its commands belong to that mode. In turn Mode_Texture.ls and/or Mode_Animate.ls writes to the system's registry its data, making it the current mode.
OTHER FEATURES Well on to the little tidbits. I found the Available CS Commands Listbox to be very long, so I added FIND CS. You can use only two types of search syntax, however, and you type your search string on the CS Command String Field. 1.) "SearchString*" - where an asterix is suffixing your search string. This denotes that you want to look for commands beginning with your string input.
I've also made available a REPLACE CS so that the user can easily rename a CS command from the Assigned Commands Listbox to anything in the CS Command String Field. Last minute additions: I included an OUTPUT TEMPLATE and LOAD TEMPLATE feature. These are for those who know what CS commands they want, those who are double-minded, or those who enjoy typing. The Output Template button will output a number of files according to the number of existing modes. They will be outputted as text files to the Switcher folder and will be suffixed by "_Template". Contained in those files are the available key slots printed on the left and a double greater-than symbol (">>") beside it. You can then type any CS command you want on the right side of the symbols (note: do not leave any space between the >> symbol and your CS command). Note that you can only type in one CS command, as the KSGN parser will not recognize more than one. You can still include parameters if you wish. To load that template file, press the Load Template button and load it. Note that it will update and/or create files only as necessary. If you did not assign CS commands to certain key slots, they will be ignored in the update/creation of the LScripts.
RECOMMENDATIONS When you have done a whole bunch of assignments within the panel, but have not yet completed everything, it would be wise to go to the Edit Plug-ins panel and do a Scan Directory of the Switcher folder (where all your outputted LScripts ought to be). The reason for this is that you want to confirm the validity of the LScripts that KSGN has been writing out. If there are any errors, you will see it here. Localize the LScripts that are buggy, erase them, and reassign that particular key slot(see BUGS & LIMITATIONS section). If all is going well, however, my other recommendation is to keep backing up the Switcher folder just in case something goes wrong. I would also recommend using the Template feature first, and then modify as necessary using the KSGN panel. I'd also have you know that I prefer putting KSGN into the Generics directory while the rest of the shortcuts the KSGN makes into the Switcher directory. There are 197 available keys, and if you use a good deal of them, it may clutter up your Generics directory.
BUGS & LIMITATIONS I've ironed out the bugs that had come my way and to date there are no known deficiencies. The only 'limitation' is explained in the next section. I have to admit, however, that the underlying procedure in outputting those LScripts is a little... clunky, procedurally speaking. I wont bet my life savings on a guarantee that it would run perfectly. If you send me any bug reports about KSGN outputting invalid LScript files, it would only be beneficial just as long as you can reproduce the bug; include a step by step walkthrough on what you did and what didnt work. On the other hand I've incubated KSGN for killing bugs for some time now. If a KSGN-generated LScript is indeed invalid, the best immediate thing to do is erase that LScript and output another one. But again, I did test it out rather extensively and it works out well for me (if it didnt, I wouldnt be releasing this). But do try not to abuse it. One last note: while I name the CS Commands text file as Layout7_CS.txt, it's only because I tested this in LightWave 7. The underlying structure is simple enough that it will most likely work with Lightwave 6.x. Just rename your LightWave 6.x command list to Layout7_CS.txt and everything will be fine.
MOD_IF_SWITCHER (I created a Modeler switcher system, too. It's called MOD_IF_Switcher (Modeler Interface Switcher) and is also available in the site you downloaded this from. Note: the Modeler switcher system has slightly more benefits due to the capabilities I was able to employ with regards to Modeler. It is smaller, runs more reliably and you can actually change menu settings during a modelling session (e.g. no need to shut Modeler down). Layout's dissimilar command architecture from Modeler prevented KSGN to function in the same capacity as MOD_IF_Switcher; KSGN cannot change menus and is limited only in switching hotkeys.)
APPENDANT (06.05.02) A very small improvement. When entering KSGN, the script will default the current mode for editing to the active mode you are in. It's more convenient. Contact me at: faulknermano1@yahoo.com
|