diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-23 10:58:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-23 10:58:02 +0400 |
commit | 1ed95e0450d9d7e5a98141b209640ffd0283ab9d (patch) | |
tree | 0431979195c7cd2ce86dc9b28e3038311d7b3556 /source/blender/editors/space_script/script_edit.c | |
parent | d00c3ef2d6339aa01ddbc56bacd20f1ef4473a27 (diff) |
F8Key reloads all python scripts and redraws for quick testing
F7 runs test.py also for testing
Diffstat (limited to 'source/blender/editors/space_script/script_edit.c')
-rw-r--r-- | source/blender/editors/space_script/script_edit.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index cc8764fd67d..797302a8652 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -86,3 +86,33 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot) RNA_def_string_file_path(ot->srna, "filename", "", 512, "Filename", ""); } +static int run_ui_scripts_exec(bContext *C, wmOperator *op) +{ +#ifndef DISABLE_PYTHON + BPY_run_ui_scripts(C, 1); /* reload */ +#endif + return OPERATOR_FINISHED; +} + +static int run_ui_scripts_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + int ret= run_ui_scripts_exec(C, op); + + if(ret==OPERATOR_FINISHED) + WM_event_add_notifier(C, NC_WINDOW, NULL); + + return ret; +} + + +void SCRIPT_OT_python_run_ui_scripts(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Reload Python Interface"; + ot->idname= "SCRIPT_OT_python_run_ui_scripts"; + + /* api callbacks */ + ot->exec= run_ui_scripts_exec; + ot->invoke= run_ui_scripts_invoke; + ot->poll= ED_operator_areaactive; +} |