* Interaction Presets

This adds a new presets menu in the splash screen and the Input section of
User Preferences to choose a preset interaction style, consisting of key configurations
and also other user preferences such as select mouse button, view rotation style, etc.
Currently, just 'Blender' and 'Maya' presets are included, hopefully we can have more
presets contributed (and maintained!) by the community.

It's best to keep these presets minimal to avoid too many key conflicts. In the Maya one
I changed the view manipulation key/mouse combos and also the transform 
manipulator keys, not much more than that.

To save an interaction preset, open the user preferences Input section, and press the 
[ + ] button next to the presets menu. It will save out a .py file containing any edited key 
maps and navigation preferences to the presets/interaction folder in your scripts folder.

---

Part of this commit changes the way that key maps are exported/displayed in 
preferences - now partial key configs are allowed. Previously it would export/import the 
entire key configuration, regardless of whether individual key maps were edited or not 
(which would make them more susceptible to conflicts in unexpected areas).

(note, in blender terminology, a key map is a category of key items, such as 
'Object Mode' or 'View 2d'.)

Now, the export and the UI display work in a similar way to how key maps are 
processed internally - Locally edited key maps (after pressing the 'Edit' button) are 
processed first, falling back to other key maps in the current key config, and then falling 
back to the default key config. So it's possible for a key config to only include a few 
key maps, and the rest just gets pulled from the default key config. The preferences 
UI display works like this too behind the scenes in deciding what to show users, 
however using it is just like it was before, the complexity is hidden.
This commit is contained in:
2010-04-14 06:27:50 +00:00
parent 85590301a5
commit 486796ce31
15 changed files with 6526 additions and 7355 deletions

View File

@@ -1127,6 +1127,16 @@ static void wm_block_splash_close(bContext *C, void *arg_block, void *arg_unused
uiPupBlockClose(C, arg_block);
}
static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused);
/* XXX: hack to refresh splash screen with updated prest menu name,
* since popup blocks don't get regenerated like panels do */
void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused)
{
uiPupBlockClose(C, arg_block);
uiPupBlock(C, wm_block_create_splash, NULL);
}
static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
@@ -1135,7 +1145,9 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
uiStyle *style= U.uistyles.first;
struct RecentFile *recent;
int i;
Menu menu= {0};
MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE);
#ifdef NAN_BUILDINFO
int ver_width, rev_width;
char *version_str = NULL;
@@ -1156,21 +1168,28 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
#endif //NAN_BUILDINFO
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
but= uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, NULL, 0.0, 0.0, 0, 0, "");
uiButSetFunc(but, wm_block_splash_close, block, NULL);
uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL);
#ifdef NAN_BUILDINFO
uiDefBut(block, LABEL, 0, version_str, 500-ver_width, 282-24, ver_width, 20, NULL, 0, 0, 0, 0, NULL);
uiDefBut(block, LABEL, 0, revision_str, 500-rev_width, 282-36, rev_width, 20, NULL, 0, 0, 0, 0, NULL);
uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, 20, NULL, 0, 0, 0, 0, NULL);
uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, 20, NULL, 0, 0, 0, 0, NULL);
#endif //NAN_BUILDINFO
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style);
uiBlockSetEmboss(block, UI_EMBOSS);
/* show the splash menu (containing interaction presets), using python */
if (mt) {
menu.layout= layout;
menu.type= mt;
mt->draw(C, &menu);
}
uiBlockSetEmboss(block, UI_EMBOSSP);
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 10, 10, 480, 110, style);
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
split = uiLayoutSplit(layout, 0, 0);
@@ -1185,7 +1204,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
col = uiLayoutColumn(split, 0);
uiItemL(col, "Recent", 0);
for(recent = G.recent_files.first, i=0; (i<6) && (recent); recent = recent->next, i++) {
for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) {
char *display_name= BLI_last_slash(recent->filename);
if(display_name) display_name++; /* skip the slash */
else display_name= recent->filename;
@@ -1194,7 +1213,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
uiItemS(col);
uiItemO(col, NULL, ICON_HELP, "WM_OT_recover_last_session");
uiItemL(col, "", 0);
uiCenteredBoundsBlock(block, 0.0f);
uiEndBlock(C, block);