1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Add hint tooltips for Project Brush buttons when importing them from image files

This commit is contained in:
OverloadedOrama 2020-07-13 21:59:25 +03:00
parent c42a8a7219
commit 8c02e696a9
2 changed files with 8 additions and 5 deletions

View file

@ -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()

View file

@ -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