diff options
Diffstat (limited to 'source/blender/python/intern/bpy_driver.c')
-rw-r--r-- | source/blender/python/intern/bpy_driver.c | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 7effa25e6e8..bd1f3cd301f 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -57,19 +57,12 @@ # include <opcode.h> #endif -/** - * For PyDrivers - * (drivers using one-line Python expressions to express relationships between targets). - */ PyObject *bpy_pydriver_Dict = NULL; #ifdef USE_BYTECODE_WHITELIST static PyObject *bpy_pydriver_Dict__whitelist = NULL; #endif -/* For faster execution we keep a special dictionary for pydrivers, with - * the needed modules and aliases. - */ int bpy_pydriver_create_dict(void) { PyObject *d, *mod; @@ -220,11 +213,6 @@ static void bpy_pydriver_namespace_clear_self(void) } } -/* Update function, it gets rid of pydrivers global dictionary, forcing - * BPY_driver_exec to recreate it. This function is used to force - * reloading the Blender text module "pydrivers.py", if available, so - * updates in it reach pydriver evaluation. - */ void BPY_driver_reset(void) { PyGILState_STATE gilstate; @@ -429,28 +417,24 @@ static void bpy_pydriver_namespace_add_depsgraph(PyObject *driver_vars, } } -/** - * This evaluates Python driver expressions, `driver_orig->expression` - * is a Python expression that should evaluate to a float number, which is returned. - * - * (old) NOTE: PyGILState_Ensure() isn't always called because python can call - * the bake operator which intern starts a thread which calls scene update - * which does a driver update. to avoid a deadlock check #PyC_IsInterpreterActive() - * if #PyGILState_Ensure() is needed, see T27683. - * - * (new) NOTE: checking if python is running is not thread-safe T28114 - * now release the GIL on python operator execution instead, using - * #PyEval_SaveThread() / #PyEval_RestoreThread() so we don't lock up blender. - * - * For copy-on-write we always cache expressions and write errors in the - * original driver, otherwise these would get freed while editing. Due to - * the GIL this is thread-safe. - */ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelDriver *driver_orig, const AnimationEvalContext *anim_eval_context) { + /* (old) NOTE: PyGILState_Ensure() isn't always called because python can call + * the bake operator which intern starts a thread which calls scene update + * which does a driver update. to avoid a deadlock check #PyC_IsInterpreterActive() + * if #PyGILState_Ensure() is needed, see T27683. + * + * (new) NOTE: checking if python is running is not thread-safe T28114 + * now release the GIL on python operator execution instead, using + * #PyEval_SaveThread() / #PyEval_RestoreThread() so we don't lock up blender. + * + * For copy-on-write we always cache expressions and write errors in the + * original driver, otherwise these would get freed while editing. + * Due to the GIL this is thread-safe. */ + PyObject *driver_vars = NULL; PyObject *retval = NULL; |