diff options
Diffstat (limited to 'source/blender/editors/space_script')
-rw-r--r-- | source/blender/editors/space_script/script_edit.c | 20 | ||||
-rw-r--r-- | source/blender/editors/space_script/script_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_script/script_ops.c | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c index 6ef9a96b478..02993549c94 100644 --- a/source/blender/editors/space_script/script_edit.c +++ b/source/blender/editors/space_script/script_edit.c @@ -84,3 +84,23 @@ void SCRIPT_OT_python_file_run(wmOperatorType *ot) RNA_def_string_file_path(ot->srna, "path", "", 512, "Path", ""); } + +static int script_reload_exec(bContext *C, wmOperator *op) +{ +#ifndef DISABLE_PYTHON + BPY_eval_string(C, "__import__('bpy').utils.load_scripts(reload_scripts=True)"); + return OPERATOR_FINISHED; +#endif + return OPERATOR_CANCELLED; +} + +void SCRIPT_OT_reload(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Reload Scripts"; + ot->description= "Reload Scripts"; + ot->idname= "SCRIPT_OT_reload"; + + /* api callbacks */ + ot->exec= script_reload_exec; +} diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h index 57e4cc6c793..ed625bb8ec6 100644 --- a/source/blender/editors/space_script/script_intern.h +++ b/source/blender/editors/space_script/script_intern.h @@ -39,6 +39,7 @@ void script_operatortypes(void); void script_keymap(struct wmKeyConfig *keyconf); /* script_edit.c */ +void SCRIPT_OT_reload(struct wmOperatorType *ot); void SCRIPT_OT_python_file_run(struct wmOperatorType *ot); #endif /* ED_SCRIPT_INTERN_H */ diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c index 353d80f1921..61f7cf425d4 100644 --- a/source/blender/editors/space_script/script_ops.c +++ b/source/blender/editors/space_script/script_ops.c @@ -55,6 +55,7 @@ void script_operatortypes(void) { WM_operatortype_append(SCRIPT_OT_python_file_run); + WM_operatortype_append(SCRIPT_OT_reload); } void script_keymap(wmKeyConfig *keyconf) |