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_PropertySensor.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index 9c09c8410fb..2a4222af355 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -38,6 +38,7 @@
#include "SCA_EventManager.h"
#include "SCA_LogicManager.h"
#include "BoolValue.h"
+#include "FloatValue.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -190,6 +191,22 @@ bool SCA_PropertySensor::CheckPropertyCondition()
m_checkpropval.Upper();
}
result = (testprop == m_checkpropval);
+
+ /* Patch: floating point values cant use strings usefully since you can have "0.0" == "0.0000"
+ * this could be made into a generic Value class function for comparing values with a string.
+ */
+ if(result==false && dynamic_cast<CFloatValue *>(orgprop) != NULL) {
+ float f;
+
+ if(EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f))
+ {
+ //error
+ }
+ else {
+ result = (f == ((CFloatValue *)orgprop)->GetFloat());
+ }
+ }
+ /* end patch */
}
orgprop->Release();
@@ -290,16 +307,18 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
return GetParent()->FindIdentifier(identifiername);
}
+#ifndef DISABLE_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python functions */
+/* ------------------------------------------------------------------------- */
+
int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
{
/* There is no type checking at this moment, unfortunately... */
return 0;
}
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
/* Integration hooks ------------------------------------------------------- */
PyTypeObject SCA_PropertySensor::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
@@ -334,4 +353,6 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = {
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */