forked from bartvdbraak/blender
removing GameLogic.EvalExpression(),
unlikely anyone will miss it, was only accessible in 2.49, invalid expressions would crash, valid ones leak memory.
This commit is contained in:
parent
9dff2ad3d0
commit
33e2d118bc
@ -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 }
|
||||
};
|
||||
|
||||
|
@ -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():
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user