Place the viewer and editor in separate windows
This commit is contained in:
parent
f069f2911f
commit
57328bc9a3
8 changed files with 72 additions and 110 deletions
27
src/Main.gd
27
src/Main.gd
|
@ -1,22 +1,11 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var image_viewport = %ImageViewport
|
||||
@onready var ui_control_filesave = %SaveImageDialog
|
||||
extends Node
|
||||
|
||||
@onready var editor_window = %EditorWindow
|
||||
|
||||
func _ready():
|
||||
DisplayServer.window_set_min_size(Vector2i(900, 500))
|
||||
Globals.target_viewport = image_viewport
|
||||
|
||||
func _on_save_image_button_pressed():
|
||||
if image_viewport.get_result() != null:
|
||||
ui_control_filesave.current_path = Globals.last_image_savepath
|
||||
ui_control_filesave.show()
|
||||
|
||||
func _on_save_image_dialog_file_selected(path):
|
||||
print("Export ", path)
|
||||
var err = image_viewport.get_result().save_png(path)
|
||||
if err != OK:
|
||||
print("An error occured!")
|
||||
else:
|
||||
Globals.last_image_savepath = path
|
||||
# position windows
|
||||
get_window().position = Vector2i(
|
||||
editor_window.position.x + editor_window.size.x + 50,
|
||||
editor_window.position.y)
|
||||
get_window().title = ProjectSettings.get_setting("application/config/name") + " - Viewer"
|
||||
editor_window.title = ProjectSettings.get_setting("application/config/name") + " - Editor"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue