[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37497] branches/soc-2011-cucumber: Some more work on getting the exit key to work in the Blenderplayer.
Daniel Stokes
kupomail at gmail.com
Wed Jun 15 06:46:56 CEST 2011
Revision: 37497
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37497
Author: kupoman
Date: 2011-06-15 04:46:56 +0000 (Wed, 15 Jun 2011)
Log Message:
-----------
Some more work on getting the exit key to work in the Blenderplayer.
Input is now restricted to keyboard events only for the exit key UI.
Modified Paths:
--------------
branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.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/KX_BlenderKeyboardDevice.cpp
branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp
branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.h
branches/soc-2011-cucumber/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
branches/soc-2011-cucumber/source/gameengine/GamePlayer/ghost/GPG_Application.h
Modified: branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.py
===================================================================
--- branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.py 2011-06-15 03:24:02 UTC (rev 37496)
+++ branches/soc-2011-cucumber/release/scripts/startup/bl_operators/wm.py 2011-06-15 04:46:56 UTC (rev 37497)
@@ -971,8 +971,6 @@
player_path = os.path.join(blender_bin_dir, 'blenderplayer' + ext)
def execute(self, context):
- print("Launching Blenderplayer!")
- print("Blend file: %s" % bpy.app.tempdir + "game.blend")
filepath = bpy.app.tempdir + "game.blend"
bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
subprocess.call([self.player_path, filepath])
Modified: branches/soc-2011-cucumber/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-cucumber/source/blender/blenloader/intern/readfile.c 2011-06-15 03:24:02 UTC (rev 37496)
+++ branches/soc-2011-cucumber/source/blender/blenloader/intern/readfile.c 2011-06-15 04:46:56 UTC (rev 37497)
@@ -11662,7 +11662,9 @@
/* Initialize BGE exit key to esc key */
Scene *scene;
for(scene= main->scene.first; scene; scene= scene->id.next) {
- scene->gm.exitkey = 218;
+ printf("Do version: %d\n", scene->gm.exitkey);
+ if (!scene->gm.exitkey)
+ 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-15 03:24:02 UTC (rev 37496)
+++ branches/soc-2011-cucumber/source/blender/makesrna/intern/rna_scene.c 2011-06-15 04:46:56 UTC (rev 37497)
@@ -976,11 +976,10 @@
static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
{
- Scene *scene = (Scene*)ptr->data;
-
- //printf("%d\n", scene->gm.exitkey);
+ GameData *gm = (GameData*)ptr->data;
+
if(ISKEYBOARD(value))
- scene->gm.exitkey=value;
+ gm->exitkey=value;
}
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
@@ -1704,16 +1703,16 @@
RNA_def_property_ui_text(prop, "Bits", "Displays bit depth of full screen display");
RNA_def_property_update(prop, NC_SCENE, NULL);
- prop= RNA_def_property(srna, "exitkey", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "exitkey");
- 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, "exitkey", PROP_INT, PROP_UNSIGNED);
+ //RNA_def_property_int_sdna(prop, NULL, "exitkey");
+ //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_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);
Modified: branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
===================================================================
--- branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp 2011-06-15 03:24:02 UTC (rev 37496)
+++ branches/soc-2011-cucumber/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp 2011-06-15 04:46:56 UTC (rev 37497)
@@ -41,7 +41,7 @@
KX_BlenderKeyboardDevice::KX_BlenderKeyboardDevice()
: m_hookesc(false)
{
- m_exit_key = 130;
+
}
KX_BlenderKeyboardDevice::~KX_BlenderKeyboardDevice()
{
Modified: branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2011-06-15 03:24:02 UTC (rev 37496)
+++ branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2011-06-15 04:46:56 UTC (rev 37497)
@@ -194,6 +194,180 @@
static int default_face_mode = TF_DYNAMIC;
+static std::map<int, SCA_IInputDevice::KX_EnumInputs> create_translate_table()
+{
+ std::map<int, SCA_IInputDevice::KX_EnumInputs> m;
+
+ /* The reverse table. In order to not confuse ourselves, we */
+ /* immediately convert all events that come in to KX codes. */
+ m[LEFTMOUSE ] = SCA_IInputDevice::KX_LEFTMOUSE;
+ m[MIDDLEMOUSE ] = SCA_IInputDevice::KX_MIDDLEMOUSE;
+ m[RIGHTMOUSE ] = SCA_IInputDevice::KX_RIGHTMOUSE;
+ m[WHEELUPMOUSE ] = SCA_IInputDevice::KX_WHEELUPMOUSE;
+ m[WHEELDOWNMOUSE ] = SCA_IInputDevice::KX_WHEELDOWNMOUSE;
+ m[MOUSEX ] = SCA_IInputDevice::KX_MOUSEX;
+ m[MOUSEY ] = SCA_IInputDevice::KX_MOUSEY;
+
+ // TIMERS
+
+ m[TIMER0 ] = SCA_IInputDevice::KX_TIMER0;
+ m[TIMER1 ] = SCA_IInputDevice::KX_TIMER1;
+ m[TIMER2 ] = SCA_IInputDevice::KX_TIMER2;
+
+ // SYSTEM
+
+#if 0
+ /* **** XXX **** */
+ m[KEYBD ] = SCA_IInputDevice::KX_KEYBD;
+ m[RAWKEYBD ] = SCA_IInputDevice::KX_RAWKEYBD;
+ m[REDRAW ] = SCA_IInputDevice::KX_REDRAW;
+ m[INPUTCHANGE ] = SCA_IInputDevice::KX_INPUTCHANGE;
+ m[QFULL ] = SCA_IInputDevice::KX_QFULL;
+ m[WINFREEZE ] = SCA_IInputDevice::KX_WINFREEZE;
+ m[WINTHAW ] = SCA_IInputDevice::KX_WINTHAW;
+ m[WINCLOSE ] = SCA_IInputDevice::KX_WINCLOSE;
+ m[WINQUIT ] = SCA_IInputDevice::KX_WINQUIT;
+ m[Q_FIRSTTIME ] = SCA_IInputDevice::KX_Q_FIRSTTIME;
+ /* **** XXX **** */
+#endif
+
+ // standard keyboard
+
+ m[AKEY ] = SCA_IInputDevice::KX_AKEY;
+ m[BKEY ] = SCA_IInputDevice::KX_BKEY;
+ m[CKEY ] = SCA_IInputDevice::KX_CKEY;
+ m[DKEY ] = SCA_IInputDevice::KX_DKEY;
+ m[EKEY ] = SCA_IInputDevice::KX_EKEY;
+ m[FKEY ] = SCA_IInputDevice::KX_FKEY;
+ m[GKEY ] = SCA_IInputDevice::KX_GKEY;
+
+//XXX clean up
+#ifdef WIN32
+#define HKEY 'h'
+#endif
+ m[HKEY ] = SCA_IInputDevice::KX_HKEY;
+//XXX clean up
+#ifdef WIN32
+#undef HKEY
+#endif
+
+ m[IKEY ] = SCA_IInputDevice::KX_IKEY;
+ m[JKEY ] = SCA_IInputDevice::KX_JKEY;
+ m[KKEY ] = SCA_IInputDevice::KX_KKEY;
+ m[LKEY ] = SCA_IInputDevice::KX_LKEY;
+ m[MKEY ] = SCA_IInputDevice::KX_MKEY;
+ m[NKEY ] = SCA_IInputDevice::KX_NKEY;
+ m[OKEY ] = SCA_IInputDevice::KX_OKEY;
+ m[PKEY ] = SCA_IInputDevice::KX_PKEY;
+ m[QKEY ] = SCA_IInputDevice::KX_QKEY;
+ m[RKEY ] = SCA_IInputDevice::KX_RKEY;
+ m[SKEY ] = SCA_IInputDevice::KX_SKEY;
+ m[TKEY ] = SCA_IInputDevice::KX_TKEY;
+ m[UKEY ] = SCA_IInputDevice::KX_UKEY;
+ m[VKEY ] = SCA_IInputDevice::KX_VKEY;
+ m[WKEY ] = SCA_IInputDevice::KX_WKEY;
+ m[XKEY ] = SCA_IInputDevice::KX_XKEY;
+ m[YKEY ] = SCA_IInputDevice::KX_YKEY;
+ m[ZKEY ] = SCA_IInputDevice::KX_ZKEY;
+
+ m[ZEROKEY ] = SCA_IInputDevice::KX_ZEROKEY;
+ m[ONEKEY ] = SCA_IInputDevice::KX_ONEKEY;
+ m[TWOKEY ] = SCA_IInputDevice::KX_TWOKEY;
+ m[THREEKEY ] = SCA_IInputDevice::KX_THREEKEY;
+ m[FOURKEY ] = SCA_IInputDevice::KX_FOURKEY;
+ m[FIVEKEY ] = SCA_IInputDevice::KX_FIVEKEY;
+ m[SIXKEY ] = SCA_IInputDevice::KX_SIXKEY;
+ m[SEVENKEY ] = SCA_IInputDevice::KX_SEVENKEY;
+ m[EIGHTKEY ] = SCA_IInputDevice::KX_EIGHTKEY;
+ m[NINEKEY ] = SCA_IInputDevice::KX_NINEKEY;
+
+ m[CAPSLOCKKEY ] = SCA_IInputDevice::KX_CAPSLOCKKEY;
+
+ m[LEFTCTRLKEY ] = SCA_IInputDevice::KX_LEFTCTRLKEY;
+ m[LEFTALTKEY ] = SCA_IInputDevice::KX_LEFTALTKEY;
+ m[RIGHTALTKEY ] = SCA_IInputDevice::KX_RIGHTALTKEY;
+ m[RIGHTCTRLKEY ] = SCA_IInputDevice::KX_RIGHTCTRLKEY;
+ m[RIGHTSHIFTKEY ] = SCA_IInputDevice::KX_RIGHTSHIFTKEY;
+ m[LEFTSHIFTKEY ] = SCA_IInputDevice::KX_LEFTSHIFTKEY;
+
+ m[ESCKEY ] = SCA_IInputDevice::KX_ESCKEY;
+ m[TABKEY ] = SCA_IInputDevice::KX_TABKEY;
+ m[RETKEY ] = SCA_IInputDevice::KX_RETKEY;
+ m[SPACEKEY ] = SCA_IInputDevice::KX_SPACEKEY;
+ m[LINEFEEDKEY ] = SCA_IInputDevice::KX_LINEFEEDKEY;
+ m[BACKSPACEKEY ] = SCA_IInputDevice::KX_BACKSPACEKEY;
+ m[DELKEY ] = SCA_IInputDevice::KX_DELKEY;
+ m[SEMICOLONKEY ] = SCA_IInputDevice::KX_SEMICOLONKEY;
+ m[PERIODKEY ] = SCA_IInputDevice::KX_PERIODKEY;
+ m[COMMAKEY ] = SCA_IInputDevice::KX_COMMAKEY;
+ m[QUOTEKEY ] = SCA_IInputDevice::KX_QUOTEKEY;
+ m[ACCENTGRAVEKEY ] = SCA_IInputDevice::KX_ACCENTGRAVEKEY;
+ m[MINUSKEY ] = SCA_IInputDevice::KX_MINUSKEY;
+ m[SLASHKEY ] = SCA_IInputDevice::KX_SLASHKEY;
+ m[BACKSLASHKEY ] = SCA_IInputDevice::KX_BACKSLASHKEY;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list