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:
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PythonController.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index f9081c90288..6e9a0a7c6b6 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -33,8 +33,11 @@
#include "SCA_LogicManager.h"
#include "SCA_ISensor.h"
#include "SCA_IActuator.h"
+#include "PyObjectPlus.h"
#include "compile.h"
#include "eval.h"
+#include <algorithm>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -139,6 +142,14 @@ void SCA_PythonController::SetDictionary(PyObject* pythondictionary)
m_pythondictionary = PyDict_Copy(pythondictionary); /* new reference */
}
+int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
+{
+ if (std::find(m_triggeredSensors.begin(), m_triggeredSensors.end(), sensor) !=
+ m_triggeredSensors.end())
+ return 1;
+ return 0;
+}
+
#if 0
static char* sPyGetCurrentController__doc__;
#endif
@@ -294,7 +305,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
// something in this dictionary and crash?
PyDict_Clear(excdict);
Py_DECREF(excdict);
-
+ m_triggeredSensors.erase(m_triggeredSensors.begin(), m_triggeredSensors.end());
m_sCurrentController = NULL;
}