mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 22:54:44 -04:00
Changes to scripts to follow GDScript style guide
Please read here for more info: https://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gdscript_styleguide.html This commit does not add/change any new/existing features.
This commit is contained in:
parent
62bbad7374
commit
5a54235604
32 changed files with 295 additions and 165 deletions
|
@ -12,6 +12,7 @@ onready var contributors : Tree = $AboutUI/Credits/Contributors/ContributorTree
|
|||
onready var donors : Tree = $AboutUI/Credits/Donors/DonorTree
|
||||
onready var translators : Tree = $AboutUI/Credits/Translators/TranslatorTree
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var contributor_root := contributors.create_item()
|
||||
contributors.create_item(contributor_root).set_text(0, " Hugo Locurcio (Calinou)")
|
||||
|
@ -37,6 +38,7 @@ func _ready() -> void:
|
|||
donors.create_item(donors_root).set_text(0, " pcmxms")
|
||||
donors.create_item(donors_root).set_text(0, " Mike King")
|
||||
|
||||
|
||||
func _on_AboutDialog_about_to_show() -> void:
|
||||
var current_version : String = ProjectSettings.get_setting("application/config/Version")
|
||||
window_title = tr("About Pixelorama") + " " + current_version
|
||||
|
@ -86,10 +88,12 @@ func _on_AboutDialog_about_to_show() -> void:
|
|||
translators.create_item(translators_root).set_text(0, " Agnis Aldiņš (NeZvers) - " + tr("Latvian"))
|
||||
translators.create_item(translators_root).set_text(0, " Teashrock - " + tr("Esperanto"))
|
||||
|
||||
|
||||
func _on_AboutDialog_popup_hide() -> void:
|
||||
groups.clear()
|
||||
developers.clear()
|
||||
|
||||
|
||||
func _on_Groups_item_selected() -> void:
|
||||
for child in credits.get_children():
|
||||
if child != groups:
|
||||
|
@ -109,8 +113,10 @@ func _on_Groups_item_selected() -> void:
|
|||
func _on_Website_pressed() -> void:
|
||||
OS.shell_open("https://www.orama-interactive.com/pixelorama")
|
||||
|
||||
|
||||
func _on_GitHub_pressed() -> void:
|
||||
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama")
|
||||
|
||||
|
||||
func _on_Donate_pressed() -> void:
|
||||
OS.shell_open("https://www.patreon.com/OramaInteractive")
|
||||
|
|
|
@ -51,13 +51,15 @@ var TStrings ={
|
|||
Templates.SNES_PAL: "SNES (PAL)"
|
||||
}
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
ratio_box.connect("pressed", self, "_on_RatioCheckBox_toggled", [ratio_box.pressed])
|
||||
templates_options.connect("item_selected", self, "_on_TemplatesOptions_item_selected")
|
||||
|
||||
_CreateOptionList()
|
||||
|
||||
func _CreateOptionList():
|
||||
|
||||
func _CreateOptionList() -> void:
|
||||
for i in Templates.values():
|
||||
if i > 0:
|
||||
if TStrings[i] != "":
|
||||
|
@ -65,6 +67,7 @@ func _CreateOptionList():
|
|||
else:
|
||||
templates_options.add_item("{width}x{height}".format({"width":TResolutions[i].x, "height":TResolutions[i].y}), i)
|
||||
|
||||
|
||||
func _on_CreateNewImage_confirmed() -> void:
|
||||
var width : int = width_value.value
|
||||
var height : int = height_value.value
|
||||
|
@ -89,6 +92,7 @@ func _on_CreateNewImage_confirmed() -> void:
|
|||
Global.canvas.layers[0][0].lock()
|
||||
Global.canvas.update_texture(0)
|
||||
|
||||
|
||||
func _on_CreateNewImage_about_to_show() -> void:
|
||||
width_value.value = Global.default_image_width
|
||||
height_value.value = Global.default_image_height
|
||||
|
@ -99,10 +103,10 @@ func _on_CreateNewImage_about_to_show() -> void:
|
|||
if spin_box.is_connected("value_changed", self, "_on_SizeValue_value_changed"):
|
||||
spin_box.disconnect("value_changed", self, "_on_SizeValue_value_changed")
|
||||
|
||||
|
||||
var aspect_ratio: float
|
||||
|
||||
# warning-ignore:unused_argument
|
||||
func _on_RatioCheckBox_toggled(button_pressed: bool) -> void:
|
||||
func _on_RatioCheckBox_toggled(_button_pressed: bool) -> void:
|
||||
aspect_ratio = width_value.value / height_value.value
|
||||
for spin_box in [width_value, height_value]:
|
||||
if spin_box.is_connected("value_changed", self, "_on_SizeValue_value_changed"):
|
||||
|
@ -110,12 +114,14 @@ func _on_RatioCheckBox_toggled(button_pressed: bool) -> void:
|
|||
else:
|
||||
spin_box.connect("value_changed", self, "_on_SizeValue_value_changed")
|
||||
|
||||
|
||||
func _on_SizeValue_value_changed(value: float) -> void:
|
||||
if width_value.value == value:
|
||||
height_value.value = width_value.value / aspect_ratio
|
||||
if height_value.value == value:
|
||||
width_value.value = height_value.value * aspect_ratio
|
||||
|
||||
|
||||
func _on_TemplatesOptions_item_selected(id: int) -> void:
|
||||
if id != Templates.TDefault:
|
||||
size_value = TResolutions[id]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extends AcceptDialog
|
||||
|
||||
enum ExportTab { Frame = 0, Spritesheet = 1, Animation = 2 }
|
||||
var current_tab : int = ExportTab.Frame
|
||||
enum ExportTab { FRAME = 0, SPRITESHEET = 1, ANIMATION = 2 }
|
||||
var current_tab : int = ExportTab.FRAME
|
||||
|
||||
# All canvases and their layers processed/blended into images
|
||||
var processed_images = [] # Image[]
|
||||
|
@ -10,17 +10,17 @@ var processed_images = [] # Image[]
|
|||
var frame_number := 0
|
||||
|
||||
# Spritesheet options
|
||||
enum Orientation { Rows = 0, Columns = 1 }
|
||||
var orientation : int = Orientation.Rows
|
||||
enum Orientation { ROWS = 0, COLUMNS = 1 }
|
||||
var orientation : int = Orientation.ROWS
|
||||
# How many rows/columns before new line is added
|
||||
var lines_count := 1
|
||||
|
||||
# Animation options
|
||||
enum AnimationType { MultipleFiles = 0, Animated = 1 }
|
||||
var animation_type : int = AnimationType.MultipleFiles
|
||||
enum AnimationType { MULTIPLE_FILES = 0, ANIMATED = 1 }
|
||||
var animation_type : int = AnimationType.MULTIPLE_FILES
|
||||
var background_color : Color = Color.white
|
||||
enum AnimationDirection { Forward = 0, Backwards = 1, PingPong = 2 }
|
||||
var direction : int = AnimationDirection.Forward
|
||||
enum AnimationDirection { FORWARD = 0, BACKWARDS = 1, PING_PONG = 2 }
|
||||
var direction : int = AnimationDirection.FORWARD
|
||||
|
||||
# Options
|
||||
var resize := 100
|
||||
|
@ -57,6 +57,7 @@ var stop_export = false
|
|||
var animated_preview_current_frame := 0
|
||||
var animated_preview_frames = []
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$VBoxContainer/Tabs.add_tab("Frame")
|
||||
$VBoxContainer/Tabs.add_tab("Spritesheet")
|
||||
|
@ -70,16 +71,17 @@ func _ready() -> void:
|
|||
|
||||
# Disable GIF export for unsupported platforms
|
||||
if not $GifExporter.is_platform_supported():
|
||||
$VBoxContainer/AnimationOptions/AnimationType.selected = AnimationType.MultipleFiles
|
||||
$VBoxContainer/AnimationOptions/AnimationType.selected = AnimationType.MULTIPLE_FILES
|
||||
$VBoxContainer/AnimationOptions/AnimationType.disabled = true
|
||||
|
||||
|
||||
func show_tab() -> void:
|
||||
$VBoxContainer/FrameOptions.hide()
|
||||
$VBoxContainer/SpritesheetOptions.hide()
|
||||
$VBoxContainer/AnimationOptions.hide()
|
||||
|
||||
match current_tab:
|
||||
ExportTab.Frame:
|
||||
ExportTab.FRAME:
|
||||
file_format = FileFormat.PNG
|
||||
$VBoxContainer/File/FileFormat.selected = FileFormat.PNG
|
||||
$FrameTimer.stop()
|
||||
|
@ -89,12 +91,12 @@ func show_tab() -> void:
|
|||
$VBoxContainer/FrameOptions/FrameNumber/FrameNumber.value = frame_number
|
||||
process_frame()
|
||||
$VBoxContainer/FrameOptions.show()
|
||||
ExportTab.Spritesheet:
|
||||
ExportTab.SPRITESHEET:
|
||||
file_format = FileFormat.PNG
|
||||
$VBoxContainer/File/FileFormat.selected = FileFormat.PNG
|
||||
$FrameTimer.stop()
|
||||
if not was_exported:
|
||||
orientation = Orientation.Rows
|
||||
orientation = Orientation.ROWS
|
||||
lines_count = int(ceil(sqrt(Global.canvases.size())))
|
||||
$VBoxContainer/SpritesheetOptions/Orientation/Orientation.selected = orientation
|
||||
$VBoxContainer/SpritesheetOptions/Orientation/LinesCount.max_value = Global.canvases.size()
|
||||
|
@ -102,7 +104,7 @@ func show_tab() -> void:
|
|||
$VBoxContainer/SpritesheetOptions/Orientation/LinesCountLabel.text = "Columns:"
|
||||
process_spritesheet()
|
||||
$VBoxContainer/SpritesheetOptions.show()
|
||||
ExportTab.Animation:
|
||||
ExportTab.ANIMATION:
|
||||
set_file_format_selector()
|
||||
process_animation()
|
||||
$VBoxContainer/AnimationOptions/AnimationType.selected = animation_type
|
||||
|
@ -116,11 +118,11 @@ func show_tab() -> void:
|
|||
func external_export() -> void:
|
||||
restore_previous_export_settings()
|
||||
match current_tab:
|
||||
ExportTab.Frame:
|
||||
ExportTab.FRAME:
|
||||
process_frame()
|
||||
ExportTab.Spritesheet:
|
||||
ExportTab.SPRITESHEET:
|
||||
process_spritesheet()
|
||||
ExportTab.Animation:
|
||||
ExportTab.ANIMATION:
|
||||
process_animation()
|
||||
export_processed_images(true)
|
||||
|
||||
|
@ -136,8 +138,8 @@ func process_frame() -> void:
|
|||
|
||||
func process_spritesheet() -> void:
|
||||
# If rows mode selected calculate columns count and vice versa
|
||||
var spritesheet_columns = lines_count if orientation == Orientation.Rows else frames_divided_by_spritesheet_lines()
|
||||
var spritesheet_rows = lines_count if orientation == Orientation.Columns else frames_divided_by_spritesheet_lines()
|
||||
var spritesheet_columns = lines_count if orientation == Orientation.ROWS else frames_divided_by_spritesheet_lines()
|
||||
var spritesheet_rows = lines_count if orientation == Orientation.COLUMNS else frames_divided_by_spritesheet_lines()
|
||||
|
||||
var width = Global.canvas.size.x * spritesheet_columns
|
||||
var height = Global.canvas.size.y * spritesheet_rows
|
||||
|
@ -149,7 +151,7 @@ func process_spritesheet() -> void:
|
|||
var hh := 0
|
||||
var vv := 0
|
||||
for canvas in Global.canvases:
|
||||
if orientation == Orientation.Rows:
|
||||
if orientation == Orientation.ROWS:
|
||||
if vv < spritesheet_columns:
|
||||
origin.x = canvas.size.x * vv
|
||||
vv += 1
|
||||
|
@ -184,16 +186,16 @@ func process_animation() -> void:
|
|||
|
||||
func set_preview() -> void:
|
||||
remove_previews()
|
||||
if processed_images.size() == 1 and current_tab != ExportTab.Animation:
|
||||
if processed_images.size() == 1 and current_tab != ExportTab.ANIMATION:
|
||||
$VBoxContainer/PreviewScroll/Previews.columns = 1
|
||||
add_image_preview(processed_images[0])
|
||||
else:
|
||||
match animation_type:
|
||||
AnimationType.MultipleFiles:
|
||||
AnimationType.MULTIPLE_FILES:
|
||||
$VBoxContainer/PreviewScroll/Previews.columns = ceil(sqrt(processed_images.size()))
|
||||
for i in range(processed_images.size()):
|
||||
add_image_preview(processed_images[i], i + 1)
|
||||
AnimationType.Animated:
|
||||
AnimationType.ANIMATED:
|
||||
$VBoxContainer/PreviewScroll/Previews.columns = 1
|
||||
add_animated_preview()
|
||||
|
||||
|
@ -215,7 +217,7 @@ func add_image_preview(image: Image, canvas_number: int = -1) -> void:
|
|||
|
||||
|
||||
func add_animated_preview() -> void:
|
||||
animated_preview_current_frame = processed_images.size() - 1 if direction == AnimationDirection.Backwards else 0
|
||||
animated_preview_current_frame = processed_images.size() - 1 if direction == AnimationDirection.BACKWARDS else 0
|
||||
animated_preview_frames = []
|
||||
|
||||
for processed_image in processed_images:
|
||||
|
@ -278,7 +280,7 @@ func export_processed_images(ignore_overwrites : bool) -> void:
|
|||
var export_paths = []
|
||||
for i in range(processed_images.size()):
|
||||
stop_export = false
|
||||
var multiple_files := true if (current_tab == ExportTab.Animation && animation_type == AnimationType.MultipleFiles) else false
|
||||
var multiple_files := true if (current_tab == ExportTab.ANIMATION && animation_type == AnimationType.MULTIPLE_FILES) else false
|
||||
var export_path = create_export_path(multiple_files, i + 1)
|
||||
# If user want to create new directory for each animation tag then check if directories exist and create them if not
|
||||
if multiple_files and new_dir_for_each_frame_tag:
|
||||
|
@ -301,24 +303,24 @@ func export_processed_images(ignore_overwrites : bool) -> void:
|
|||
return
|
||||
export_paths.append(export_path)
|
||||
# Only get one export path if single file animated image is exported
|
||||
if current_tab == ExportTab.Animation && animation_type == AnimationType.Animated:
|
||||
if current_tab == ExportTab.ANIMATION && animation_type == AnimationType.ANIMATED:
|
||||
break
|
||||
|
||||
# Scale images that are to export
|
||||
scale_processed_images()
|
||||
|
||||
if current_tab == ExportTab.Animation && animation_type == AnimationType.Animated:
|
||||
if current_tab == ExportTab.ANIMATION && animation_type == AnimationType.ANIMATED:
|
||||
var frame_delay_in_ms = Global.animation_timer.wait_time * 100
|
||||
|
||||
$GifExporter.begin_export(export_paths[0], processed_images[0].get_width(), processed_images[0].get_height(), frame_delay_in_ms, 0)
|
||||
match direction:
|
||||
AnimationDirection.Forward:
|
||||
AnimationDirection.FORWARD:
|
||||
for i in range(processed_images.size()):
|
||||
$GifExporter.write_frame(processed_images[i], background_color, frame_delay_in_ms)
|
||||
AnimationDirection.Backwards:
|
||||
AnimationDirection.BACKWARDS:
|
||||
for i in range(processed_images.size() - 1, -1, -1):
|
||||
$GifExporter.write_frame(processed_images[i], background_color, frame_delay_in_ms)
|
||||
AnimationDirection.PingPong:
|
||||
AnimationDirection.PING_PONG:
|
||||
for i in range(0, processed_images.size()):
|
||||
$GifExporter.write_frame(processed_images[i], background_color, frame_delay_in_ms)
|
||||
for i in range(processed_images.size() - 2, 0, -1):
|
||||
|
@ -410,19 +412,20 @@ func file_format_string(format_enum : int) -> String:
|
|||
func set_file_format_selector() -> void:
|
||||
$VBoxContainer/AnimationOptions/MultipleAnimationsDirectories.visible = false
|
||||
match animation_type:
|
||||
AnimationType.MultipleFiles:
|
||||
AnimationType.MULTIPLE_FILES:
|
||||
file_format = FileFormat.PNG
|
||||
$VBoxContainer/File/FileFormat.selected = FileFormat.PNG
|
||||
$FrameTimer.stop()
|
||||
$VBoxContainer/AnimationOptions/AnimatedOptions.hide()
|
||||
$VBoxContainer/AnimationOptions/MultipleAnimationsDirectories.pressed = new_dir_for_each_frame_tag
|
||||
$VBoxContainer/AnimationOptions/MultipleAnimationsDirectories.visible = true
|
||||
AnimationType.Animated:
|
||||
AnimationType.ANIMATED:
|
||||
file_format = FileFormat.GIF
|
||||
$VBoxContainer/File/FileFormat.selected = FileFormat.GIF
|
||||
$FrameTimer.wait_time = Global.animation_timer.wait_time
|
||||
$VBoxContainer/AnimationOptions/AnimatedOptions.show()
|
||||
|
||||
|
||||
func store_export_settings() -> void:
|
||||
exported_tab = current_tab
|
||||
exported_frame_number = frame_number
|
||||
|
@ -437,6 +440,7 @@ func store_export_settings() -> void:
|
|||
exported_file_name = file_name
|
||||
exported_file_format = file_format
|
||||
|
||||
|
||||
# Fill the dialog with previous export settings
|
||||
func restore_previous_export_settings() -> void:
|
||||
current_tab = exported_tab
|
||||
|
@ -475,6 +479,7 @@ func _on_ExportDialog_about_to_show() -> void:
|
|||
file_exists_alert = tr("File %s already exists. Overwrite?") # Update translation
|
||||
#$VBoxContainer/Tabs.set_tab_title(0, "Frame")
|
||||
|
||||
|
||||
func _on_Tabs_tab_clicked(tab : int) -> void:
|
||||
current_tab = tab
|
||||
show_tab()
|
||||
|
@ -488,7 +493,7 @@ func _on_Frame_value_changed(value: float) -> void:
|
|||
|
||||
func _on_Orientation_item_selected(id : int) -> void:
|
||||
orientation = id
|
||||
if orientation == Orientation.Rows:
|
||||
if orientation == Orientation.ROWS:
|
||||
$VBoxContainer/SpritesheetOptions/Orientation/LinesCountLabel.text = "Columns:"
|
||||
else:
|
||||
$VBoxContainer/SpritesheetOptions/Orientation/LinesCountLabel.text = "Rows:"
|
||||
|
@ -516,13 +521,13 @@ func _on_BackgroundColor_color_changed(color : Color) -> void:
|
|||
func _on_Direction_item_selected(id : int) -> void:
|
||||
direction = id
|
||||
match id:
|
||||
AnimationDirection.Forward:
|
||||
AnimationDirection.FORWARD:
|
||||
animated_preview_current_frame = 0
|
||||
AnimationDirection.Backwards:
|
||||
AnimationDirection.BACKWARDS:
|
||||
animated_preview_current_frame = processed_images.size() - 1
|
||||
AnimationDirection.PingPong:
|
||||
AnimationDirection.PING_PONG:
|
||||
animated_preview_current_frame = 0
|
||||
pingpong_direction = AnimationDirection.Forward
|
||||
pingpong_direction = AnimationDirection.FORWARD
|
||||
|
||||
|
||||
func _on_Resize_value_changed(value : float) -> void:
|
||||
|
@ -579,39 +584,39 @@ func _on_FileExistsAlert_custom_action(action : String) -> void:
|
|||
$Popups/FileExistsAlert.hide()
|
||||
|
||||
|
||||
var pingpong_direction = AnimationDirection.Forward
|
||||
var pingpong_direction = AnimationDirection.FORWARD
|
||||
func _on_FrameTimer_timeout() -> void:
|
||||
$VBoxContainer/PreviewScroll/Previews/PreviewContainer/Preview.texture = animated_preview_frames[animated_preview_current_frame]
|
||||
|
||||
match direction:
|
||||
AnimationDirection.Forward:
|
||||
AnimationDirection.FORWARD:
|
||||
if animated_preview_current_frame == animated_preview_frames.size() - 1:
|
||||
animated_preview_current_frame = 0
|
||||
else:
|
||||
animated_preview_current_frame += 1
|
||||
|
||||
AnimationDirection.Backwards:
|
||||
AnimationDirection.BACKWARDS:
|
||||
if animated_preview_current_frame == 0:
|
||||
animated_preview_current_frame = processed_images.size() - 1
|
||||
else:
|
||||
animated_preview_current_frame -= 1
|
||||
|
||||
AnimationDirection.PingPong:
|
||||
AnimationDirection.PING_PONG:
|
||||
match pingpong_direction:
|
||||
AnimationDirection.Forward:
|
||||
AnimationDirection.FORWARD:
|
||||
if animated_preview_current_frame == animated_preview_frames.size() - 1:
|
||||
pingpong_direction = AnimationDirection.Backwards
|
||||
pingpong_direction = AnimationDirection.BACKWARDS
|
||||
animated_preview_current_frame -= 1
|
||||
if animated_preview_current_frame <= 0:
|
||||
animated_preview_current_frame = 0
|
||||
else:
|
||||
animated_preview_current_frame += 1
|
||||
AnimationDirection.Backwards:
|
||||
AnimationDirection.BACKWARDS:
|
||||
if animated_preview_current_frame == 0:
|
||||
animated_preview_current_frame += 1
|
||||
if animated_preview_current_frame >= animated_preview_frames.size() - 1:
|
||||
animated_preview_current_frame = 0
|
||||
pingpong_direction = AnimationDirection.Forward
|
||||
pingpong_direction = AnimationDirection.FORWARD
|
||||
else:
|
||||
animated_preview_current_frame -= 1
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
extends WindowDialog
|
||||
|
||||
var current_layer : Image
|
||||
var preview_image : Image
|
||||
var preview_texture : ImageTexture
|
||||
|
||||
onready var hue_slider = $MarginContainer/VBoxContainer/HBoxContainer/Sliders/Hue
|
||||
onready var sat_slider = $MarginContainer/VBoxContainer/HBoxContainer/Sliders/Saturation
|
||||
onready var val_slider = $MarginContainer/VBoxContainer/HBoxContainer/Sliders/Value
|
||||
|
@ -10,26 +14,26 @@ onready var val_spinbox = $MarginContainer/VBoxContainer/HBoxContainer/TextBoxes
|
|||
|
||||
onready var preview = $MarginContainer/VBoxContainer/TextureRect
|
||||
|
||||
var current_layer:Image
|
||||
var preview_image:Image
|
||||
var preview_texture:ImageTexture
|
||||
|
||||
func _ready():
|
||||
func _ready() -> void:
|
||||
current_layer = Image.new()
|
||||
preview_image = Image.new()
|
||||
preview_texture = ImageTexture.new()
|
||||
preview_texture.flags = 0
|
||||
|
||||
func _on_HSVDialog_about_to_show():
|
||||
|
||||
func _on_HSVDialog_about_to_show() -> void:
|
||||
current_layer = Global.canvas.layers[Global.current_layer][0]
|
||||
preview_image.copy_from(current_layer)
|
||||
update_preview()
|
||||
|
||||
func _on_Cancel_pressed():
|
||||
|
||||
func _on_Cancel_pressed() -> void:
|
||||
visible = false
|
||||
reset()
|
||||
|
||||
func _on_Apply_pressed():
|
||||
|
||||
func _on_Apply_pressed() -> void:
|
||||
Global.canvas.handle_undo("Draw")
|
||||
Global.canvas.adjust_hsv(current_layer,0,hue_slider.value)
|
||||
Global.canvas.adjust_hsv(current_layer,1,sat_slider.value)
|
||||
|
@ -39,6 +43,7 @@ func _on_Apply_pressed():
|
|||
reset()
|
||||
visible = false
|
||||
|
||||
|
||||
func reset() -> void:
|
||||
disconnect_signals()
|
||||
hue_slider.value = 0
|
||||
|
@ -49,6 +54,7 @@ func reset() -> void:
|
|||
val_spinbox.value = 0
|
||||
reconnect_signals()
|
||||
|
||||
|
||||
func update_preview() -> void:
|
||||
preview_image.copy_from(current_layer)
|
||||
Global.canvas.adjust_hsv(preview_image,0,hue_slider.value)
|
||||
|
@ -57,6 +63,7 @@ func update_preview() -> void:
|
|||
preview_texture.create_from_image(preview_image, 0)
|
||||
preview.texture = preview_texture
|
||||
|
||||
|
||||
func disconnect_signals() -> void:
|
||||
hue_slider.disconnect("value_changed",self,"_on_Hue_value_changed")
|
||||
sat_slider.disconnect("value_changed",self,"_on_Saturation_value_changed")
|
||||
|
@ -65,6 +72,7 @@ func disconnect_signals() -> void:
|
|||
sat_spinbox.disconnect("value_changed",self,"_on_Saturation_value_changed")
|
||||
val_spinbox.disconnect("value_changed",self,"_on_Value_value_changed")
|
||||
|
||||
|
||||
func reconnect_signals() -> void:
|
||||
hue_slider.connect("value_changed",self,"_on_Hue_value_changed")
|
||||
sat_slider.connect("value_changed",self,"_on_Saturation_value_changed")
|
||||
|
@ -73,24 +81,20 @@ func reconnect_signals() -> void:
|
|||
sat_spinbox.connect("value_changed",self,"_on_Saturation_value_changed")
|
||||
val_spinbox.connect("value_changed",self,"_on_Value_value_changed")
|
||||
|
||||
func _on_Hue_value_changed(value):
|
||||
|
||||
func _on_Hue_value_changed(value : float) -> void:
|
||||
hue_spinbox.value = value
|
||||
hue_slider.value = value
|
||||
update_preview()
|
||||
|
||||
func _on_Saturation_value_changed(value):
|
||||
|
||||
func _on_Saturation_value_changed(value : float) -> void:
|
||||
sat_spinbox.value = value
|
||||
sat_slider.value = value
|
||||
update_preview()
|
||||
|
||||
func _on_Value_value_changed(value):
|
||||
|
||||
func _on_Value_value_changed(value : float) -> void:
|
||||
val_spinbox.value = value
|
||||
val_slider.value = value
|
||||
update_preview()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,20 +15,25 @@ func _ready() -> void:
|
|||
remove_child(child)
|
||||
get_vbox().add_child(child)
|
||||
|
||||
|
||||
func _on_ImportAsNewFrame_pressed() -> void:
|
||||
new_frame = !new_frame
|
||||
|
||||
|
||||
func _on_ImportSpritesheet_pressed() -> void:
|
||||
import_spritesheet = !import_spritesheet
|
||||
var spritesheet_container = Global.find_node_by_name(self, "Spritesheet")
|
||||
spritesheet_container.visible = import_spritesheet
|
||||
|
||||
|
||||
func _on_HorizontalFrames_value_changed(value) -> void:
|
||||
spritesheet_horizontal = value
|
||||
|
||||
|
||||
func _on_VerticalFrames_value_changed(value) -> void:
|
||||
spritesheet_vertical = value
|
||||
|
||||
|
||||
func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
||||
Global.control.opensprite_file_selected = true
|
||||
if !new_frame: # If we're not adding a new frame, delete the previous
|
||||
|
|
|
@ -3,6 +3,7 @@ extends ConfirmationDialog
|
|||
func _ready() -> void:
|
||||
$OptionsContainer/OutlineColor.get_picker().presets_visible = false
|
||||
|
||||
|
||||
func _on_OutlineDialog_confirmed() -> void:
|
||||
var outline_color : Color = $OptionsContainer/OutlineColor.color
|
||||
var thickness : int = $OptionsContainer/ThickValue.value
|
||||
|
|
|
@ -37,6 +37,7 @@ var shortcut_already_assigned = false
|
|||
var old_input_event : InputEventKey
|
||||
var new_input_event : InputEventKey
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Disable input until the shortcut selector is displayed
|
||||
set_process_input(false)
|
||||
|
@ -536,7 +537,7 @@ func _on_ShortcutSelector_confirmed() -> void:
|
|||
$Popups/ShortcutSelector.hide()
|
||||
|
||||
|
||||
func _on_OpenLastProject_pressed():
|
||||
func _on_OpenLastProject_pressed() -> void:
|
||||
Global.open_last_project = !Global.open_last_project
|
||||
Global.config_cache.set_value("preferences", "open_last_project", Global.open_last_project)
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
extends ConfirmationDialog
|
||||
|
||||
|
||||
func _on_ScaleImage_confirmed() -> void:
|
||||
var width : int = $VBoxContainer/OptionsContainer/WidthValue.value
|
||||
var height : int = $VBoxContainer/OptionsContainer/HeightValue.value
|
||||
|
|
|
@ -7,6 +7,7 @@ onready var developed_by_label : Label = $"Contents/MarginContainer/Info/VBoxCon
|
|||
onready var platinum_placeholder_label : Label = $"Contents/MarginContainer/Info/Sponsors/PlatinumContainer/PlaceholderLabel"
|
||||
onready var gold_placeholder_label : Label = $"Contents/MarginContainer/Info/Sponsors/GoldContainer/PlaceholderLabel"
|
||||
|
||||
|
||||
func _on_SplashDialog_about_to_show() -> void:
|
||||
if Global.config_cache.has_section_key("preferences", "startup"):
|
||||
show_on_startup_button.pressed = !Global.config_cache.get_value("preferences", "startup")
|
||||
|
@ -26,40 +27,49 @@ func _on_SplashDialog_about_to_show() -> void:
|
|||
platinum_placeholder_label.add_font_override("font", preload("res://Assets/Fonts/Roboto-Bold.tres"))
|
||||
gold_placeholder_label.add_font_override("font", preload("res://Assets/Fonts/Roboto-Bold.tres"))
|
||||
|
||||
|
||||
func _on_ArtCredits_pressed() -> void:
|
||||
OS.shell_open("https://www.instagram.com/erevoid")
|
||||
|
||||
|
||||
func _on_ShowOnStartup_toggled(pressed : bool) -> void:
|
||||
if pressed:
|
||||
Global.config_cache.set_value("preferences", "startup", false)
|
||||
else:
|
||||
Global.config_cache.set_value("preferences", "startup", true)
|
||||
|
||||
|
||||
func _on_PatronButton_pressed() -> void:
|
||||
OS.shell_open("https://www.patreon.com/OramaInteractive")
|
||||
|
||||
|
||||
func _on_TakeThisSpot_pressed() -> void:
|
||||
OS.shell_open("https://www.patreon.com/OramaInteractive")
|
||||
|
||||
func _on_GithubButton_pressed():
|
||||
|
||||
func _on_GithubButton_pressed() -> void:
|
||||
OS.shell_open("https://github.com/Orama-Interactive/Pixelorama")
|
||||
|
||||
func _on_DiscordButton_pressed():
|
||||
|
||||
func _on_DiscordButton_pressed() -> void:
|
||||
OS.shell_open("https://discord.gg/GTMtr8s")
|
||||
|
||||
|
||||
func _on_NewBtn_pressed():
|
||||
func _on_NewBtn_pressed() -> void:
|
||||
Global.control.file_menu_id_pressed(0)
|
||||
visible = false
|
||||
|
||||
func _on_OpenBtn__pressed():
|
||||
|
||||
func _on_OpenBtn__pressed() -> void:
|
||||
Global.control.file_menu_id_pressed(1)
|
||||
visible = false
|
||||
|
||||
func _on_OpenLastBtn_pressed():
|
||||
|
||||
func _on_OpenLastBtn_pressed() -> void:
|
||||
Global.control.file_menu_id_pressed(2)
|
||||
visible = false
|
||||
|
||||
func _on_ImportBtn_pressed():
|
||||
|
||||
func _on_ImportBtn_pressed() -> void:
|
||||
Global.control.file_menu_id_pressed(5)
|
||||
visible = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue