[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27175] trunk/blender/source/blender/ python/intern/bpy_interface.c: bugfix [#21247] Controls holding numbers are not zeroed when empty string value is given to them
Campbell Barton
ideasman42 at gmail.com
Sat Feb 27 23:53:37 CET 2010
Revision: 27175
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27175
Author: campbellbarton
Date: 2010-02-27 23:53:37 +0100 (Sat, 27 Feb 2010)
Log Message:
-----------
bugfix [#21247] Controls holding numbers are not zeroed when empty string value is given to them
- dont import math as math and m, just import all members directly. (from math import *)
- was adding __builtins__ twice to the namespace
- account for unlikely but possibly failier to import math.
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_interface.c
Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c 2010-02-27 22:36:37 UTC (rev 27174)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c 2010-02-27 22:53:37 UTC (rev 27175)
@@ -557,24 +557,26 @@
PyObject *dict, *mod, *retval;
int error_ret = 0;
- if (!value || !expr || expr[0]=='\0') return -1;
-
+ if (!value || !expr) return -1;
+
+ if(expr[0]=='\0') {
+ *value= 0.0;
+ return error_ret;
+ }
+
bpy_context_set(C, &gilstate);
dict= CreateGlobalDictionary(C, NULL);
-
- /* 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);
- }
+ }
+ else { /* highly unlikely but possibly */
+ PyErr_Print();
+ PyErr_Clear();
+ }
retval = PyRun_String(expr, Py_eval_input, dict, dict);
More information about the Bf-blender-cvs
mailing list