From a8bca52d0985f93290adaf13a6c7d8e2938089bf Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sun, 11 Apr 2010 01:53:21 +0000 Subject: BGE fix #20456 - 2.5: mouse position problem (offseted by 1 vertically) In Blender 2.49 the win width and height were been calculated including an extra pixel (e.g. a fullscreen editor would be (width + 1) by (height + 1) ) In opposite to that, Blender 2.5 window/editor code were fixed to have the exact width,height size. So although the BGE canvas code was still the same as 2.49 it was producing a wrong result. I'm also adding some commentaries in the setViewport code. BGE is setting the viewports 1 pixel larger. the setViewport command is been used as if one should pass (minx, miny, width, height), while it should be (minx, miny, maxx, maxy). I will take care of that later, if any one has extra comments on that, please let me know. --- source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp | 7 ++++++- source/gameengine/GamePlayer/common/GPC_Canvas.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'source/gameengine') diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index 40775f0355b..9139d6ea729 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -117,6 +117,11 @@ SetViewPort( int x1, int y1, int x2, int y2 ){ + /* x1 and y1 are the min pixel coordinate (e.g. 0) + x2 and y2 are the max pixel coordinate + the width,height is calculated including both pixels + therefore: max - min + 1 + */ int vp_width = (x2 - x1) + 1; int vp_height = (y2 - y1) + 1; int minx = m_frame_rect.GetLeft(); @@ -166,7 +171,7 @@ void KX_BlenderCanvas::SetMousePosition(int x,int y) int winY = m_frame_rect.GetBottom(); int winH = m_frame_rect.GetHeight(); - BL_warp_pointer(m_win, winX + x, winY + (winH-y-1)); + BL_warp_pointer(m_win, winX + x, winY + (winH-y)); } diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp index 3fa27b40928..100ab4b72b3 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp @@ -100,6 +100,12 @@ void GPC_Canvas::ClearColor(float r, float g, float b, float a) void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2) { + /* x1 and y1 are the min pixel coordinate (e.g. 0) + x2 and y2 are the max pixel coordinate + the width,height is calculated including both pixels + therefore: max - min + 1 + */ + /* XXX, nasty, this needs to go somewhere else, * but where... definitly need to clean up this * whole canvas/rendertools mess. -- cgit v1.2.3 From fe9a22a0182689125c8147934bc20bbc86141aab Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 11 Apr 2010 12:05:27 +0000 Subject: py api file rename - prefix mathutils api. - 2 blf.c files (annoying for debugging) - py api docs ignore keying sets as with operators. --- source/gameengine/Converter/KX_IpoConvert.cpp | 2 +- source/gameengine/Expressions/PyObjectPlus.h | 2 +- source/gameengine/Ketsji/KX_PyMath.h | 2 +- source/gameengine/Ketsji/KX_PythonInit.cpp | 4 ++-- source/gameengine/VideoTexture/ImageBuff.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index 7c6b59a42bd..4adfa842fd7 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -121,7 +121,7 @@ void BL_ConvertIpos(struct Object* blenderobject,KX_GameObject* gameobj,KX_Blend ) ); - char *rotmode, *drotmode; + const char *rotmode, *drotmode; switch(blenderobject->rotmode) { diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h index d81753ce64d..e19f4800ca5 100644 --- a/source/gameengine/Expressions/PyObjectPlus.h +++ b/source/gameengine/Expressions/PyObjectPlus.h @@ -46,7 +46,7 @@ #ifndef DISABLE_PYTHON #ifdef USE_MATHUTILS extern "C" { -#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ } #endif diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h index 8c14ac0e96c..9c9688f79cd 100644 --- a/source/gameengine/Ketsji/KX_PyMath.h +++ b/source/gameengine/Ketsji/KX_PyMath.h @@ -45,7 +45,7 @@ #ifndef DISABLE_PYTHON #ifdef USE_MATHUTILS extern "C" { -#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */ +#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */ } #endif diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 7dec4e4f97f..8d4a6d3f897 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -38,8 +38,8 @@ extern "C" { #include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */ - #include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. - #include "Geometry.h" // Blender.Geometry module copied here so the blenderlayer can use. + #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use. + #include "geometry.h" // Blender.Geometry module copied here so the blenderlayer can use. #include "bgl.h" #include "marshal.h" /* python header for loading/saving dicts */ diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp index 0bb0cf59511..926468c662e 100644 --- a/source/gameengine/VideoTexture/ImageBuff.cpp +++ b/source/gameengine/VideoTexture/ImageBuff.cpp @@ -128,7 +128,7 @@ void ImageBuff::clear (short width, short height, unsigned char color) memset(m_image, color, size*4); // and change the alpha channel p = &((unsigned char*)m_image)[3]; - for (size; size>0; size--) + for (; size>0; size--) { *p = 0xFF; p += 4; -- cgit v1.2.3 From 67cfc427eefdefc003ba53db9ca7cf6f4633c252 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 11 Apr 2010 14:22:27 +0000 Subject: PyAPI - added new mathutils.Color() type, use with rna so we can do for eg: material.diffuse_color.r = 1.0 # also has hsv access material.diffuse_color.s = 0.6 - made Mathutils and Geometry module names lowercase. --- source/gameengine/Ketsji/KX_PythonInit.cpp | 2 +- source/gameengine/PyDoc/API_intro.py | 2 +- source/gameengine/PyDoc/GameTypes.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 8d4a6d3f897..082f802010d 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1622,7 +1622,7 @@ PyObject *KXpy_import(PyObject *self, PyObject *args) /* quick hack for GamePython modules TODO: register builtin modules properly by ExtendInittab */ if (!strcmp(name, "GameLogic") || !strcmp(name, "GameKeys") || !strcmp(name, "PhysicsConstraints") || - !strcmp(name, "Rasterizer") || !strcmp(name, "Mathutils") || !strcmp(name, "bgl") || !strcmp(name, "Geometry")) { + !strcmp(name, "Rasterizer") || !strcmp(name, "mathutils") || !strcmp(name, "bgl") || !strcmp(name, "geometry")) { return PyImport_ImportModuleEx(name, globals, locals, fromlist); } diff --git a/source/gameengine/PyDoc/API_intro.py b/source/gameengine/PyDoc/API_intro.py index abc8c83855b..097abbfbf1a 100644 --- a/source/gameengine/PyDoc/API_intro.py +++ b/source/gameengine/PyDoc/API_intro.py @@ -26,7 +26,7 @@ The Blender Game Engine Python API Reference These modules have no GameEngine specific functionality but are useful in many cases. - - L{Mathutils} + - L{mathutils} - L{Geometry} - L{BGL} diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py index 7045e6cb88e..839f228c3d5 100644 --- a/source/gameengine/PyDoc/GameTypes.py +++ b/source/gameengine/PyDoc/GameTypes.py @@ -1670,7 +1670,7 @@ class KX_GameObject(SCA_IObject): @deprecated: use L{localOrientation} @type orn: 3x3 rotation matrix, or Quaternion. @param orn: a rotation matrix specifying the new rotation. - @note: When using this matrix with Blender.Mathutils.Matrix() types, it will need to be transposed. + @note: When using this matrix with Blender.mathutils.Matrix() types, it will need to be transposed. """ def alignAxisToVect(vect, axis, factor): """ @@ -1704,7 +1704,7 @@ class KX_GameObject(SCA_IObject): @deprecated: use L{worldOrientation} @rtype: 3x3 rotation matrix @return: The game object's rotation matrix - @note: When using this matrix with Blender.Mathutils.Matrix() types, it will need to be transposed. + @note: When using this matrix with Blender.mathutils.Matrix() types, it will need to be transposed. """ def applyMovement(movement, local = 0): """ -- cgit v1.2.3 From 7d9067ca2c0487dd43c127cdc5d09b3565601991 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Wed, 14 Apr 2010 21:12:05 +0000 Subject: Make memstat easier to read, add missing Intel ID and cleanups. --- source/gameengine/GameLogic/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/GameLogic/Makefile b/source/gameengine/GameLogic/Makefile index a1794a60452..ba1e1c25ee7 100644 --- a/source/gameengine/GameLogic/Makefile +++ b/source/gameengine/GameLogic/Makefile @@ -38,10 +38,10 @@ include nan_compile.mk CCFLAGS += $(LEVEL_1_CPP_WARNINGS) -CPPFLAGS += -I../Expressions +CPPFLAGS += -I../Expressions CPPFLAGS += -I../SceneGraph CPPFLAGS += -I../Rasterizer -CPPFLAGS += -I$(NAN_STRING)/include +CPPFLAGS += -I$(NAN_STRING)/include CPPFLAGS += -I$(NAN_MOTO)/include CPPFLAGS += -I../../blender/makesdna CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -- cgit v1.2.3 From 795b438bf5565a87765edb880318b7e241714270 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 17 Apr 2010 06:52:14 +0000 Subject: Patch #21789 - BGE Keyboard and Mouse Python types - by Mitchell Stokes(Moguri) The patch exposes mouse and keyboard read-only properties in the GameLogic module Also renames bge.keys to bge.events (* Note: name of bge submodules (logic, render, ...) may change before 2.5 final release [right Campbell?]). """ This patch adds two new types to the BGE: SCA_PythonKeyboard SCA_PythonMouse These two types allow users to make use of the keyboard and mouse without the need for a keyboard or mouse sensor. SCA_PythonKeyboard has an events property that acts just like SCA_KeyboardSensor.events. SCA_PythonMouse also has an events property to check for mouse events. Further more it supports getting and setting normalized cursor position (from 0.0 to 1.0) with SCA_PythonMouse.position. The cursor can be shown/hidden using SCA_PythonMouse.visible. """ Its use is similar with current mouse and keyboard controllers. With the exception of mouse position being normalized and writable as well (replacing Rasterizer.setMousePosition). Code Sample: ###### from bge import logic, events mouse = logic.mouse keyboard = logic.keyboard for key,status in keyboard.events: if status == logic.KX_INPUT_JUST_ACTIVATED: if key == events.WKEY: print(mouse.position) # move_forward() mouse.visible = True # turn cursor visible mouse.position = 0.5,0.5 # centralize mouse - use tuple ###### * Important Note: mouse.position still will not work properly for Letterbox mode. In order to fix letterboxing I may need to move the set x,y mouse function to inside the canvas code (to avoid duplicated code between mouse sensor and bge.logic.mouse). I'll leave this for another commit though. Thanks Mitchell for the work on that. --- .../BlenderRoutines/KX_BlenderCanvas.cpp | 2 + source/gameengine/GameLogic/SCA_PythonKeyboard.cpp | 115 +++++++++++++ source/gameengine/GameLogic/SCA_PythonKeyboard.h | 51 ++++++ source/gameengine/GameLogic/SCA_PythonMouse.cpp | 185 +++++++++++++++++++++ source/gameengine/GameLogic/SCA_PythonMouse.h | 60 +++++++ source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp | 2 + source/gameengine/Ketsji/KX_KetsjiEngine.h | 2 + source/gameengine/Ketsji/KX_PythonInit.cpp | 20 ++- source/gameengine/Ketsji/KX_PythonInitTypes.cpp | 4 + source/gameengine/PyDoc/GameKeys.py | 9 + source/gameengine/PyDoc/GameLogic.py | 3 + source/gameengine/PyDoc/GameTypes.py | 37 +++++ source/gameengine/Rasterizer/RAS_ICanvas.h | 9 + 13 files changed, 498 insertions(+), 1 deletion(-) create mode 100644 source/gameengine/GameLogic/SCA_PythonKeyboard.cpp create mode 100644 source/gameengine/GameLogic/SCA_PythonKeyboard.h create mode 100644 source/gameengine/GameLogic/SCA_PythonMouse.cpp create mode 100644 source/gameengine/GameLogic/SCA_PythonMouse.h (limited to 'source/gameengine') diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index 9139d6ea729..d563a17fe06 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -139,6 +139,8 @@ SetViewPort( void KX_BlenderCanvas::SetMouseState(RAS_MouseState mousestate) { + m_mousestate = mousestate; + switch (mousestate) { case MOUSE_INVISIBLE: diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp new file mode 100644 index 00000000000..ef6d2ad8cab --- /dev/null +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp @@ -0,0 +1,115 @@ +/** + * Python Keyboard Object + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "SCA_PythonKeyboard.h" +#include "SCA_IInputDevice.h" + +/* ------------------------------------------------------------------------- */ +/* Native functions */ +/* ------------------------------------------------------------------------- */ + +SCA_PythonKeyboard::SCA_PythonKeyboard(SCA_IInputDevice* keyboard) +: PyObjectPlus(), +m_keyboard(keyboard) +{ +} + +SCA_PythonKeyboard::~SCA_PythonKeyboard() +{ + /* intentionally empty */ +} + +#ifndef DISABLE_PYTHON + +/* ------------------------------------------------------------------------- */ +/* Python functions */ +/* ------------------------------------------------------------------------- */ + +/* Integration hooks ------------------------------------------------------- */ +PyTypeObject SCA_PythonKeyboard::Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SCA_PythonKeyboard", + sizeof(PyObjectPlus_Proxy), + 0, + py_base_dealloc, + 0, + 0, + 0, + 0, + py_base_repr, + 0,0,0,0,0,0,0,0,0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + 0,0,0,0,0,0,0, + Methods, + 0, + 0, + &PyObjectPlus::Type, + 0,0,0,0,0,0, + py_base_new +}; + +PyMethodDef SCA_PythonKeyboard::Methods[] = { + {NULL,NULL} //Sentinel +}; + +PyAttributeDef SCA_PythonKeyboard::Attributes[] = { + KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonKeyboard, pyattr_get_events), + { NULL } //Sentinel +}; + +PyObject* SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + SCA_PythonKeyboard* self = static_cast(self_v); + + PyObject* resultlist = PyList_New(0); + + for (int i=SCA_IInputDevice::KX_BEGINKEY; i<=SCA_IInputDevice::KX_ENDKEY; i++) + { + const SCA_InputEvent & inevent = self->m_keyboard->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); + + + if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) + { + PyObject* keypair = PyList_New(2); + PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); + PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); + PyList_Append(resultlist, keypair); + } + } + + return resultlist; +} + +#endif diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h new file mode 100644 index 00000000000..4c178d61cb0 --- /dev/null +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h @@ -0,0 +1,51 @@ +/** + * SCA_PythonKeyboard.h + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __KX_PYKEYBOARD +#define __KX_PYKEYBOARD + +#include "PyObjectPlus.h" + +class SCA_PythonKeyboard : public PyObjectPlus +{ + Py_Header; + class SCA_IInputDevice *m_keyboard; +public: + SCA_PythonKeyboard(class SCA_IInputDevice* keyboard); + virtual ~SCA_PythonKeyboard(); + +#ifndef DISABLE_PYTHON + static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); +#endif +}; + +#endif //__KX_PYKEYBOARD + diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp new file mode 100644 index 00000000000..405c4110301 --- /dev/null +++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp @@ -0,0 +1,185 @@ +/** + * Python Mouse Object + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "SCA_PythonMouse.h" +#include "SCA_IInputDevice.h" +#include "RAS_ICanvas.h" + +/* ------------------------------------------------------------------------- */ +/* Native functions */ +/* ------------------------------------------------------------------------- */ + +SCA_PythonMouse::SCA_PythonMouse(SCA_IInputDevice* mouse, RAS_ICanvas* canvas) +: PyObjectPlus(), +m_canvas(canvas), +m_mouse(mouse) +{ +} + +SCA_PythonMouse::~SCA_PythonMouse() +{ + /* intentionally empty */ +} + +#ifndef DISABLE_PYTHON + +/* ------------------------------------------------------------------------- */ +/* Python functions */ +/* ------------------------------------------------------------------------- */ + +/* Integration hooks ------------------------------------------------------- */ +PyTypeObject SCA_PythonMouse::Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "SCA_PythonMouse", + sizeof(PyObjectPlus_Proxy), + 0, + py_base_dealloc, + 0, + 0, + 0, + 0, + py_base_repr, + 0,0,0,0,0,0,0,0,0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + 0,0,0,0,0,0,0, + Methods, + 0, + 0, + &PyObjectPlus::Type, + 0,0,0,0,0,0, + py_base_new +}; + +PyMethodDef SCA_PythonMouse::Methods[] = { +// KX_PYMETHODTABLE(SCA_PythonMouse, show), + {NULL,NULL} //Sentinel +}; + +PyAttributeDef SCA_PythonMouse::Attributes[] = { + KX_PYATTRIBUTE_RO_FUNCTION("events", SCA_PythonMouse, pyattr_get_events), + KX_PYATTRIBUTE_RW_FUNCTION("position", SCA_PythonMouse, pyattr_get_position, pyattr_set_position), + KX_PYATTRIBUTE_RW_FUNCTION("visible", SCA_PythonMouse, pyattr_get_visible, pyattr_set_visible), + { NULL } //Sentinel +}; + +PyObject* SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + SCA_PythonMouse* self = static_cast(self_v); + + PyObject* resultlist = PyList_New(0); + + for (int i=SCA_IInputDevice::KX_BEGINMOUSE; i<=SCA_IInputDevice::KX_ENDMOUSE; i++) + { + const SCA_InputEvent & inevent = self->m_mouse->GetEventValue((SCA_IInputDevice::KX_EnumInputs)i); + + + if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) + { + PyObject* keypair = PyList_New(2); + PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); + PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); + PyList_Append(resultlist, keypair); + } + } + + return resultlist; +} + +PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + SCA_PythonMouse* self = static_cast(self_v); + const SCA_InputEvent & xevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEX); + const SCA_InputEvent & yevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEY); + + PyObject* resultlist = PyList_New(2); + + PyList_SET_ITEM(resultlist, 0, PyFloat_FromDouble(float(xevent.m_eventval)/self->m_canvas->GetWidth())); + + PyList_SET_ITEM(resultlist, 1, PyFloat_FromDouble(float(yevent.m_eventval)/self->m_canvas->GetHeight())); + + return resultlist; +} + +int SCA_PythonMouse::pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + SCA_PythonMouse* self = static_cast(self_v); + int x, y; + float pyx, pyy; + if (!PyArg_ParseTuple(value, "ff:position", &pyx, &pyy)) + return PY_SET_ATTR_FAIL; + + x = (int)(pyx*self->m_canvas->GetWidth()); + y = (int)(pyy*self->m_canvas->GetHeight()); + + self->m_canvas->SetMousePosition(x, y); + + return PY_SET_ATTR_SUCCESS; +} + +PyObject* SCA_PythonMouse::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef) +{ + SCA_PythonMouse* self = static_cast(self_v); + + int visible; + + if (self->m_canvas->GetMouseState() == RAS_ICanvas::MOUSE_INVISIBLE) + visible = 0; + else + visible = 1; + + return PyBool_FromLong(visible); +} + +int SCA_PythonMouse::pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) +{ + SCA_PythonMouse* self = static_cast(self_v); + + int visible = PyObject_IsTrue(value); + + if (visible == -1) + { + PyErr_SetString(PyExc_AttributeError, "SCA_PythonMouse.visible = bool: SCA_PythonMouse, expected True or False"); + return PY_SET_ATTR_FAIL; + } + + if (visible) + self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); + else + self->m_canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); + + return PY_SET_ATTR_SUCCESS; +} + +#endif diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h new file mode 100644 index 00000000000..b3ce107995b --- /dev/null +++ b/source/gameengine/GameLogic/SCA_PythonMouse.h @@ -0,0 +1,60 @@ +/** + * SCA_PythonMouse.h + * + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __KX_PYMOUSE +#define __KX_PYMOUSE + +#include "PyObjectPlus.h" + +class SCA_PythonMouse : public PyObjectPlus +{ + Py_Header; + class SCA_IInputDevice *m_mouse; + class RAS_ICanvas *m_canvas; +public: + SCA_PythonMouse(class SCA_IInputDevice* mouse, class RAS_ICanvas* canvas); + virtual ~SCA_PythonMouse(); + + void Show(bool visible); + +#ifndef DISABLE_PYTHON + KX_PYMETHOD_DOC(SCA_PythonMouse, show); + + static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); + static PyObject* pyattr_get_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static int pyattr_set_visible(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value); +#endif +}; + +#endif //__KX_PYMOUSE + diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp index 0a96fbbe503..4eb9a4cfcd7 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp @@ -79,6 +79,8 @@ void GPG_Canvas::SetMousePosition(int x, int y) void GPG_Canvas::SetMouseState(RAS_MouseState mousestate) { + m_mousestate = mousestate; + if (m_window) { switch (mousestate) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 36db8685afb..b3549c5fdab 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -213,6 +213,8 @@ public: RAS_IRasterizer* GetRasterizer(){return m_rasterizer;}; RAS_ICanvas* GetCanvas(){return m_canvas;}; RAS_IRenderTools* GetRenderTools(){return m_rendertools;}; + SCA_IInputDevice* GetKeyboardDevice(){return m_keyboarddevice;}; + SCA_IInputDevice* GetMouseDevice(){return m_mousedevice;}; /// Dome functions void InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text); diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 082f802010d..675cf3c09f6 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -73,6 +73,8 @@ extern "C" { #include "SCA_PropertySensor.h" #include "SCA_RandomActuator.h" #include "SCA_KeyboardSensor.h" /* IsPrintable, ToCharacter */ +#include "SCA_PythonKeyboard.h" +#include "SCA_PythonMouse.h" #include "KX_ConstraintActuator.h" #include "KX_IpoActuator.h" #include "KX_SoundActuator.h" @@ -1280,6 +1282,13 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack PyDict_SetItemString(d, "globalDict", item=PyDict_New()); Py_DECREF(item); + // Add keyboard and mouse attributes to this module + SCA_PythonKeyboard* pykeyb = new SCA_PythonKeyboard(gp_KetsjiEngine->GetKeyboardDevice()); + PyDict_SetItemString(d, "keyboard", pykeyb->NewProxy(true)); + + SCA_PythonMouse* pymouse = new SCA_PythonMouse(gp_KetsjiEngine->GetMouseDevice(), gp_Canvas); + PyDict_SetItemString(d, "mouse", pymouse->NewProxy(true)); + ErrorObject = PyUnicode_FromString("GameLogic.error"); PyDict_SetItemString(d, "error", ErrorObject); Py_DECREF(ErrorObject); @@ -1978,7 +1987,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main * #endif /* could be done a lot more nicely, but for now a quick way to get bge.* working */ - PyRun_SimpleString("__import__('sys').modules['bge']=[mod for mod in (type(__builtins__)('bge'), ) if mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'keys':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')}) is None][0]"); + PyRun_SimpleString("__import__('sys').modules['bge']=[mod for mod in (type(__builtins__)('bge'), ) if mod.__dict__.update({'logic':__import__('GameLogic'), 'render':__import__('Rasterizer'), 'events':__import__('GameKeys'), 'constraints':__import__('PhysicsConstraints'), 'types':__import__('GameTypes')}) is None][0]"); } static struct PyModuleDef Rasterizer_module_def = { @@ -2257,6 +2266,15 @@ PyObject* initGameKeys() KX_MACRO_addTypesToDict(d, PAGEDOWNKEY, SCA_IInputDevice::KX_PAGEDOWNKEY); KX_MACRO_addTypesToDict(d, ENDKEY, SCA_IInputDevice::KX_ENDKEY); + // MOUSE + KX_MACRO_addTypesToDict(d, LEFTMOUSE, SCA_IInputDevice::KX_LEFTMOUSE); + KX_MACRO_addTypesToDict(d, MIDDLEMOUSE, SCA_IInputDevice::KX_MIDDLEMOUSE); + KX_MACRO_addTypesToDict(d, RIGHTMOUSE, SCA_IInputDevice::KX_RIGHTMOUSE); + KX_MACRO_addTypesToDict(d, WHEELUPMOUSE, SCA_IInputDevice::KX_WHEELUPMOUSE); + KX_MACRO_addTypesToDict(d, WHEELDOWNMOUSE, SCA_IInputDevice::KX_WHEELDOWNMOUSE); + KX_MACRO_addTypesToDict(d, MOUSEX, SCA_IInputDevice::KX_MOUSEX); + KX_MACRO_addTypesToDict(d, MOUSEY, SCA_IInputDevice::KX_MOUSEY); + // Check for errors if (PyErr_Occurred()) { diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp index 278e0236b2e..6b9d7a2cccf 100644 --- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp +++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp @@ -79,6 +79,8 @@ #include "SCA_RandomSensor.h" #include "SCA_XNORController.h" #include "SCA_XORController.h" +#include "SCA_PythonKeyboard.h" +#include "SCA_PythonMouse.h" #include "KX_IpoActuator.h" #include "KX_NearSensor.h" #include "KX_RadarSensor.h" @@ -239,6 +241,8 @@ void initPyTypes(void) PyType_Ready_Attr(dict, SCA_XNORController, init_getset); PyType_Ready_Attr(dict, SCA_XORController, init_getset); PyType_Ready_Attr(dict, SCA_IController, init_getset); + PyType_Ready_Attr(dict, SCA_PythonKeyboard, init_getset); + PyType_Ready_Attr(dict, SCA_PythonMouse, init_getset); } diff --git a/source/gameengine/PyDoc/GameKeys.py b/source/gameengine/PyDoc/GameKeys.py index e798f6c901b..8e5c7d3ae24 100644 --- a/source/gameengine/PyDoc/GameKeys.py +++ b/source/gameengine/PyDoc/GameKeys.py @@ -150,6 +150,15 @@ Example:: @var SPACEKEY: @var TABKEY: +@group Mouse Events: LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE, WHEELUPMOUSE, WHEELDOWNMOUSE, MOUSEX, MOUSEY +@var LEFTMOUSE: +@var MIDDLEMOUSE: +@var RIGHTMOUSE: +@var WHEELUPMOUSE: +@var WHEELDOWNMOUSE: +@var MOUSEX: +@var MOUSEY: + """ def EventToString(event): diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py index 56a9ea0d4f4..4bef65e42b3 100644 --- a/source/gameengine/PyDoc/GameLogic.py +++ b/source/gameengine/PyDoc/GameLogic.py @@ -308,6 +308,9 @@ Documentation for the GameLogic Module. later on with the game load/save actuators. note: only python built in types such as int/string/bool/float/tuples/lists can be saved, GameObjects, Actuators etc will not work as expectred. + +@var keyboard: The current keyboard wrapped in an SCA_PythonKeyboard object. +@var mouse: The current mouse wrapped in an SCA_PythonMouse object. """ import GameTypes diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py index 839f228c3d5..45d08d2e96a 100644 --- a/source/gameengine/PyDoc/GameTypes.py +++ b/source/gameengine/PyDoc/GameTypes.py @@ -108,6 +108,43 @@ class SCA_ILogicBrick(CValue): """ #} +class SCA_PythonKeyboard(PyObjectPlus) + """ + The current keyboard. + @ivar events: a list of pressed keys that have either been pressed, or just released, or are active this frame. (read-only). + + - 'keycode' matches the values in L{GameKeys}. + - 'status' uses... + - L{GameLogic.KX_INPUT_NONE} + - L{GameLogic.KX_INPUT_JUST_ACTIVATED} + - L{GameLogic.KX_INPUT_ACTIVE} + - L{GameLogic.KX_INPUT_JUST_RELEASED} + + @type events: list [[keycode, status], ...] + """ + pass + +class SCA_PythonMouse(PyObjectPlus) + """ + The current mouse. + + @ivar events: a list of pressed buttons that have either been pressed, or just released, or are active this frame. (read-only). + + - 'keycode' matches the values in L{GameKeys}. + - 'status' uses... + - L{GameLogic.KX_INPUT_NONE} + - L{GameLogic.KX_INPUT_JUST_ACTIVATED} + - L{GameLogic.KX_INPUT_ACTIVE} + - L{GameLogic.KX_INPUT_JUST_RELEASED} + + @type events: list [[keycode, status], ...] + @ivar position: The normalized x and y position of the mouse cursor. + @type position: list [x, y] + @ivar visible: The visibility of the mouse cursor + @type visible: boolean + """ + pass + class SCA_IObject(CValue): """ This class has no python functions diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h index 2ab06be26e7..0821e369f75 100644 --- a/source/gameengine/Rasterizer/RAS_ICanvas.h +++ b/source/gameengine/Rasterizer/RAS_ICanvas.h @@ -172,12 +172,21 @@ public: int y )=0; + virtual + RAS_MouseState + GetMouseState() + { + return m_mousestate; + } + virtual void MakeScreenShot( const char* filename )=0; +protected: + RAS_MouseState m_mousestate; #ifdef WITH_CXX_GUARDEDALLOC public: -- cgit v1.2.3 From 392e1da1790d252f0f156379c1d5507959a4e17a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Apr 2010 15:47:00 +0000 Subject: bugfix and cleanup - BGE Shader.setSampler(name, index): index range check was wrong. - Compositor check for an invalid channel was incorrect. - getting the center of selected verts used an uninitalized z axis. - do_init_render_material() used && rather then & when testing for MA_TRANSP. - weight paint activate flipped bone used && rather then & for flag checking. --- source/gameengine/Converter/BL_ArmatureConstraint.cpp | 2 +- source/gameengine/Ketsji/BL_Shader.cpp | 2 +- source/gameengine/Ketsji/KX_CameraActuator.cpp | 2 +- source/gameengine/Ketsji/KX_SoundActuator.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp index f9455d37622..7117ba61037 100644 --- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp +++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp @@ -74,7 +74,7 @@ BL_ArmatureConstraint::BL_ArmatureConstraint( bConstraint *constraint, KX_GameObject* target, KX_GameObject* subtarget) - : PyObjectPlus(), m_armature(armature), m_constraint(constraint), m_posechannel(posechannel) + : PyObjectPlus(), m_constraint(constraint), m_posechannel(posechannel), m_armature(armature) { m_target = target; m_blendtarget = (target) ? target->GetBlenderObject() : NULL; diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 55be606378d..8edefe7ac2d 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -884,7 +884,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" ) { int loc = GetUniformLocation(uniform); if(loc != -1) { - if(index >= MAXTEX && index < 0) + if(index >= MAXTEX || index < 0) spit("Invalid texture sample index: " << index); #ifdef SORT_UNIFORMS diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index f9ec503478c..191ffeb66bd 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -380,7 +380,7 @@ PyTypeObject KX_CameraActuator::Type = { }; PyMethodDef KX_CameraActuator::Methods[] = { - {NULL,NULL,NULL,NULL} //Sentinel + {NULL, NULL} //Sentinel }; PyAttributeDef KX_CameraActuator::Attributes[] = { diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 08f235801a0..9aa388648a8 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -299,7 +299,7 @@ PyMethodDef KX_SoundActuator::Methods[] = { KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, startSound), KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, pauseSound), KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, stopSound), - {NULL,NULL,NULL,NULL} //Sentinel + {NULL, NULL} //Sentinel }; PyAttributeDef KX_SoundActuator::Attributes[] = { -- cgit v1.2.3 From 4cf697de8913e91e9091a12afbd37f5ebd4c9940 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Apr 2010 19:05:53 +0000 Subject: - for BGE mouse and keyboard events use tuples rather then lists - pep8 corrections --- source/gameengine/GameLogic/SCA_PythonKeyboard.cpp | 6 +++--- source/gameengine/GameLogic/SCA_PythonMouse.cpp | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp index ef6d2ad8cab..ddac506e679 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp @@ -102,9 +102,9 @@ PyObject* SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBU if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) { - PyObject* keypair = PyList_New(2); - PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); - PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); + PyObject* keypair = PyTuple_New(2); + PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); + PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); PyList_Append(resultlist, keypair); } } diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp index 405c4110301..0da99f40ca9 100644 --- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp +++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp @@ -107,9 +107,9 @@ PyObject* SCA_PythonMouse::pyattr_get_events(void *self_v, const KX_PYATTRIBUTE_ if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) { - PyObject* keypair = PyList_New(2); - PyList_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); - PyList_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); + PyObject* keypair = PyTuple_New(2); + PyTuple_SET_ITEM(keypair, 0, PyLong_FromSsize_t(i)); + PyTuple_SET_ITEM(keypair, 1, PyLong_FromSsize_t(inevent.m_status)); PyList_Append(resultlist, keypair); } } @@ -123,13 +123,12 @@ PyObject* SCA_PythonMouse::pyattr_get_position(void *self_v, const KX_PYATTRIBUT const SCA_InputEvent & xevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEX); const SCA_InputEvent & yevent = self->m_mouse->GetEventValue(SCA_IInputDevice::KX_MOUSEY); - PyObject* resultlist = PyList_New(2); + PyObject* ret = PyTuple_New(2); - PyList_SET_ITEM(resultlist, 0, PyFloat_FromDouble(float(xevent.m_eventval)/self->m_canvas->GetWidth())); - - PyList_SET_ITEM(resultlist, 1, PyFloat_FromDouble(float(yevent.m_eventval)/self->m_canvas->GetHeight())); + PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(float(xevent.m_eventval)/self->m_canvas->GetWidth())); + PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(float(yevent.m_eventval)/self->m_canvas->GetHeight())); - return resultlist; + return ret; } int SCA_PythonMouse::pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value) -- cgit v1.2.3 From 00e46ef739cf2bfddb8805af056aa59fd3b3c71c Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Sat, 17 Apr 2010 22:43:18 +0000 Subject: SVN maintenance. --- source/gameengine/GameLogic/SCA_PythonKeyboard.cpp | 7 ------- source/gameengine/GameLogic/SCA_PythonKeyboard.h | 7 ------- source/gameengine/GameLogic/SCA_PythonMouse.cpp | 7 ------- source/gameengine/GameLogic/SCA_PythonMouse.h | 7 ------- 4 files changed, 28 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp index ddac506e679..3b4cdd701a6 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp @@ -1,6 +1,4 @@ /** - * Python Keyboard Object - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -19,11 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h index 4c178d61cb0..0b353ac444c 100644 --- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h +++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h @@ -1,6 +1,4 @@ /** - * SCA_PythonKeyboard.h - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -19,11 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.cpp b/source/gameengine/GameLogic/SCA_PythonMouse.cpp index 0da99f40ca9..278b967355b 100644 --- a/source/gameengine/GameLogic/SCA_PythonMouse.cpp +++ b/source/gameengine/GameLogic/SCA_PythonMouse.cpp @@ -1,6 +1,4 @@ /** - * Python Mouse Object - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -19,11 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h index b3ce107995b..c73e6683fc8 100644 --- a/source/gameengine/GameLogic/SCA_PythonMouse.h +++ b/source/gameengine/GameLogic/SCA_PythonMouse.h @@ -1,6 +1,4 @@ /** - * SCA_PythonMouse.h - * * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -19,11 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** -- cgit v1.2.3