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

Fixed Reference Images #787

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/FileUtils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ _filter_idx: int) -> void:

static func load_reference_image(path: String) -> void:
var img = Image.new()
img.load_from_file(path)
img.load(path)
img.save_png("user://reference_image.png")
Indications.imported_reference.emit()

Expand Down
8 changes: 4 additions & 4 deletions src/ui_parts/display.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func _ready() -> void:
update_theme()
update_snap_config()
get_window().window_input.connect(_update_input_debug)
Indications.imported_reference.connect(finish_reference_load)
view_settings_updated.emit(grid_visuals.visible, controls.visible,
viewport.display_texture.rasterized)

Expand Down Expand Up @@ -180,6 +181,8 @@ func toggle_rasterization() -> void:
view_settings_updated.emit(grid_visuals.visible, controls.visible,
viewport.display_texture.rasterized)

func load_reference_image() -> void:
FileUtils.open_reference_load_dialog()

func toggle_reference_image() -> void:
reference_texture.visible = not reference_texture.visible
Expand All @@ -191,14 +194,11 @@ func toggle_reference_overlay() -> void:
else:
viewport.move_child(reference_texture, 0)

func load_reference_image() -> void:
FileUtils.open_reference_load_dialog()
await Indications.imported_reference
func finish_reference_load() -> void:
var img = Image.load_from_file("user://reference_image.png")
reference_texture.texture = ImageTexture.create_from_image(img)
reference_texture.show()


func toggle_snap() -> void:
snap_button.button_pressed = not snap_button.button_pressed

Expand Down