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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-09 00:08:19 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-09 00:08:19 +0400
commitc8b4cf92067ffeb625aa39003baf5d8f7c3f0025 (patch)
treec6c50dbc3d90a65fca6c1ca56a93e4a57cf7e154 /source/gameengine/GameLogic/SCA_PropertySensor.cpp
parente93db433a086a3e739c0f4026cd500f0b595b0f1 (diff)
parentd76a6f5231c015c35123d22e1f5c3ffcdfbf9bbd (diff)
2.50:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD Notes: * Game and sequencer RNA, and sequencer header are now out of date a bit after changes in trunk. * I didn't know how to port these bugfixes, most likely they are not needed anymore. * Fix "duplicate strip" always increase the user count for ipo. * IPO pinning on sequencer strips was lost during Undo.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PropertySensor.cpp')
-rw-r--r--source/gameengine/GameLogic/SCA_PropertySensor.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index de8a9fcf03e..3b343af3cba 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -37,6 +37,7 @@
#include "StringValue.h"
#include "SCA_EventManager.h"
#include "SCA_LogicManager.h"
+#include "BoolValue.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -111,7 +112,7 @@ CValue* SCA_PropertySensor::GetReplica()
{
SCA_PropertySensor* replica = new SCA_PropertySensor(*this);
// m_range_expr must be recalculated on replica!
- CValue::AddDataToReplica(replica);
+ replica->ProcessReplica();
replica->Init();
replica->m_range_expr = NULL;
@@ -152,7 +153,7 @@ SCA_PropertySensor::~SCA_PropertySensor()
-bool SCA_PropertySensor::Evaluate(CValue* event)
+bool SCA_PropertySensor::Evaluate()
{
bool result = CheckPropertyCondition();
bool reset = m_reset && m_level;
@@ -182,17 +183,14 @@ bool SCA_PropertySensor::CheckPropertyCondition()
CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
if (!orgprop->IsError())
{
- STR_String testprop = orgprop->GetText();
+ const STR_String& testprop = orgprop->GetText();
// Force strings to upper case, to avoid confusion in
// bool tests. It's stupid the prop's identity is lost
// on the way here...
- if ((testprop == "TRUE") || (testprop == "FALSE")) {
- STR_String checkprop = m_checkpropval;
- checkprop.Upper();
- result = (testprop == checkprop);
- } else {
- result = (orgprop->GetText() == m_checkpropval);
+ if ((&testprop == &CBoolValue::sTrueString) || (&testprop == &CBoolValue::sFalseString)) {
+ m_checkpropval.Upper();
}
+ result = (testprop == m_checkpropval);
}
orgprop->Release();
@@ -232,8 +230,8 @@ bool SCA_PropertySensor::CheckPropertyCondition()
CValue* vallie = m_range_expr->Calculate();
if (vallie)
{
- STR_String errtext = vallie->GetText();
- if (errtext == "TRUE")
+ const STR_String& errtext = vallie->GetText();
+ if (&errtext == &CBoolValue::sTrueString)
{
result = true;
} else
@@ -295,9 +293,8 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
{
- bool result = true;
/* There is no type checking at this moment, unfortunately... */
- return result;
+ return 0;
}
/* ------------------------------------------------------------------------- */
@@ -306,8 +303,13 @@ int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
/* Integration hooks ------------------------------------------------------- */
PyTypeObject SCA_PropertySensor::Type = {
- PyObject_HEAD_INIT(NULL)
- 0,
+#if (PY_VERSION_HEX >= 0x02060000)
+ PyVarObject_HEAD_INIT(NULL, 0)
+#else
+ /* python 2.5 and below */
+ PyObject_HEAD_INIT( NULL ) /* required py macro */
+ 0, /* ob_size */
+#endif
"SCA_PropertySensor",
sizeof(PyObjectPlus_Proxy),
0,
@@ -345,8 +347,8 @@ PyMethodDef SCA_PropertySensor::Methods[] = {
};
PyAttributeDef SCA_PropertySensor::Attributes[] = {
- KX_PYATTRIBUTE_INT_RW("type",KX_PROPSENSOR_NODEF,KX_PROPSENSOR_MAX-1,false,SCA_PropertySensor,m_checktype),
- KX_PYATTRIBUTE_STRING_RW_CHECK("property",0,100,false,SCA_PropertySensor,m_checkpropname,CheckProperty),
+ KX_PYATTRIBUTE_INT_RW("mode",KX_PROPSENSOR_NODEF,KX_PROPSENSOR_MAX-1,false,SCA_PropertySensor,m_checktype),
+ KX_PYATTRIBUTE_STRING_RW_CHECK("propName",0,100,false,SCA_PropertySensor,m_checkpropname,CheckProperty),
KX_PYATTRIBUTE_STRING_RW_CHECK("value",0,100,false,SCA_PropertySensor,m_checkpropval,validValueForProperty),
{ NULL } //Sentinel
};
@@ -356,6 +358,10 @@ PyObject* SCA_PropertySensor::py_getattro(PyObject *attr) {
py_getattro_up(SCA_ISensor);
}
+PyObject* SCA_PropertySensor::py_getattro_dict() {
+ py_getattro_dict_up(SCA_ISensor);
+}
+
int SCA_PropertySensor::py_setattro(PyObject *attr, PyObject *value) {
py_setattro_up(SCA_ISensor);
}
@@ -366,7 +372,7 @@ const char SCA_PropertySensor::GetType_doc[] =
"\tReturns the type of check this sensor performs.\n";
PyObject* SCA_PropertySensor::PyGetType()
{
- ShowDeprecationWarning("getType()", "the type property");
+ ShowDeprecationWarning("getType()", "the mode property");
return PyInt_FromLong(m_checktype);
}
@@ -379,7 +385,7 @@ const char SCA_PropertySensor::SetType_doc[] =
"\tSet the type of check to perform.\n";
PyObject* SCA_PropertySensor::PySetType(PyObject* args)
{
- ShowDeprecationWarning("setType()", "the type property");
+ ShowDeprecationWarning("setType()", "the mode property");
int typeArg;
if (!PyArg_ParseTuple(args, "i:setType", &typeArg)) {
@@ -400,7 +406,7 @@ const char SCA_PropertySensor::GetProperty_doc[] =
"\tReturn the property with which the sensor operates.\n";
PyObject* SCA_PropertySensor::PyGetProperty()
{
- ShowDeprecationWarning("getProperty()", "the 'property' property");
+ ShowDeprecationWarning("getProperty()", "the 'propName' property");
return PyString_FromString(m_checkpropname);
}
@@ -412,7 +418,7 @@ const char SCA_PropertySensor::SetProperty_doc[] =
"\tof this name, the call is ignored.\n";
PyObject* SCA_PropertySensor::PySetProperty(PyObject* args)
{
- ShowDeprecationWarning("setProperty()", "the 'property' property");
+ ShowDeprecationWarning("setProperty()", "the 'propName' property");
/* We should query whether the name exists. Or should we create a prop */
/* on the fly? */
char *propNameArg = NULL;