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>2010-06-01 12:15:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-06-01 12:15:43 +0400
commited3a7bd299c4b6a0ed2712065be7ca59da9931fe (patch)
treeae6cb5bf7ae0f3e055af57b2dd9198227d5c025b /source/blender/editors/space_script
parentc902eb8d7e6b737f04c9fa0897db8a75af1fd8ec (diff)
script reload (f8), is closer to working.
there are internal memory problems which can make it crash still. If you remove all directories in the scripts folder except for 'modules' and 'ui', it runs without crashes.
Diffstat (limited to 'source/blender/editors/space_script')
-rw-r--r--source/blender/editors/space_script/script_edit.c20
-rw-r--r--source/blender/editors/space_script/script_intern.h1
-rw-r--r--source/blender/editors/space_script/script_ops.c1
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)