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:
Diffstat (limited to 'source/blender/freestyle/intern/system/PythonInterpreter.h')
-rw-r--r--source/blender/freestyle/intern/system/PythonInterpreter.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index 60193590944..ddb79b2df0b 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -51,6 +51,8 @@ extern "C" {
#include "BKE_text.h"
#include "BPY_extern.h"
+
+#include "bpy_util.h"
}
namespace Freestyle {
@@ -105,6 +107,26 @@ public:
return 0;
}
+ int interpretString(const string& str, const string& name)
+ {
+ ReportList *reports = CTX_wm_reports(_context);
+
+ BKE_reports_clear(reports);
+
+ if (BPY_string_exec(_context, str.c_str()) != 0) {
+ BPy_errors_to_report(reports);
+ cerr << "\nError executing Python script from PythonInterpreter::interpretString" << endl;
+ cerr << "Name: " << name << endl;
+ cerr << "Errors: " << endl;
+ BKE_reports_print(reports, RPT_ERROR);
+ return 1;
+ }
+
+ BKE_reports_clear(reports);
+
+ return 0;
+ }
+
int interpretText(struct Text *text, const string& name)
{
ReportList *reports = CTX_wm_reports(_context);