From 8c02e696a94fd84b959d50df3c695eac7c9e6509 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Mon, 13 Jul 2020 21:59:25 +0300 Subject: [PATCH] Add hint tooltips for Project Brush buttons when importing them from image files --- src/UI/BrushesPopup.gd | 3 ++- src/UI/Dialogs/PreviewDialog.gd | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/UI/BrushesPopup.gd b/src/UI/BrushesPopup.gd index e829fd3..07685c0 100644 --- a/src/UI/BrushesPopup.gd +++ b/src/UI/BrushesPopup.gd @@ -71,10 +71,11 @@ static func add_file_brush(images : Array, hint := "") -> void: button.brush.index = button.get_index() -static func add_project_brush(image : Image) -> void: +static func add_project_brush(image : Image, hint := "") -> void: var button = create_button(image) button.brush.type = CUSTOM button.brush.image = image + button.hint_tooltip = hint var container = Global.brushes_popup.get_node("TabContainer/Project/ProjectBrushContainer") container.add_child(button) button.brush.index = button.get_index() diff --git a/src/UI/Dialogs/PreviewDialog.gd b/src/UI/Dialogs/PreviewDialog.gd index 105a067..c663ea4 100644 --- a/src/UI/Dialogs/PreviewDialog.gd +++ b/src/UI/Dialogs/PreviewDialog.gd @@ -156,11 +156,12 @@ func spritesheet_frame_value_changed(value : int, vertical : bool) -> void: func add_brush(type : int) -> void: - var file_name_ext : String = path.get_file() - file_name_ext = brush_name_replace(file_name_ext) - var file_name : String = file_name_ext.get_basename() image.convert(Image.FORMAT_RGBA8) if type == BrushTypes.FILE: + var file_name_ext : String = path.get_file() + file_name_ext = brush_name_replace(file_name_ext) + var file_name : String = file_name_ext.get_basename() + file_name = brush_name_replace(file_name) Brushes.add_file_brush([image], file_name) @@ -170,8 +171,9 @@ func add_brush(type : int) -> void: dir.copy(path, Global.directory_module.xdg_data_home.plus_file(location)) elif type == BrushTypes.PROJECT: + var file_name : String = path.get_file().get_basename() Global.current_project.brushes.append(image) - Brushes.add_project_brush(image) + Brushes.add_project_brush(image, file_name) # Checks if the brush name already exists