diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-19 14:12:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-19 14:12:48 +0300 |
commit | cadc1218c8c8932464eacf0d6a75330e8ac45266 (patch) | |
tree | 41761e87faedb7bcd1d0c86237df690ff4f3b5af /source/blender/python/intern/bpy_driver.c | |
parent | ff1656175ac6a408bef1b77abd91406cdf895c93 (diff) |
C, style changes (mostly white space edits), no functional change.
Diffstat (limited to 'source/blender/python/intern/bpy_driver.c')
-rw-r--r-- | source/blender/python/intern/bpy_driver.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 0445298649f..27260aed8d2 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -42,7 +42,7 @@ #include "bpy_driver.h" /* for pydrivers (drivers using one-line Python expressions to express relationships between targets) */ -PyObject *bpy_pydriver_Dict = NULL; +PyObject *bpy_pydriver_Dict= NULL; /* For faster execution we keep a special dictionary for pydrivers, with * the needed modules and aliases. @@ -54,16 +54,16 @@ int bpy_pydriver_create_dict(void) /* validate namespace for driver evaluation */ if (bpy_pydriver_Dict) return -1; - d = PyDict_New(); + d= PyDict_New(); if (d == NULL) return -1; else - bpy_pydriver_Dict = d; + bpy_pydriver_Dict= d; /* import some modules: builtins, bpy, math, (Blender.noise )*/ PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins()); - mod = PyImport_ImportModule("math"); + mod= PyImport_ImportModule("math"); if (mod) { PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */ Py_DECREF(mod); @@ -90,12 +90,12 @@ void BPY_driver_reset(void) int use_gil= 1; // (PyThreadState_Get()==NULL); if(use_gil) - gilstate = PyGILState_Ensure(); + gilstate= PyGILState_Ensure(); if (bpy_pydriver_Dict) { /* free the global dict used by pydrivers */ PyDict_Clear(bpy_pydriver_Dict); Py_DECREF(bpy_pydriver_Dict); - bpy_pydriver_Dict = NULL; + bpy_pydriver_Dict= NULL; } if(use_gil) @@ -132,13 +132,13 @@ float BPY_driver_exec(ChannelDriver *driver) int use_gil; DriverVar *dvar; - double result = 0.0; /* default return */ - char *expr = NULL; + double result= 0.0; /* default return */ + char *expr= NULL; short targets_ok= 1; int i; /* get the py expression to be evaluated */ - expr = driver->expression; + expr= driver->expression; if ((expr == NULL) || (expr[0]=='\0')) return 0.0f; @@ -150,7 +150,7 @@ float BPY_driver_exec(ChannelDriver *driver) use_gil= 1; //(PyThreadState_Get()==NULL); if(use_gil) - gilstate = PyGILState_Ensure(); + gilstate= PyGILState_Ensure(); /* init global dictionary for py-driver evaluation settings */ if (!bpy_pydriver_Dict) { @@ -200,10 +200,10 @@ float BPY_driver_exec(ChannelDriver *driver) } /* add target values to a dict that will be used as '__locals__' dict */ - driver_vars = PyDict_New(); // XXX do we need to decref this? + driver_vars= PyDict_New(); // XXX do we need to decref this? for (dvar= driver->variables.first, i=0; dvar; dvar= dvar->next) { - PyObject *driver_arg = NULL; - float tval = 0.0f; + PyObject *driver_arg= NULL; + float tval= 0.0f; /* try to get variable value */ tval= driver_get_variable_value(driver, dvar); @@ -228,7 +228,7 @@ float BPY_driver_exec(ChannelDriver *driver) #if 0 // slow, with this can avoid all Py_CompileString above. /* execute expression to get a value */ - retval = PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars); + retval= PyRun_String(expr, Py_eval_input, bpy_pydriver_Dict, driver_vars); #else /* evaluate the compiled expression */ if (expr_code) @@ -241,10 +241,11 @@ float BPY_driver_exec(ChannelDriver *driver) /* process the result */ if (retval == NULL) { pydriver_error(driver); - } else if((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) { + } + else if((result= PyFloat_AsDouble(retval)) == -1.0 && PyErr_Occurred()) { pydriver_error(driver); Py_DECREF(retval); - result = 0.0; + result= 0.0; } else { /* all fine, make sure the "invalid expression" flag is cleared */ |