Skip to content

Commit

Permalink
Fixed Reference Images (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qainguin committed Jun 6, 2024
1 parent e254c45 commit cdb8551
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit cdb8551

Please sign in to comment.