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-03-04 16:26:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-03-04 16:26:33 +0300
commit36c3ed2350bb504b1b0a7a378d2d40a73bc3a769 (patch)
treef50dde4d57eb7ebbbb4b041e5930b55ca3be2ce9 /source/blender/editors
parent7d5ef14d5fa7301778ae9f0d80b68a04107e4ef2 (diff)
run script in the text editor is back. UI scripts dont work yet.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_script/script_edit.c2
-rw-r--r--source/blender/editors/space_script/space_script.c4
-rw-r--r--source/blender/editors/space_text/text_ops.c36
3 files changed, 15 insertions, 27 deletions
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 1194d4b254c..da53057c5eb 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -66,7 +66,7 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
char filename[512];
RNA_string_get(op->ptr, "filename", filename);
#ifndef DISABLE_PYTHON
- BPY_run_python_script(C, filename);
+ BPY_run_python_script(C, filename, NULL);
#endif
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index 8fedcd8761f..054033fd987 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -155,10 +155,10 @@ static void script_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(C, v2d);
/* data... */
- // BPY_run_python_script(C, "/root/blender-svn/blender25/test.py");
+ // BPY_run_python_script(C, "/root/blender-svn/blender25/test.py", NULL);
if (sscript->script) {
- //BPY_run_python_script_space(scpt->script.filename);
+ //BPY_run_python_script_space(scpt->script.filename, NULL);
BPY_run_script_space_draw(C, sscript);
}
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 6e7a507b35b..a77bea4c640 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -78,6 +78,11 @@ static int text_new_poll(bContext *C)
return 1;
}
+static int text_valid_poll(bContext *C)
+{
+ return CTX_data_edit_text(C) ? 1:0;
+}
+
static int text_edit_poll(bContext *C)
{
Text *text= CTX_data_edit_text(C);
@@ -435,31 +440,12 @@ static int run_script_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
#else
Text *text= CTX_data_edit_text(C);
- char *py_filename;
-
- if(0) { // XXX !BPY_txt_do_python_Text(text)) {
- int lineno = 0; // XXX BPY_Err_getLinenumber();
- // jump to error if happened in current text:
- py_filename = (char*) NULL; // XXX BPY_Err_getFilename();
- /* st->text can become NULL: user called Blender.Load(blendfile)
- * before the end of the script. */
- text= CTX_data_edit_text(C);
-
- if(!strcmp(py_filename, text->id.name+2)) {
- // XXX error_pyscript( );
- if(lineno >= 0) {
- txt_move_toline(text, lineno-1, 0);
- txt_sel_line(text);
-
- WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
- }
- }
- else
- BKE_report(op->reports, RPT_ERROR, "Error in other (possibly external) file, check console.");
- }
-
- return OPERATOR_FINISHED;
+ if (BPY_run_python_script( C, NULL, text ))
+ return OPERATOR_FINISHED;
+
+ BKE_report(op->reports, RPT_ERROR, "Python script fail, look in the console for now...");
+ return OPERATOR_CANCELLED;
#endif
}
@@ -474,6 +460,7 @@ void TEXT_OT_run_script(wmOperatorType *ot)
ot->poll= text_edit_poll;
}
+
/******************* refresh pyconstraints operator *********************/
static int refresh_pyconstraints_exec(bContext *C, wmOperator *op)
@@ -2541,6 +2528,7 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "split_lines", 0, "Split Lines", "Create one object per line in the text.");
}
+
/************************ undo ******************************/
void ED_text_undo_step(bContext *C, int step)