@@ -1500,10 +1500,10 @@ index 0000000..234d745
1500
1500
+ #endif
1501
1501
diff --git a/source/blender/compositor/operations/COM_PythonOperation.cpp b/source/blender/compositor/operations/COM_PythonOperation.cpp
1502
1502
new file mode 100644
1503
- index 0000000..1d7f6d1
1503
+ index 0000000..d36a5d4
1504
1504
--- /dev/null
1505
1505
+++ b/source/blender/compositor/operations/COM_PythonOperation.cpp
1506
- @@ -0,0 +1,303 @@
1506
+ @@ -0,0 +1,297 @@
1507
1507
+
1508
1508
+ #include <string>
1509
1509
+ #include <fstream>
@@ -1515,30 +1515,26 @@ index 0000000..1d7f6d1
1515
1515
+
1516
1516
+ #include "COM_PythonOperation.h"
1517
1517
+
1518
- + void fatal(const char *message)
1519
- + {
1520
- + if (PyErr_Occurred()) {
1521
- + PyErr_Print();
1522
- + }
1523
- + Py_FatalError(message);
1524
- + }
1525
- +
1526
- + void initPython()
1518
+ + extern "C"
1519
+ + void initCompositorPython()
1527
1520
+ {
1528
- + if (PyEval_ThreadsInitialized() == 0) {
1529
- + PyEval_InitThreads();
1530
- + }
1531
- +
1532
- + PyGILState_STATE gstate = PyGILState_Ensure();
1533
- +
1534
1521
+ if (PyArray_API == NULL) {
1535
1522
+ //This does not seem to be the best way to do this...
1536
1523
+ if (_import_array() < 0) {
1537
- + fatal("Can't import numpy array");
1524
+ + if (PyErr_Occurred()) {
1525
+ + PyErr_Print();
1526
+ + }
1527
+ + Py_FatalError("Can't import numpy array");
1538
1528
+ }
1539
1529
+ }
1530
+ + }
1540
1531
+
1541
- + PyGILState_Release(gstate);
1532
+ + void fatal(const char *message)
1533
+ + {
1534
+ + if (PyErr_Occurred()) {
1535
+ + PyErr_Print();
1536
+ + }
1537
+ + Py_FatalError(message);
1542
1538
+ }
1543
1539
+
1544
1540
+ PythonOperation::PythonOperation() : SingleThreadedOperation()
@@ -1553,8 +1549,6 @@ index 0000000..1d7f6d1
1553
1549
+ setResolutionInputSocketIndex(0);
1554
1550
+
1555
1551
+ m_data = NULL;
1556
- +
1557
- + initPython();
1558
1552
+ }
1559
1553
+
1560
1554
+ void PythonOperation::initExecution()
@@ -2213,6 +2207,28 @@ index 0000000..4651303
2213
2207
+
2214
2208
+ nodeRegisterType(&ntype);
2215
2209
+ }
2210
+ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
2211
+ index 20cfd36..0e10e21 100644
2212
+ --- a/source/blender/python/intern/bpy_interface.c
2213
+ +++ b/source/blender/python/intern/bpy_interface.c
2214
+ @@ -231,6 +231,8 @@ static struct _inittab bpy_internal_modules[] = {
2215
+ {NULL, NULL}
2216
+ };
2217
+
2218
+ + int initCompositorPython();
2219
+ +
2220
+ /* call BPY_context_set first */
2221
+ void BPY_python_start(int argc, const char **argv)
2222
+ {
2223
+ @@ -326,6 +328,8 @@ void BPY_python_start(int argc, const char **argv)
2224
+
2225
+ pyrna_alloc_types();
2226
+
2227
+ + initCompositorPython();
2228
+ +
2229
+ #ifndef WITH_PYTHON_MODULE
2230
+ /* py module runs atexit when bpy is freed */
2231
+ BPY_atexit_register(); /* this can init any time */
2216
2232
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
2217
2233
index e400268..a603cfc 100644
2218
2234
--- a/source/blender/windowmanager/WM_api.h
@@ -2262,7 +2278,7 @@ index fbd6d89..b1c5445 100644
2262
2278
/* placed after the version number in the image,
2263
2279
* placing y is tricky to match baseline */
2264
2280
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
2265
- index 79078b3..0dfe799 100644
2281
+ index 79078b3..61f0531 100644
2266
2282
--- a/source/blender/windowmanager/intern/wm_window.c
2267
2283
+++ b/source/blender/windowmanager/intern/wm_window.c
2268
2284
@@ -45,6 +45,7 @@
@@ -2273,7 +2289,7 @@ index 79078b3..0dfe799 100644
2273
2289
#include "BLI_utildefines.h"
2274
2290
2275
2291
#include "BLT_translation.h"
2276
- @@ -1355,12 +1356,52 @@ static int wm_window_timer(const bContext *C)
2292
+ @@ -1355,12 +1356,54 @@ static int wm_window_timer(const bContext *C)
2277
2293
return retval;
2278
2294
}
2279
2295
@@ -2302,6 +2318,8 @@ index 79078b3..0dfe799 100644
2302
2318
+
2303
2319
+ int wm_window_process_main_queue_events()
2304
2320
+ {
2321
+ + BLI_assert(BLI_thread_is_main());
2322
+ +
2305
2323
+ int count = 0;
2306
2324
+
2307
2325
+ MainThreadWork *work = NULL;
0 commit comments