From c8e19a6b25f4b32ef64ba23479d80febc7c95db9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 4 Jun 2008 22:32:15 +0000 Subject: [PATCH] numbutton python expression evaluation used driver dictionary, when EnableScriptlinks was disabled number button input didnt work. narrow down this test to the part of the pydriver module init that uses a blender textblock as a module. This should should reload the pydriver dict whenever the "EnableScriptlinks" state changes. but for now working numbuttons is priority. --- source/blender/python/BPY_interface.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index c63fa28c46e..7c23c86d9ba 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -1222,7 +1222,7 @@ static int bpy_pydriver_create_dict(void) { PyObject *d, *mod; - if (bpy_pydriver_Dict || (G.f&G_DOSCRIPTLINKS)==0) return -1; + if (bpy_pydriver_Dict) return -1; d = PyDict_New(); if (!d) return -1; @@ -1259,15 +1259,16 @@ static int bpy_pydriver_create_dict(void) /* If there's a Blender text called pydrivers.py, import it. * Users can add their own functions to this module. */ - mod = importText("pydrivers"); /* can also use PyImport_Import() */ - if (mod) { - PyDict_SetItemString(d, "pydrivers", mod); - PyDict_SetItemString(d, "p", mod); - Py_DECREF(mod); + if (G.f&G_DOSCRIPTLINKS) { + mod = importText("pydrivers"); /* can also use PyImport_Import() */ + if (mod) { + PyDict_SetItemString(d, "pydrivers", mod); + PyDict_SetItemString(d, "p", mod); + Py_DECREF(mod); + } else { + PyErr_Clear(); + } } - else - PyErr_Clear(); - /* short aliases for some Get() functions: */ /* ob(obname) == Blender.Object.Get(obname) */