Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-07-25 20:33:55 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-07-25 20:33:55 +0300
commitbcc020b1bc1b60f6cbd6d2c9bf400744931e57e1 (patch)
treefef4d83d0e5addb59c8389adf125281a4c7e35f8 /source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
parent99bb1accbbb8e1ba38f30b073b22deb107bf3220 (diff)
parent3f36cd3f33e52d53d82a3a221e2a576cf26390a5 (diff)
Merge branch 'asset-engine' into asset-experimentsasset-experiments
Conflicts: source/blender/blenloader/intern/readfile.c
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PythonKeyboard.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonKeyboard.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
index 19aae46f2a3..9a96a7b0334 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.cpp
@@ -113,11 +113,15 @@ PyObject *SCA_PythonKeyboard::pyattr_get_events(void *self_v, const KX_PYATTRIBU
{
SCA_PythonKeyboard* self = static_cast<SCA_PythonKeyboard*>(self_v);
- for (int i=SCA_IInputDevice::KX_BEGINKEY; i<=SCA_IInputDevice::KX_ENDKEY; i++)
- {
+ 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);
-
- PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
+ PyObject *key = PyLong_FromLong(i);
+ PyObject *value = PyLong_FromLong(inevent.m_status);
+
+ PyDict_SetItem(self->m_event_dict, key, value);
+
+ Py_DECREF(key);
+ Py_DECREF(value);
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;
@@ -129,12 +133,18 @@ PyObject *SCA_PythonKeyboard::pyattr_get_active_events(void *self_v, const KX_PY
PyDict_Clear(self->m_event_dict);
- for (int i=SCA_IInputDevice::KX_BEGINKEY; i<=SCA_IInputDevice::KX_ENDKEY; i++)
- {
+ 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)
- PyDict_SetItem(self->m_event_dict, PyLong_FromLong(i), PyLong_FromLong(inevent.m_status));
+ if (inevent.m_status != SCA_InputEvent::KX_NO_INPUTSTATUS) {
+ PyObject *key = PyLong_FromLong(i);
+ PyObject *value = PyLong_FromLong(inevent.m_status);
+
+ PyDict_SetItem(self->m_event_dict, key, value);
+
+ Py_DECREF(key);
+ Py_DECREF(value);
+ }
}
Py_INCREF(self->m_event_dict);
return self->m_event_dict;