mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
[skip ci] Minor static typing and docstring improvements
This commit is contained in:
parent
2e5f2e22c1
commit
0fb89bf888
|
@ -16,16 +16,11 @@ extends RefCounted
|
|||
## Here is an example of how a new tag may be created ([b]with[/b] undo-redo functionality)
|
||||
## [codeblock]
|
||||
##func create_tag(tag_name: StringName, color: Color, from: int, to: int):
|
||||
## var new_animation_tags := Global.current_project.animation_tags.duplicate()
|
||||
## var new_animation_tags: Array[AnimationTag] = []
|
||||
## # Loop through the tags to create new classes for them, so that they won't be the same
|
||||
## # as Global.current_project.animation_tags's classes. Needed for undo/redo to work properly.
|
||||
## for i in new_animation_tags.size():
|
||||
## new_animation_tags[i] = AnimationTag.new(
|
||||
## new_animation_tags[i].name,
|
||||
## new_animation_tags[i].color,
|
||||
## new_animation_tags[i].from,
|
||||
## new_animation_tags[i].to
|
||||
## )
|
||||
## for tag in Global.current_project.animation_tags:
|
||||
## new_animation_tags.append(tag.duplicate())
|
||||
##
|
||||
## new_animation_tags.append(AnimationTag.new(tag_name, color, from, to))
|
||||
##
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
extends ConfirmationDialog
|
||||
|
||||
# Emitted when user confirms their changes
|
||||
## Emitted when user confirms their changes
|
||||
signal saved(preset, name, comment, width, height, add_alpha_colors, colors_from)
|
||||
|
||||
# Reference to current palette stored when dialog opens
|
||||
## Reference to current palette stored when dialog opens
|
||||
var current_palette: Palette
|
||||
|
||||
@onready var preset_input := $VBoxContainer/PaletteMetadata/Preset
|
||||
@onready var name_input := $VBoxContainer/PaletteMetadata/Name
|
||||
@onready var comment_input := $VBoxContainer/PaletteMetadata/Comment
|
||||
@onready var width_input := $VBoxContainer/PaletteMetadata/Width
|
||||
@onready var height_input := $VBoxContainer/PaletteMetadata/Height
|
||||
@onready var alpha_colors_input := $VBoxContainer/ColorsSettings/AddAlphaColors
|
||||
@onready var get_colors_from_input := $VBoxContainer/ColorsSettings/GetColorsFrom/GetColorsFrom
|
||||
@onready var preset_input := $VBoxContainer/PaletteMetadata/Preset as OptionButton
|
||||
@onready var name_input := $VBoxContainer/PaletteMetadata/Name as LineEdit
|
||||
@onready var comment_input := $VBoxContainer/PaletteMetadata/Comment as TextEdit
|
||||
@onready var width_input := $VBoxContainer/PaletteMetadata/Width as SpinBox
|
||||
@onready var height_input := $VBoxContainer/PaletteMetadata/Height as SpinBox
|
||||
@onready var alpha_colors_input := $VBoxContainer/ColorsSettings/AddAlphaColors as CheckBox
|
||||
@onready var get_colors_from_input := (
|
||||
$VBoxContainer/ColorsSettings/GetColorsFrom/GetColorsFrom as OptionButton
|
||||
)
|
||||
|
||||
@onready var colors_settings := $VBoxContainer/ColorsSettings
|
||||
@onready var already_exists_warning := $VBoxContainer/AlreadyExistsWarning
|
||||
@onready var enter_name_warning := $VBoxContainer/EnterNameWarning
|
||||
@onready var colors_settings := $VBoxContainer/ColorsSettings as VBoxContainer
|
||||
@onready var already_exists_warning := $VBoxContainer/AlreadyExistsWarning as Label
|
||||
@onready var enter_name_warning := $VBoxContainer/EnterNameWarning as Label
|
||||
|
||||
|
||||
# Opens dialog
|
||||
## Opens dialog
|
||||
func open(opened_current_palette: Palette) -> void:
|
||||
# Only to fill dialog when preset is FROM_CURRENT_PALETTE
|
||||
current_palette = opened_current_palette
|
||||
|
@ -45,7 +47,7 @@ func open(opened_current_palette: Palette) -> void:
|
|||
height_input.editable = true
|
||||
|
||||
|
||||
# Resets all dialog values to default
|
||||
## Resets all dialog values to default
|
||||
func set_default_values() -> void:
|
||||
name_input.text = ""
|
||||
comment_input.text = ""
|
||||
|
@ -55,7 +57,7 @@ func set_default_values() -> void:
|
|||
get_colors_from_input.selected = Palettes.GetColorsFrom.CURRENT_FRAME
|
||||
|
||||
|
||||
# Shows/hides a warning when palette already exists
|
||||
## Shows/hides a warning when palette already exists
|
||||
func toggle_already_exists_warning(to_show: bool) -> void:
|
||||
already_exists_warning.visible = to_show
|
||||
|
||||
|
@ -115,7 +117,7 @@ func _on_Preset_item_selected(index: int) -> void:
|
|||
set_default_values()
|
||||
|
||||
|
||||
func _on_Name_text_changed(new_name):
|
||||
func _on_Name_text_changed(new_name: String) -> void:
|
||||
var disable_warning := false
|
||||
if Palettes.does_palette_exist(new_name):
|
||||
disable_warning = true
|
||||
|
|
Loading…
Reference in a new issue