2.5: Emulate numpad works again.

This commit is contained in:
Brecht Van Lommel 2009-11-22 16:33:47 +00:00
parent 43e7950092
commit 1295a213a4
3 changed files with 31 additions and 6 deletions

@ -275,7 +275,6 @@ class USERPREF_PT_system(bpy.types.Panel):
sub1.itemR(system, "dpi")
sub1.itemR(system, "frame_server_port")
sub1.itemR(system, "scrollback", text="Console Scrollback")
sub1.itemR(system, "emulate_numpad")
sub1.itemR(system, "auto_run_python_scripts")
sub1.itemS()
@ -1129,7 +1128,9 @@ class USERPREF_PT_input(bpy.types.Panel):
sub.row().itemR(inputs, "middle_mouse", expand=True)
sub.itemS()
sub.itemS()
sub.itemR(inputs, "emulate_numpad")
sub.itemS()
sub.itemL(text="Orbit Style:")

@ -2160,10 +2160,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DONT_DOSCRIPTLINKS);
RNA_def_property_ui_text(prop, "Auto Run Python Scripts", "Allow any .blend file to run scripts automatically (unsafe with blend files from an untrusted source).");
prop= RNA_def_property(srna, "emulate_numpad", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD);
RNA_def_property_ui_text(prop, "Emulate Numpad", "Causes the 1 to 0 keys to act as the numpad (useful for laptops).");
prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "prefetchframes");
RNA_def_property_range(prop, 0, 500);
@ -2326,6 +2322,10 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE);
RNA_def_property_boolean_funcs(prop, NULL, "rna_userdef_emulate_set");
RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse", "Emulates Middle Mouse with Alt+LeftMouse (doesnt work with Left Mouse Select option.)");
prop= RNA_def_property(srna, "emulate_numpad", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD);
RNA_def_property_ui_text(prop, "Emulate Numpad", "Causes the 1 to 0 keys to act as the numpad (useful for laptops).");
}
static void rna_def_userdef_filepaths(BlenderRNA *brna)

@ -774,6 +774,30 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
return 1;
}
}
/* exception for numpad emulation */
else if(U.flag & USER_NONUMPAD) {
wmKeyMapItem tmp= *kmi;
switch(kmi->type) {
case PAD0: tmp.type = ZEROKEY; break;
case PAD1: tmp.type = ONEKEY; break;
case PAD2: tmp.type = TWOKEY; break;
case PAD3: tmp.type = THREEKEY; break;
case PAD4: tmp.type = FOURKEY; break;
case PAD5: tmp.type = FIVEKEY; break;
case PAD6: tmp.type = SIXKEY; break;
case PAD7: tmp.type = SEVENKEY; break;
case PAD8: tmp.type = EIGHTKEY; break;
case PAD9: tmp.type = NINEKEY; break;
case PADMINUS: tmp.type = MINUSKEY; break;
case PADPLUSKEY: tmp.type = EQUALKEY; break;
case PADSLASHKEY: tmp.type = BACKSLASHKEY; break;
}
if(tmp.type != kmi->type)
if(wm_eventmatch(winevent, &tmp))
return 1;
}
/* the matching rules */
if(kmitype==KM_TEXTINPUT)