From 33e2d118bcc8d8301144cd90e7896175ae14d141 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Aug 2009 12:43:25 +0000 Subject: [PATCH] removing GameLogic.EvalExpression(), unlikely anyone will miss it, was only accessible in 2.49, invalid expressions would crash, valid ones leak memory. --- source/gameengine/Ketsji/KX_PythonInit.cpp | 28 ---------------------- source/gameengine/PyDoc/GameLogic.py | 8 ------- 2 files changed, 36 deletions(-) diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index fcada7bfce4..91515587e8d 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -498,33 +498,6 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) Py_RETURN_NONE; } - -static PyObject *gEvalExpression(PyObject*, PyObject* value) -{ - char* txt= PyString_AsString(value); - - if (txt==NULL) { - PyErr_SetString(PyExc_TypeError, "Expression.calc(text): expects a single string argument"); - return NULL; - } - - CParser parser; - CExpression* expr = parser.ProcessText(txt); - CValue* val = expr->Calculate(); - expr->Release(); - - if (val) { - PyObject* pyobj = val->ConvertValueToPython(); - if (pyobj) - return pyobj; - else - return val->GetProxy(); - } - - Py_RETURN_NONE; -} - - static struct PyMethodDef game_methods[] = { {"expandPath", (PyCFunction)gPyExpandPath, METH_VARARGS, (PY_METHODCHAR)gPyExpandPath_doc}, {"sendMessage", (PyCFunction)gPySendMessage, METH_VARARGS, (PY_METHODCHAR)gPySendMessage_doc}, @@ -553,7 +526,6 @@ static struct PyMethodDef game_methods[] = { {"getAverageFrameRate", (PyCFunction) gPyGetAverageFrameRate, METH_NOARGS, (PY_METHODCHAR)"Gets the estimated average frame rate"}, {"getBlendFileList", (PyCFunction)gPyGetBlendFileList, METH_VARARGS, (PY_METHODCHAR)"Gets a list of blend files in the same directory as the current blend file"}, {"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, (PY_METHODCHAR)"Prints GL Extension Info"}, - {"EvalExpression", (PyCFunction)gEvalExpression, METH_O, (PY_METHODCHAR)"Evaluate a string as a game logic expression"}, {NULL, (PyCFunction) NULL, 0, NULL } }; diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py index 46f00fa7ea6..5d9b17316be 100644 --- a/source/gameengine/PyDoc/GameLogic.py +++ b/source/gameengine/PyDoc/GameLogic.py @@ -448,14 +448,6 @@ def setPhysicsTicRate(ticrate): @type ticrate: float """ -def EvalExpression(text): - """ - Evaluate the string as an expression, similar to the expression controller logic brick. - @param text: The expression to evaluate. - @type text: string - @return: The result of the expression. The type depends on the expression. - """ - #{ Utility functions def getAverageFrameRate(): """