Rolling Your Own Menu
For my own purposes, made a new sub-menu,
Builder Tool, which lives under the
Toolsmain menu. In it, I put lots of useful building tools and options that I took from various other menus. Now I can tear off one little menu, and have them close at hand while working! Yay!
I also added two new menu items, for options found in the Edit tool window: Stretch Both Sides and Stretch Textures! Because they are now menu entries instead of checkboxes in the Edit window, I can assign keyboard shortcut keys to toggle them! Double-Yay!
Rather than walk through every step of editing the XML, I'll just point out the important or new things. All the editing is done in menu_viewer.xml, the same file we editted to change the keyboard shortcuts before, but I also referred to floater_tools.xml, as described later in this post.
Creating a new menu is fairly easy: just make (or duplicate and modify) a <menu> block, being careful (of course) to close the block with a </menu> tag. Gathering items from other menus is a simple matter, just copy and pasting each desired <menu_item_*> block into the middle of your new menu block. From what I can tell, the positioning attributes (bottom, left, etc.) are ignored or overridden by SL, so you don't even have to worry about getting those numbers right.
Adding the two new menu items,
Stretch Both Sidesand
Stretch Textures, was not much harder. But in fact, it is only possible because of the particular way that those two options, along with the
Snap to Grid/Use Gridoption, were implemented; I suspect that they were all once menu items in the past, or were intended to be so.
Snap to Gridcurrently is a menu item in the Tools menu, and it was by examining the XML for the menu item and comparing it to the corresponding checkbox in the Edit window that I discovered that it was possible to do the same with the other two options.
The key is that all three of these options are manipulated by calling the ToggleControl function and passing the
control nameof the option. Both the menu and the checkbox refer to the SnapEnabled control name: in floater_tools.xml, the
Use Gridcheckbox has an attribute, control_name="SnapEnabled"; in menu_viewer.xml, the
Snap to Griditem has two lines which mention SnapEnabled, once in an <on_click> tag, and once in an <on_check> tag.
Making the two new menu items was just a matter of looking up their control names (ScaleUniform and ScaleStretchTextures) in floater_tools.xml, and plugging them into copies of the
Snap to Gridmenu item definition in both lines (be sure to change the text labels to be descriptive of their new functions).
Doing a quick grep of the XML files, there are a handful of other miscellanious options which have control_names. This suggests to me that menus could be built to change these too. Some notable example uses are: (un)muting audio; the Copy Selection tool; toggling chat bubbles; toggling avatar names above their heads.
It may also be possible to change other options which are not simple on/off switches. For example, it just might be possible to make a menu item which changes all the render detail settings and draw distance to the minimum, for dealing with crowded areas.
Unfortunately, this dependence on knowing the option's control name means that this method does not allow us to add an "Edit Linked Parts" menu item—the checkbox in the Edit window does not refer to any control name. I still hope that it can be added somehow, but for now it's up to the Lindens.
Happy building!



