mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 07:04:43 -04:00
Merge branch 'master' into master
This commit is contained in:
commit
77a55f2495
19 changed files with 879 additions and 131 deletions
|
@ -95,7 +95,7 @@ func _input(event : InputEvent) -> void:
|
|||
update()
|
||||
|
||||
sprite_changed_this_frame = false
|
||||
current_pixel = get_local_mouse_position() - location
|
||||
current_pixel = get_local_mouse_position() + location
|
||||
var mouse_pos := current_pixel
|
||||
var mouse_pos_floored := mouse_pos.floor()
|
||||
var mouse_pos_ceiled := mouse_pos.ceil()
|
||||
|
@ -449,7 +449,7 @@ func _draw() -> void:
|
|||
draw_line(Vector2(location.x, y), Vector2(size.x, y), Global.grid_color, true)
|
||||
|
||||
#Draw rectangle to indicate the pixel currently being hovered on
|
||||
var mouse_pos := get_local_mouse_position() + location
|
||||
var mouse_pos := current_pixel
|
||||
if point_in_rectangle(mouse_pos, location, location + size):
|
||||
mouse_pos = mouse_pos.floor()
|
||||
if Global.left_square_indicator_visible && Global.can_draw:
|
||||
|
|
|
@ -172,12 +172,15 @@ func change_theme(ID : int) -> void:
|
|||
|
||||
func _on_GridWidthValue_value_changed(value : float) -> void:
|
||||
Global.grid_width = value
|
||||
Global.canvas.update()
|
||||
|
||||
func _on_GridHeightValue_value_changed(value : float) -> void:
|
||||
Global.grid_height = value
|
||||
Global.canvas.update()
|
||||
|
||||
func _on_GridColor_color_changed(color : Color) -> void:
|
||||
Global.grid_color = color
|
||||
Global.canvas.update()
|
||||
|
||||
func _on_GuideColor_color_changed(color : Color) -> void:
|
||||
Global.guide_color = color
|
||||
|
|
|
@ -72,12 +72,13 @@ func import_gpl(path : String) -> Palette:
|
|||
comments += line.trim_prefix('#') + '\n'
|
||||
pass
|
||||
elif line_number > 0 && line.length() >= 12:
|
||||
var red : float = line.substr(0, 4).to_float() / 255.0
|
||||
var green : float = line.substr(4, 4).to_float() / 255.0
|
||||
var blue : float = line.substr(8, 4).to_float() / 255.0
|
||||
var name : String = line.substr(12, line.length() - 12)
|
||||
line = line.replace("\t", " ")
|
||||
var color_data : PoolStringArray = line.split(" ", false, 4)
|
||||
var red : float = color_data[0].to_float() / 255.0
|
||||
var green : float = color_data[1].to_float() / 255.0
|
||||
var blue : float = color_data[2].to_float() / 255.0
|
||||
var color = Color(red, green, blue)
|
||||
result.add_color(color, name)
|
||||
result.add_color(color, color_data[3])
|
||||
line_number += 1
|
||||
|
||||
if result:
|
||||
|
|
|
@ -767,10 +767,10 @@ func _on_LoopAnim_pressed() -> void:
|
|||
Global.loop_animation_button.texture_normal = load("res://Assets/Graphics/%s Themes/Timeline/Loop_None.png" % Global.theme_type)
|
||||
Global.loop_animation_button.hint_tooltip = "No loop"
|
||||
|
||||
func _on_PlayForward_toggled(button_pressed) -> void:
|
||||
func _on_PlayForward_toggled(button_pressed : bool) -> void:
|
||||
Global.play_backwards.pressed = false
|
||||
if Global.canvases.size() == 1:
|
||||
Global.play_forward.pressed = !button_pressed
|
||||
Global.play_forward.pressed = false
|
||||
return
|
||||
|
||||
if button_pressed:
|
||||
|
@ -780,10 +780,10 @@ func _on_PlayForward_toggled(button_pressed) -> void:
|
|||
else:
|
||||
Global.animation_timer.stop()
|
||||
|
||||
func _on_PlayBackwards_toggled(button_pressed) -> void:
|
||||
func _on_PlayBackwards_toggled(button_pressed : bool) -> void:
|
||||
Global.play_forward.pressed = false
|
||||
if Global.canvases.size() == 1:
|
||||
Global.play_backwards.pressed = !button_pressed
|
||||
Global.play_backwards.pressed = false
|
||||
return
|
||||
|
||||
if button_pressed:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extends WindowDialog
|
||||
|
||||
onready var color_picker = $VBoxContainer/HBoxContainer/EditPaletteColorPicker
|
||||
onready var palette_grid = $VBoxContainer/HBoxContainer/Panel/EditPaletteGridContainer
|
||||
onready var palette_grid = $VBoxContainer/HBoxContainer/Panel/ScrollContainer/EditPaletteGridContainer
|
||||
onready var color_name_edit = $VBoxContainer/PaletteOptions/EditPaletteColorNameLineEdit
|
||||
onready var palette_name_edit = $VBoxContainer/PaletteOptions/EditPaletteNameLineEdit
|
||||
|
||||
|
|
|
@ -85,14 +85,14 @@ func _serialize() -> String:
|
|||
var result = ""
|
||||
var serialize_data : Dictionary = {
|
||||
"name" : name,
|
||||
"colors" : [],
|
||||
"comments" : comments,
|
||||
"colors" : [],
|
||||
"editable" : editable
|
||||
}
|
||||
for color in colors:
|
||||
serialize_data.colors.push_back(color.toDict())
|
||||
|
||||
result = JSON.print(serialize_data)
|
||||
result = JSON.print(serialize_data, " ")
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ func on_palette_import_file_selected(path : String) -> void:
|
|||
on_palette_select(palette.name)
|
||||
save_palette(palette.name, palette.name + ".json")
|
||||
else:
|
||||
Global.error_dialog.set_text("Palette named '" + palette.name + "' already exists");
|
||||
Global.error_dialog.set_text("Palette named '" + palette.name + "' already exists")
|
||||
Global.error_dialog.popup_centered()
|
||||
else:
|
||||
Global.error_dialog.set_text("Invalid Palette file!")
|
||||
|
|
|
@ -133,7 +133,8 @@ func _process(delta : float) -> void:
|
|||
Global.canvas.handle_undo("Draw")
|
||||
for xx in range(start_pos.x, end_pos.x):
|
||||
for yy in range(start_pos.y, end_pos.y):
|
||||
layer.set_pixel(xx, yy, Color(0, 0, 0, 0))
|
||||
if point_in_rectangle(Vector2(xx, yy), Global.canvas.location - Vector2.ONE, Global.canvas.location + Global.canvas.size):
|
||||
layer.set_pixel(xx, yy, Color(0, 0, 0, 0))
|
||||
Global.canvas.handle_redo("Draw")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue