diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-26 18:30:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-26 18:30:38 +0300 |
commit | 61235fcc8a74283166632150e8b8369089ad4a21 (patch) | |
tree | 6c6117feed08bcad10b36987ad3e95234ea86fa5 /source/blender/python | |
parent | a12315e4ec1bb3d02a7a4d09afc450745a1784f6 (diff) |
fix for 'live edit', running python scripts as you type
- errors would jump to the line which gets in the way.
- the window wouldn't always redraw.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/BPY_extern.h | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index 2abe6044ca3..f4899849702 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -78,7 +78,7 @@ void BPY_python_end( void ); /* 2.5 UI Scripts */ int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports); -int BPY_text_exec(struct bContext *C, struct Text *text, struct ReportList *reports); +int BPY_text_exec(struct bContext *C, struct Text *text, struct ReportList *reports, const short do_jump); 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 void BPY_modules_load_user(struct bContext *C); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 4f59467a9d6..60ada6e983b 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -353,7 +353,7 @@ typedef struct { } PyModuleObject; #endif -static int python_script_exec(bContext *C, const char *fn, struct Text *text, struct ReportList *reports) +static int python_script_exec(bContext *C, const char *fn, struct Text *text, struct ReportList *reports, const short do_jump) { PyObject *main_mod= NULL; PyObject *py_dict= NULL, *py_result= NULL; @@ -382,7 +382,9 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st MEM_freeN( buf ); if(PyErr_Occurred()) { - python_script_error_jump_text(text); + if(do_jump) { + python_script_error_jump_text(text); + } BPY_text_free_code(text); } } @@ -429,7 +431,9 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st if (!py_result) { if(text) { - python_script_error_jump_text(text); + if(do_jump) { + python_script_error_jump_text(text); + } } BPy_errors_to_report(reports); } else { @@ -459,13 +463,13 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text, st /* Can run a file or text block */ int BPY_filepath_exec(bContext *C, const char *filepath, struct ReportList *reports) { - return python_script_exec(C, filepath, NULL, reports); + return python_script_exec(C, filepath, NULL, reports, FALSE); } -int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports) +int BPY_text_exec(bContext *C, struct Text *text, struct ReportList *reports, const short do_jump) { - return python_script_exec(C, NULL, text, reports); + return python_script_exec(C, NULL, text, reports, do_jump); } void BPY_DECREF(void *pyob_ptr) |