mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix: Python render_stats handler used for preview renders
Making it working not only in background mode is useful, but for the
typical uses cases having it run for every preview render gets in the way.
Additionally it was missing from image_renderinfo_cb for interactive
renders.
This issue was introduced in c065cc4660.
Pull Request: https://projects.blender.org/blender/blender/pulls/159872
This commit is contained in:
parent
c6d3cbd156
commit
f7aeda7c0f
2 changed files with 8 additions and 2 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
|
||||
#include "BKE_callbacks.hh"
|
||||
#include "BKE_colortools.hh"
|
||||
#include "BKE_compositor.hh"
|
||||
#include "BKE_context.hh"
|
||||
|
|
@ -528,6 +529,8 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs)
|
|||
|
||||
RE_ReleaseResult(rj->re);
|
||||
|
||||
BKE_callback_exec_string(G_MAIN, rs->infostr, BKE_CB_EVT_RENDER_STATS);
|
||||
|
||||
/* make jobs timer to send notifier */
|
||||
*(rj->do_update) = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,12 +190,14 @@ static bool default_break(void * /*arg*/)
|
|||
return G.is_break == true;
|
||||
}
|
||||
|
||||
static void stats_update(void * /*arg*/, RenderStats *rs)
|
||||
static void stats_update(void *arg, RenderStats *rs)
|
||||
{
|
||||
if (rs->infostr == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
Render *re = static_cast<Render *>(arg);
|
||||
|
||||
/* Compositor calls this from multiple threads, mutex lock to ensure we don't
|
||||
* get garbled output. */
|
||||
static Mutex mutex;
|
||||
|
|
@ -212,7 +214,7 @@ static void stats_update(void * /*arg*/, RenderStats *rs)
|
|||
|
||||
/* NOTE: using G_MAIN seems valid here???
|
||||
* Not sure it's actually even used anyway, we could as well pass nullptr? */
|
||||
BKE_callback_exec_string(G_MAIN, rs->infostr, BKE_CB_EVT_RENDER_STATS);
|
||||
render_callback_exec_string(re, G_MAIN, BKE_CB_EVT_RENDER_STATS, rs->infostr);
|
||||
|
||||
if (show_info) {
|
||||
fflush(stdout);
|
||||
|
|
@ -944,6 +946,7 @@ void RE_display_init(Render *re)
|
|||
re->display->progress_cb = float_nothing;
|
||||
re->display->test_break_cb = default_break;
|
||||
re->display->stats_draw_cb = stats_update;
|
||||
re->display->sdh = re;
|
||||
}
|
||||
|
||||
void RE_display_ensure_gpu_context(Render *re)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue