diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-03 05:38:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-03 05:43:43 +0300 |
commit | 7ff1750218bf3c2ef4c57f9ea4a12b738f4b7264 (patch) | |
tree | 613c4796c351d6de824bc69716963e21e3817190 /source/blender/python/generic/py_capi_utils.h | |
parent | 4bb8dba340e0ac570f4a4eb628d0be09c92713b7 (diff) |
PyAPI: add optional imports to expression eval API
Avoids having to use `__import__` to access modules.
Diffstat (limited to 'source/blender/python/generic/py_capi_utils.h')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 4c1f14f08da..92964fce9d5 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -77,8 +77,9 @@ const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerc const char * PyC_UnicodeAsByteAndSize(PyObject *py_str, Py_ssize_t *size, PyObject **coerce); /* name namespace function for bpy & bge */ -PyObject * PyC_DefaultNameSpace(const char *filename); -void PyC_RunQuicky(const char *filepath, int n, ...); +PyObject *PyC_DefaultNameSpace(const char *filename); +void PyC_RunQuicky(const char *filepath, int n, ...); +bool PyC_NameSpace_ImportArray(PyObject *py_dict, const char *imports[]); void PyC_MainModule_Backup(PyObject **main_mod); void PyC_MainModule_Restore(PyObject *main_mod); @@ -101,9 +102,9 @@ int PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix); PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag); -bool PyC_RunString_AsNumber(const char *expr, const char *filename, double *r_value); -bool PyC_RunString_AsIntPtr(const char *expr, const char *filename, intptr_t *r_value); -bool PyC_RunString_AsString(const char *expr, const char *filename, char **r_value); +bool PyC_RunString_AsNumber(const char **imports, const char *expr, const char *filename, double *r_value); +bool PyC_RunString_AsIntPtr(const char **imports, const char *expr, const char *filename, intptr_t *r_value); +bool PyC_RunString_AsString(const char **imports, const char *expr, const char *filename, char **r_value); int PyC_ParseBool(PyObject *o, void *p); |