fix: Remember the location a shader was loaded from & improve functionality

This commit is contained in:
ChaoticByte 2024-06-10 15:51:02 +02:00
parent 1304ecd198
commit 68185fa9ec
No known key found for this signature in database
3 changed files with 5 additions and 6 deletions

2
.gitignore vendored
View file

@ -16,3 +16,5 @@ mono_crash.*.json
dist/* dist/*
!dist/.gitkeep !dist/.gitkeep
screenshot.png.import

View file

@ -231,7 +231,7 @@ func _on_open_shader_dialog_file_selected(path):
Globals.shader = shader Globals.shader = shader
Globals.target_viewport.update() Globals.target_viewport.update()
update() update()
last_save_filepath = "" last_save_filepath = path
func _on_save_shader_dialog_file_selected(path): func _on_save_shader_dialog_file_selected(path):
var file = FileAccess.open(path, FileAccess.WRITE) var file = FileAccess.open(path, FileAccess.WRITE)

View file

@ -20,15 +20,12 @@ func _on_open_image_dialog_file_selected(path):
image_viewport.set_original_image(img) image_viewport.set_original_image(img)
image_viewport.update() image_viewport.update()
camera.fit_image() camera.fit_image()
last_save_filepath = "" last_save_filepath = path
else: else:
print("An error occured!") print("An error occured!")
func _on_save_image_button_pressed(): func _on_save_image_button_pressed():
if image_viewport.get_result() != null: if image_viewport.get_result() != null:
if last_save_filepath == "":
ui_control_filesave.current_file = "output.png"
else:
ui_control_filesave.current_path = last_save_filepath ui_control_filesave.current_path = last_save_filepath
ui_control_filesave.show() ui_control_filesave.show()