Skip to content

Commit

Permalink
lib+blender: Fix status info display in interactive mode
Browse files Browse the repository at this point in the history
Few things were broken with the recent shuffle from ctypes to defining
the type in CPython code.
  • Loading branch information
vkoskiv committed Apr 9, 2024
1 parent 569fbe9 commit 3c2a86d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bindings/blender_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ def draw_direct(bitmap):
def status_update_interactive(cb_info, args):
tag_redraw, update_stats, self = args
tag_redraw()
if info.finished_passes == self.cr_renderer.prefs.samples:
if cb_info.finished_passes == self.cr_renderer.prefs.samples:
update_stats("Rendering done", "")
else:
update_stats("Sample {}".format(info.finished_passes), "")
update_stats("Sample {}".format(cb_info.finished_passes), "")

class CrayRender(bpy.types.RenderEngine):
bl_idname = "C_RAY"
Expand Down
1 change: 1 addition & 0 deletions bindings/cray_wrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ static PyMemberDef CallbackInfo_members[] = {
{ "avg_per_ray", T_DOUBLE, offsetof(CallbackInfoObject, info.avg_per_ray_us), 0, "Microseconds per ray, on average" },
{ "samples_per_sec", T_LONG, offsetof(CallbackInfoObject, info.samples_per_sec), 0, "Samples per second" },
{ "eta_ms", T_LONG, offsetof(CallbackInfoObject, info.eta_ms), 0, "ETA to render finished, in milliseconds" },
{ "finished_passes", T_ULONG, offsetof(CallbackInfoObject, info.finished_passes), 0, "Passes finished in interactive mode" },
{ "completion", T_DOUBLE, offsetof(CallbackInfoObject, info.completion), 0, "Render completion" },
{ "paused", T_INT, offsetof(CallbackInfoObject, info.paused), 0, "Boolean, render paused" },
{ NULL },
Expand Down
2 changes: 2 additions & 0 deletions src/lib/datatypes/tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ struct render_tile *tile_next_interactive(struct renderer *r, struct tile_set *s
tile->index = set->finished++;
} else {
r->state.finishedPasses++;
// FIXME: It's pretty confusing that we're firing this callback here instead of in the
// renderer main loop directly.
struct cr_renderer_cb_info cb_info = { 0 };
cb_info.finished_passes = r->state.finishedPasses - 1;
struct callback cb = r->state.callbacks[cr_cb_on_interactive_pass_finished];
Expand Down

0 comments on commit 3c2a86d

Please sign in to comment.