merged changes to revision 24077

This commit is contained in:
Maxime Curioni
2009-10-25 10:43:03 +00:00
272 changed files with 9515 additions and 6244 deletions

View File

@@ -887,7 +887,7 @@ float BPY_pydriver_eval (ChannelDriver *driver)
int BPY_button_eval(bContext *C, char *expr, double *value)
{
PyGILState_STATE gilstate;
PyObject *dict, *retval;
PyObject *dict, *mod, *retval;
int error_ret = 0;
if (!value || !expr || expr[0]=='\0') return -1;
@@ -895,6 +895,20 @@ int BPY_button_eval(bContext *C, char *expr, double *value)
bpy_context_set(C, &gilstate);
dict= CreateGlobalDictionary(C);
/* import some modules: builtins,math*/
PyDict_SetItemString(dict, "__builtins__", PyEval_GetBuiltins());
mod = PyImport_ImportModule("math");
if (mod) {
PyDict_Merge(dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
/* Only keep for backwards compat! - just import all math into root, they are standard */
PyDict_SetItemString(dict, "math", mod);
PyDict_SetItemString(dict, "m", mod);
Py_DECREF(mod);
}
retval = PyRun_String(expr, Py_eval_input, dict, dict);
if (retval == NULL) {

View File

@@ -1590,7 +1590,7 @@ static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, cons
static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
{
PyObject *item;
PyObject *item = NULL;
int i=0, ok, buffer_is_compat;
void *array= NULL;
@@ -2677,7 +2677,7 @@ PyObject *BPY_rna_props( void )
static StructRNA *pyrna_struct_as_srna(PyObject *self)
{
BPy_StructRNA *py_srna;
BPy_StructRNA *py_srna = NULL;
StructRNA *srna;
/* ack, PyObject_GetAttrString wont look up this types tp_dict first :/ */