Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-11-10 02:55:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-10 02:55:04 +0300
commit7efac2b0b09d9e76d9fc573ec7936a1c6440c067 (patch)
treef91a08c48c44f16879980c2803f63fd035bb8144 /source/creator
parent65e9388440a5d81811226760f61bdbca62a11396 (diff)
PyAPI: add imports arg to BPY_execute_string
Allows for avoiding `__import__` in expressions, was already supported for BPY_execute_string_as_* API calls.
Diffstat (limited to 'source/creator')
-rw-r--r--source/creator/creator_args.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index f8fe57b05a2..74bcc129f20 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -1815,7 +1815,7 @@ static int arg_handle_python_expr_run(int argc, const char **argv, void *data)
/* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
if (argc > 1) {
bool ok;
- BPY_CTX_SETUP(ok = BPY_execute_string_ex(C, argv[1], false));
+ BPY_CTX_SETUP(ok = BPY_execute_string_ex(C, NULL, argv[1], false));
if (!ok && app_state.exit_code_on_error.python) {
printf("\nError: script failed, expr: '%s', exiting.\n", argv[1]);
exit(app_state.exit_code_on_error.python);
@@ -1841,7 +1841,7 @@ static int arg_handle_python_console_run(int UNUSED(argc), const char **argv, vo
#ifdef WITH_PYTHON
bContext *C = data;
- BPY_CTX_SETUP(BPY_execute_string(C, "__import__('code').interact()"));
+ BPY_CTX_SETUP(BPY_execute_string(C, (const char *[]){"code", NULL}, "code.interact()"));
return 0;
#else
@@ -1897,7 +1897,7 @@ static int arg_handle_addons_set(int argc, const char **argv, void *data)
BLI_snprintf(str, slen, script_str, argv[1]);
BLI_assert(strlen(str) + 1 == slen);
- BPY_CTX_SETUP(BPY_execute_string_ex(C, str, false));
+ BPY_CTX_SETUP(BPY_execute_string_ex(C, NULL, str, false));
free(str);
#else
UNUSED_VARS(argv, data);