Updating viewport from script

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SIsilicon

Is it possible to call some sort of function to update the viewport in script. I am attempting to update a viewport in like a loop. Ping-ponging if you will. Something like-

func ping_pong_textures(first_viewport, second_viewport):
    for i in range(3):
    return first_viewport.get_texture()

And since this question is about Godot 3, screen_capture function is deprecated(which also means the document needs updating).

:bust_in_silhouette: Reply From: funabab

One way i currently think is worth trying is to set the viewport update_mode to “always” and then in your loop you wait for next frame

yield(get_tree(), "next_frame")

Ok I will look into that. Thanks.

SIsilicon | 2018-04-27 21:37