[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25742] trunk/blender/source/blender/ editors/space_text/text_ops.c: Fix #20571: run script operator crashes in 3d view.
Brecht Van Lommel
brecht at blender.org
Tue Jan 5 15:27:14 CET 2010
Revision: 25742
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25742
Author: blendix
Date: 2010-01-05 15:27:13 +0100 (Tue, 05 Jan 2010)
Log Message:
-----------
Fix #20571: run script operator crashes in 3d view.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_text/text_ops.c
Modified: trunk/blender/source/blender/editors/space_text/text_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_ops.c 2010-01-05 14:26:38 UTC (rev 25741)
+++ trunk/blender/source/blender/editors/space_text/text_ops.c 2010-01-05 14:27:13 UTC (rev 25742)
@@ -526,6 +526,11 @@
/******************* run script operator *********************/
+static int run_script_poll(bContext *C)
+{
+ return (CTX_data_edit_text(C) != NULL);
+}
+
static int run_script_exec(bContext *C, wmOperator *op)
{
#ifdef DISABLE_PYTHON
@@ -534,12 +539,13 @@
return OPERATOR_CANCELLED;
#else
Text *text= CTX_data_edit_text(C);
+ SpaceText *st= CTX_wm_space_text(C);
if (BPY_run_python_script(C, NULL, text, op->reports))
return OPERATOR_FINISHED;
/* Dont report error messages while live editing */
- if(!CTX_wm_space_text(C)->live_edit)
+ if(!(st && st->live_edit))
BKE_report(op->reports, RPT_ERROR, "Python script fail, look in the console for now...");
return OPERATOR_CANCELLED;
@@ -554,8 +560,8 @@
ot->description= "Run active script.";
/* api callbacks */
+ ot->poll= run_script_poll;
ot->exec= run_script_exec;
-// ot->poll= text_edit_poll; // dont do this since linked texts cant run
}
More information about the Bf-blender-cvs
mailing list