diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-20 18:23:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-20 18:23:28 +0300 |
commit | 443220984978bfc982799848762d77bc1d10e8c0 (patch) | |
tree | 971b99619026d94962bb103d1cfebf46cc829f24 /source/blender | |
parent | 7484e4529717a61277525bbb6bc9ac7a747e42f1 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 17 | ||||
-rw-r--r-- | source/blender/render/intern/source/external_engine.c | 8 |
2 files changed, 16 insertions, 9 deletions
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 */ |