[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19548] trunk/blender/source/gameengine: BGE Python API
Campbell Barton
ideasman42 at gmail.com
Sun Apr 5 16:55:50 CEST 2009
Revision: 19548
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19548
Author: campbellbarton
Date: 2009-04-05 16:55:50 +0200 (Sun, 05 Apr 2009)
Log Message:
-----------
BGE Python API
- action attribute wasnt checking for NULL (own fault)
- KX_Scene getCamera wasnt checking for NULL
- CListValue had asserts for not yet implimented functionality, this would close blender. Better to print an error if the user manages to run this functions (I managed to by CListValue.count([1,2,3]))
Modified Paths:
--------------
trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp
trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp
trunk/blender/source/gameengine/Expressions/ListValue.cpp
trunk/blender/source/gameengine/Ketsji/KX_SceneActuator.cpp
Modified: trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp 2009-04-05 14:01:49 UTC (rev 19547)
+++ trunk/blender/source/gameengine/Converter/BL_ActionActuator.cpp 2009-04-05 14:55:50 UTC (rev 19548)
@@ -1055,7 +1055,7 @@
PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
- return PyString_FromString(self->GetAction()->id.name+2);
+ return PyString_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
}
int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
Modified: trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp 2009-04-05 14:01:49 UTC (rev 19547)
+++ trunk/blender/source/gameengine/Converter/BL_ShapeActionActuator.cpp 2009-04-05 14:55:50 UTC (rev 19548)
@@ -886,7 +886,7 @@
PyObject* BL_ShapeActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
BL_ShapeActionActuator* self= static_cast<BL_ShapeActionActuator*>(self_v);
- return PyString_FromString(self->GetAction()->id.name+2);
+ return PyString_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
}
int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
Modified: trunk/blender/source/gameengine/Expressions/ListValue.cpp
===================================================================
--- trunk/blender/source/gameengine/Expressions/ListValue.cpp 2009-04-05 14:01:49 UTC (rev 19547)
+++ trunk/blender/source/gameengine/Expressions/ListValue.cpp 2009-04-05 14:55:50 UTC (rev 19548)
@@ -430,6 +430,10 @@
bool result = false;
CValue* eqval = ((CValue*)first)->Calc(VALUE_EQL_OPERATOR,(CValue*)second);
+
+ if (eqval==NULL)
+ return false;
+
STR_String txt = eqval->GetText();
eqval->Release();
if (txt=="TRUE")
@@ -479,7 +483,7 @@
if (checkobj==NULL) { /* in this case just return that there are no items in the list */
PyErr_Clear();
- PyInt_FromLong(0);
+ return PyInt_FromLong(0);
}
int numelem = GetCount();
@@ -503,7 +507,8 @@
* --------------------------------------------------------------------- */
CValue* CListValue::Calc(VALUE_OPERATOR op,CValue *val)
{
- assert(false); // todo: implement me!
+ //assert(false); // todo: implement me!
+ fprintf(stderr, "CValueList::Calc not yet implimented\n");
return NULL;
}
@@ -513,7 +518,8 @@
VALUE_OPERATOR op,
CValue* val)
{
- assert(false); // todo: implement me!
+ //assert(false); // todo: implement me!
+ fprintf(stderr, "CValueList::CalcFinal not yet implimented\n");
return NULL;
}
Modified: trunk/blender/source/gameengine/Ketsji/KX_SceneActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_SceneActuator.cpp 2009-04-05 14:01:49 UTC (rev 19547)
+++ trunk/blender/source/gameengine/Ketsji/KX_SceneActuator.cpp 2009-04-05 14:55:50 UTC (rev 19548)
@@ -469,7 +469,7 @@
{
ShowDeprecationWarning("getCamera()", "the camera property");
if (m_camera) {
- PyString_FromString(m_camera->GetName());
+ return PyString_FromString(m_camera->GetName());
}
else {
Py_RETURN_NONE;
More information about the Bf-blender-cvs
mailing list