Merge branch 'master' into blender2.8
This commit is contained in:
@@ -80,8 +80,8 @@ bool BPY_execute_string_as_number(struct bContext *C, const char *imports[], con
|
||||
bool BPY_execute_string_as_intptr(struct bContext *C, const char *imports[], const char *expr, const bool verbose, intptr_t *r_value);
|
||||
bool BPY_execute_string_as_string(struct bContext *C, const char *imports[], const char *expr, const bool verbose, char **r_value);
|
||||
|
||||
bool BPY_execute_string_ex(struct bContext *C, const char *expr, bool use_eval);
|
||||
bool BPY_execute_string(struct bContext *C, const char *expr);
|
||||
bool BPY_execute_string_ex(struct bContext *C, const char *imports[], const char *expr, bool use_eval);
|
||||
bool BPY_execute_string(struct bContext *C, const char *imports[], const char *expr);
|
||||
|
||||
void BPY_text_free_code(struct Text *text);
|
||||
void BPY_modules_update(struct bContext *C); // XXX - annoying, need this for pointers that get out of date
|
||||
|
@@ -693,7 +693,9 @@ bool BPY_execute_string_as_intptr(
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
|
||||
bool BPY_execute_string_ex(
|
||||
bContext *C, const char *imports[],
|
||||
const char *expr, bool use_eval)
|
||||
{
|
||||
BLI_assert(expr);
|
||||
PyGILState_STATE gilstate;
|
||||
@@ -715,13 +717,18 @@ bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
|
||||
bmain_back = bpy_import_main_get();
|
||||
bpy_import_main_set(CTX_data_main(C));
|
||||
|
||||
retval = PyRun_String(expr, use_eval ? Py_eval_input : Py_file_input, py_dict, py_dict);
|
||||
if (imports && (!PyC_NameSpace_ImportArray(py_dict, imports))) {
|
||||
Py_DECREF(py_dict);
|
||||
retval = NULL;
|
||||
}
|
||||
else {
|
||||
retval = PyRun_String(expr, use_eval ? Py_eval_input : Py_file_input, py_dict, py_dict);
|
||||
}
|
||||
|
||||
bpy_import_main_set(bmain_back);
|
||||
|
||||
if (retval == NULL) {
|
||||
ok = false;
|
||||
|
||||
BPy_errors_to_report(CTX_wm_reports(C));
|
||||
}
|
||||
else {
|
||||
@@ -735,9 +742,11 @@ bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool BPY_execute_string(bContext *C, const char *expr)
|
||||
bool BPY_execute_string(
|
||||
bContext *C, const char *imports[],
|
||||
const char *expr)
|
||||
{
|
||||
return BPY_execute_string_ex(C, expr, true);
|
||||
return BPY_execute_string_ex(C, imports, expr, true);
|
||||
}
|
||||
|
||||
void BPY_modules_load_user(bContext *C)
|
||||
|
Reference in New Issue
Block a user