Revision: 37416
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37416
Author: kupoman
Date: 2011-06-11 19:10:55 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Making the exit key UI element accept key presses instead of numbers. It still
does not work for the Blenderplayer, and it does not limit the input to key
presses (other events don't work for exiting)
Modified Paths:
--------------
branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py
branches/soc-2011-cucumber/source/blender/blenloader/intern/readfile.c
branches/soc-2011-cucumber/source/blender/makesrna/intern/rna_scene.c
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
Modified:
branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py
===================================================================
--- branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py
2011-06-11 18:30:39 UTC (rev 37415)
+++ branches/soc-2011-cucumber/release/scripts/startup/bl_ui/properties_game.py
2011-06-11 19:10:55 UTC (rev 37416)
@@ -382,7 +382,8 @@
row.prop(gs, "use_display_lists")
row = layout.row()
- row.prop(gs, "exitkey")
+ row.label("Exit Key")
+ row.prop(gs, "exit_key", text="", event=True)
class RENDER_PT_game_display(RenderButtonsPanel, bpy.types.Panel):
Modified: branches/soc-2011-cucumber/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-cucumber/source/blender/blenloader/intern/readfile.c
2011-06-11 18:30:39 UTC (rev 37415)
+++ branches/soc-2011-cucumber/source/blender/blenloader/intern/readfile.c
2011-06-11 19:10:55 UTC (rev 37416)
@@ -11662,7 +11662,7 @@
/* Initialize BGE exit key to esc key */
Scene *scene;
for(scene= main->scene.first; scene; scene=
scene->id.next) {
- scene->gm.exitkey = 130;
+ scene->gm.exitkey = 218;
}
}
}
Modified: branches/soc-2011-cucumber/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2011-cucumber/source/blender/makesrna/intern/rna_scene.c
2011-06-11 18:30:39 UTC (rev 37415)
+++ branches/soc-2011-cucumber/source/blender/makesrna/intern/rna_scene.c
2011-06-11 19:10:55 UTC (rev 37416)
@@ -974,6 +974,14 @@
G.fileflags &= ~G_FILE_AUTOPLAY;
}
+static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
+{
+ Scene *scene = (Scene*)ptr->data;
+
+ //printf("%d\n", scene->gm.exitkey);
+ if(ISKEYBOARD(value))
+ scene->gm.exitkey=value;
+}
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
{
@@ -1701,6 +1709,13 @@
RNA_def_property_range(prop, 0, 198);
RNA_def_property_ui_text(prop, "Exit Key", "The key used to exit the
game engine");
RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "exitkey");
+ RNA_def_property_enum_items(prop, event_type_items);
+ //RNA_def_property_enum_funcs(prop, NULL,
"rna_GameSettings_exit_key_set", NULL);
+ RNA_def_property_ui_text(prop, "Exit Key", "Sets the key that exits
the Game Engine");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
// Do we need it here ? (since we already have it in World
prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
Modified:
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
===================================================================
---
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
2011-06-11 18:30:39 UTC (rev 37415)
+++
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
2011-06-11 19:10:55 UTC (rev 37416)
@@ -211,7 +211,7 @@
// create the inputdevices
KX_BlenderKeyboardDevice* keyboarddevice = new
KX_BlenderKeyboardDevice();
- keyboarddevice->SetExitKey((startscene->gm.exitkey) ?
startscene->gm.exitkey : 130);
+ keyboarddevice->SetExitKey(startscene->gm.exitkey);
KX_BlenderMouseDevice* mousedevice = new
KX_BlenderMouseDevice();
Modified:
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
===================================================================
---
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
2011-06-11 18:30:39 UTC (rev 37415)
+++
branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
2011-06-11 19:10:55 UTC (rev 37416)
@@ -171,5 +171,5 @@
void KX_BlenderKeyboardDevice::SetExitKey(short key)
{
- m_exit_key = key;
+ m_exit_key = ToNative(key);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs