fix(@projects/@magic-civilization): 🐛 adjust frame timing for viewport texture capture
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
45d2f963ad
commit
2c1212c4e7
1 changed files with 6 additions and 2 deletions
|
|
@ -228,9 +228,13 @@ func _capture_step(label: String, mode: String, focus: Vector2i = Vector2i.ZERO)
|
|||
_focus_camera(focus, 5.0 * 384.0)
|
||||
else:
|
||||
_setup_camera_fit()
|
||||
# Multiple frames so the canvas items finish redraw + camera resolves.
|
||||
for _i: int in range(8):
|
||||
# Wait two real frames-rendered to flush the GPU composite. process_frame
|
||||
# fires before draw; frame_post_draw fires AFTER GPU composite, which is
|
||||
# what `get_viewport().get_texture()` actually reads.
|
||||
for _i: int in range(3):
|
||||
await get_tree().process_frame
|
||||
for _j: int in range(2):
|
||||
await RenderingServer.frame_post_draw
|
||||
var image: Image = get_viewport().get_texture().get_image()
|
||||
if image == null:
|
||||
push_error("gameplay_arc: viewport image null at %s" % label)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue