[Bf-blender-cvs] [44322098497] master: Fix T78321 Eevee: Motion blur crash rendering animation with high steps count

Clément Foucault noreply at git.blender.org
Mon Jul 20 17:23:35 CEST 2020


Commit: 443220984978bfc982799848762d77bc1d10e8c0
Author: Clément Foucault
Date:   Mon Jul 20 17:23:18 2020 +0200
Branches: master
https://developer.blender.org/rB443220984978bfc982799848762d77bc1d10e8c0

Fix T78321 Eevee: Motion blur crash rendering animation with high steps count

This was caused by `BPy_*_ALLOW_THREADS` being used when it shouldn't.

Implemented the simple fix suggested by @brecht :

> The simplest solution may be to ensure that Python stuff is only done
> when called through the RNA API, and not when Eevee calls it directly.

===================================================================

M	source/blender/makesrna/intern/rna_render.c
M	source/blender/render/intern/source/external_engine.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index a41abb1a1dd..ab8fc8936c0 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -27,6 +27,8 @@
 #include "BLI_path_util.h"
 #include "BLI_utildefines.h"
 
+#include "BPY_extern.h"
+
 #include "DEG_depsgraph.h"
 
 #include "BKE_image.h"
@@ -408,6 +410,19 @@ static PointerRNA rna_RenderEngine_camera_override_get(PointerRNA *ptr)
   }
 }
 
+static void rna_RenderEngine_engine_frame_set(RenderEngine *engine, int frame, float subframe)
+{
+#  ifdef WITH_PYTHON
+  BPy_BEGIN_ALLOW_THREADS;
+#  endif
+
+  RE_engine_frame_set(engine, frame, subframe);
+
+#  ifdef WITH_PYTHON
+  BPy_END_ALLOW_THREADS;
+#  endif
+}
+
 static void rna_RenderResult_views_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
   RenderResult *rr = (RenderResult *)ptr->data;
@@ -673,7 +688,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
   parm = RNA_def_string(func, "info", NULL, 0, "Info", "");
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
 
-  func = RNA_def_function(srna, "frame_set", "RE_engine_frame_set");
+  func = RNA_def_function(srna, "frame_set", "rna_RenderEngine_engine_frame_set");
   RNA_def_function_ui_description(func, "Evaluate scene at a different frame (for motion blur)");
   parm = RNA_def_int(func, "frame", 0, INT_MIN, INT_MAX, "Frame", "", INT_MIN, INT_MAX);
   RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 5391775cab8..e1fbf6d19de 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -624,10 +624,6 @@ void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
     return;
   }
 
-#ifdef WITH_PYTHON
-  BPy_BEGIN_ALLOW_THREADS;
-#endif
-
   Render *re = engine->re;
   double cfra = (double)frame + (double)subframe;
 
@@ -636,10 +632,6 @@ void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
   BKE_scene_graph_update_for_newframe(engine->depsgraph, re->main);
 
   BKE_scene_camera_switch_update(re->scene);
-
-#ifdef WITH_PYTHON
-  BPy_END_ALLOW_THREADS;
-#endif
 }
 
 /* Bake */



More information about the Bf-blender-cvs mailing list