Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] viewport screen capture doesn't work #8371

Closed
nunodonato opened this issue Apr 12, 2017 · 3 comments
Closed

[3.0] viewport screen capture doesn't work #8371

nunodonato opened this issue Apr 12, 2017 · 3 comments

Comments

@nunodonato
Copy link
Contributor

nunodonato commented Apr 12, 2017

Operating system or device - Godot version: Linux, Godot 3.0 (master)

Issue description:
Getting a screen capture from any viewport results in empty data.

Steps to reproduce:

get_viewport().queue_screen_capture()
yield(get_tree(),"idle_frame")
yield(get_tree(),"idle_frame")
var i = get_viewport().get_screen_capture()
i.save_png("user://cap.png")
@germanalen
Copy link

Now queue_screen_capture() and get_screen_capture() don't even exist.

@MarianoGnu
Copy link
Contributor

Haven't tryed from gdscript, but you should be able to call 'viewport.get_texture().get_data()' to get a reference to Image wich you can save. Also calling 'image.lock()' and image.unlock()' should let you get (and maybe set?) pixels.

This is how it works for color picker when picking a color from the screen:
https://github.com/godotengine/godot/blob/master/scene/gui/color_picker.cpp#L428

@vnen
Copy link
Member

vnen commented Jul 13, 2017

@MarianoGnu you are correct, the issue is only that ViewportTexture::get_data() is not bound to GDScript, but that should be easy to solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants