Merge branch 'master' into palette_updates

This commit is contained in:
CheetoHead 2019-12-16 10:23:46 -05:00
commit b40f8f0513
14 changed files with 198 additions and 184 deletions

View file

@ -6,19 +6,16 @@ var current_palette = "Default"
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
_load_palettes()
#Select default palette "Default"
on_palette_select(current_palette)
pass # Replace with function body.
func _clear_swatches() -> void:
for child in get_children():
if child is BaseButton:
child.disconnect("pressed", self, "on_color_select")
child.queue_free()
pass
func on_palette_select(palette_name : String) -> void:
_clear_swatches()
@ -28,7 +25,6 @@ func on_palette_select(palette_name : String) -> void:
else: #Use default on fail
current_palette = "Default"
_display_palette(Global.palettes["Default"])
pass
func _display_palette(palette : Array) -> void:
var index := 0
@ -43,7 +39,6 @@ func _display_palette(palette : Array) -> void:
add_child(new_button)
index += 1
pass
func on_color_select(index : int) -> void:
var color = Color(Global.palettes[current_palette][index].data)
@ -54,7 +49,6 @@ func on_color_select(index : int) -> void:
elif Input.is_action_just_released("right_mouse"):
Global.right_color_picker.color = color
Global.update_right_custom_brush()
pass
func _load_palettes() -> void:
var files := []
@ -90,7 +84,6 @@ func _load_palettes() -> void:
for item in Global.palette_option_button.items:
print(item)
pass
func load_palette(path : String) -> String:
# Open file for reading
@ -117,7 +110,7 @@ func load_palette(path : String) -> String:
return palette_name
func _save_palette(palette : Array, name : String, path : String):
func _save_palette(palette : Array, name : String, path : String) -> void:
# Open file for writing
var file := File.new()
file.open(path, File.WRITE)
@ -130,9 +123,3 @@ func _save_palette(palette : Array, name : String, path : String):
# Write palette data to file
file.store_string(JSON.print(data))
file.close()
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass