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.
This commit is contained in:
Clément Foucault 2020-07-20 17:23:18 +02:00
parent 7484e45297
commit 4432209849
Notes: blender-bot 2023-02-14 05:41:57 +01:00
Referenced by issue #78321, Eevee Motion blur crash rendering animation with steps set to higher value
2 changed files with 16 additions and 9 deletions

View File

@ -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);

View File

@ -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 */