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

@ -5,7 +5,7 @@ var custom_brush_index := -1
func _on_BrushButton_pressed() -> void:
#Change left brush
if Global.brushes_popup.rect_global_position == Global.left_brush_type_button.rect_global_position:
if Global.brush_type_window_position == "left":
Global.current_left_brush_type = brush_type
Global.custom_left_brush_index = custom_brush_index
if custom_brush_index > -1: #Custom brush

View file

@ -86,6 +86,8 @@ var right_brush_size := 1
var current_left_brush_type = BRUSH_TYPES.PIXEL
# warning-ignore:unused_class_variable
var current_right_brush_type = BRUSH_TYPES.PIXEL
# warning-ignore:unused_class_variable
var brush_type_window_position := "left"
var brushes_from_files := 0
# warning-ignore:unused_class_variable

View file

@ -12,6 +12,11 @@ var last : Vector2
# warning-ignore:unused_argument
func _process(delta : float) -> void:
update()
var mouse_pos := get_local_mouse_position()
if mouse_pos.x < RULER_WIDTH: #For double guides
mouse_default_cursor_shape = Control.CURSOR_BDIAGSIZE
else:
mouse_default_cursor_shape = Control.CURSOR_HSPLIT
#Code taken and modified from Godot's source code
func _draw() -> void:

View file

@ -132,6 +132,9 @@ func _ready() -> void:
for t in tools:
t[0].connect("pressed", self, "_on_Tool_pressed", [t[0]])
Global.left_color_picker.get_picker().move_child(Global.left_color_picker.get_picker().get_child(0), 1)
Global.right_color_picker.get_picker().move_child(Global.right_color_picker.get_picker().get_child(0), 1)
#Options for Import
import_as_new_frame = CheckBox.new()
import_as_new_frame.text = tr("IMPORT_FILE_LABEL")
@ -734,9 +737,11 @@ func _on_RightIndicatorCheckbox_toggled(button_pressed) -> void:
func _on_LeftBrushTypeButton_pressed() -> void:
Global.brushes_popup.popup(Rect2(Global.left_brush_type_button.rect_global_position, Vector2(226, 72)))
Global.brush_type_window_position = "left"
func _on_RightBrushTypeButton_pressed() -> void:
Global.brushes_popup.popup(Rect2(Global.right_brush_type_button.rect_global_position, Vector2(226, 72)))
Global.brush_type_window_position = "right"
func _on_LeftBrushSizeEdit_value_changed(value) -> void:
var new_size = int(value)
@ -1025,6 +1030,10 @@ func _on_RightVerticalMirroring_toggled(button_pressed) -> void:
Global.right_vertical_mirror = button_pressed
func _on_QuitDialog_confirmed() -> void:
# Darken the UI to denote that the application is currently exiting
# (it won't respond to user input in this state).
modulate = Color(0.5, 0.5, 0.5)
get_tree().quit()
func _exit_tree() -> void:
@ -1038,4 +1047,3 @@ func _exit_tree() -> void:
func _on_PaletteOptionButton_item_selected(ID) -> void:
var palette_name = Global.palette_option_button.get_item_metadata(ID)
Global.palette_container.on_palette_select(palette_name)
pass

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