Skip to content

Commit d275f3e

Browse files
committed
Update patch
1 parent e00ec38 commit d275f3e

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

patch/compositor_nodes.diff

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,10 +1500,10 @@ index 0000000..234d745
15001500
+#endif
15011501
diff --git a/source/blender/compositor/operations/COM_PythonOperation.cpp b/source/blender/compositor/operations/COM_PythonOperation.cpp
15021502
new file mode 100644
1503-
index 0000000..1d7f6d1
1503+
index 0000000..d36a5d4
15041504
--- /dev/null
15051505
+++ b/source/blender/compositor/operations/COM_PythonOperation.cpp
1506-
@@ -0,0 +1,303 @@
1506+
@@ -0,0 +1,297 @@
15071507
+
15081508
+#include <string>
15091509
+#include <fstream>
@@ -1515,30 +1515,26 @@ index 0000000..1d7f6d1
15151515
+
15161516
+#include "COM_PythonOperation.h"
15171517
+
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()
15271520
+{
1528-
+ if (PyEval_ThreadsInitialized() == 0) {
1529-
+ PyEval_InitThreads();
1530-
+ }
1531-
+
1532-
+ PyGILState_STATE gstate = PyGILState_Ensure();
1533-
+
15341521
+ if (PyArray_API == NULL) {
15351522
+ //This does not seem to be the best way to do this...
15361523
+ 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");
15381528
+ }
15391529
+ }
1530+
+}
15401531
+
1541-
+ PyGILState_Release(gstate);
1532+
+void fatal(const char *message)
1533+
+{
1534+
+ if (PyErr_Occurred()) {
1535+
+ PyErr_Print();
1536+
+ }
1537+
+ Py_FatalError(message);
15421538
+}
15431539
+
15441540
+PythonOperation::PythonOperation() : SingleThreadedOperation()
@@ -1553,8 +1549,6 @@ index 0000000..1d7f6d1
15531549
+ setResolutionInputSocketIndex(0);
15541550
+
15551551
+ m_data = NULL;
1556-
+
1557-
+ initPython();
15581552
+}
15591553
+
15601554
+void PythonOperation::initExecution()
@@ -2213,6 +2207,28 @@ index 0000000..4651303
22132207
+
22142208
+ nodeRegisterType(&ntype);
22152209
+}
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 */
22162232
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
22172233
index e400268..a603cfc 100644
22182234
--- a/source/blender/windowmanager/WM_api.h
@@ -2262,7 +2278,7 @@ index fbd6d89..b1c5445 100644
22622278
/* placed after the version number in the image,
22632279
* placing y is tricky to match baseline */
22642280
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
22662282
--- a/source/blender/windowmanager/intern/wm_window.c
22672283
+++ b/source/blender/windowmanager/intern/wm_window.c
22682284
@@ -45,6 +45,7 @@
@@ -2273,7 +2289,7 @@ index 79078b3..0dfe799 100644
22732289
#include "BLI_utildefines.h"
22742290

22752291
#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)
22772293
return retval;
22782294
}
22792295

@@ -2302,6 +2318,8 @@ index 79078b3..0dfe799 100644
23022318
+
23032319
+int wm_window_process_main_queue_events()
23042320
+{
2321+
+ BLI_assert(BLI_thread_is_main());
2322+
+
23052323
+ int count = 0;
23062324
+
23072325
+ MainThreadWork *work = NULL;

0 commit comments

Comments
 (0)