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>2009-04-23 10:58:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-23 10:58:02 +0400
commit1ed95e0450d9d7e5a98141b209640ffd0283ab9d (patch)
tree0431979195c7cd2ce86dc9b28e3038311d7b3556 /source/blender/editors/space_script
parentd00c3ef2d6339aa01ddbc56bacd20f1ef4473a27 (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')
-rw-r--r--source/blender/editors/space_script/script_edit.c30
-rw-r--r--source/blender/editors/space_script/script_intern.h1
-rw-r--r--source/blender/editors/space_script/script_ops.c2
3 files changed, 33 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;
+}
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index e39dd168e71..59858ee6289 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -40,6 +40,7 @@ void script_keymap(struct wmWindowManager *wm);
/* script_edit.c */
void SCRIPT_OT_python_file_run(struct wmOperatorType *ot);
+void SCRIPT_OT_python_run_ui_scripts(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 25aea4a8d65..aa35ba54b7f 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -60,6 +60,7 @@
void script_operatortypes(void)
{
WM_operatortype_append(SCRIPT_OT_python_file_run);
+ WM_operatortype_append(SCRIPT_OT_python_run_ui_scripts);
}
void script_keymap(wmWindowManager *wm)
@@ -68,5 +69,6 @@ void script_keymap(wmWindowManager *wm)
/* TODO - this is just while we have no way to load a text datablock */
RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "filename", "test.py");
+ WM_keymap_add_item(keymap, "SCRIPT_OT_python_run_ui_scripts", PKEY, KM_PRESS, KM_SHIFT, 0);
}