mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
More static typing improvements
This commit is contained in:
parent
572fabbe66
commit
6d2d09d222
|
@ -80,10 +80,10 @@ func _ready() -> void:
|
|||
_add_extension(file_name)
|
||||
|
||||
|
||||
## This is an empty function at the moment, but internal extensions here should be added here
|
||||
## For example:
|
||||
## [code]read_extension("ExtensionName", true)[/code]
|
||||
func _add_internal_extensions() -> void:
|
||||
## at the moment this is an empty function but you should add all internal extensions here
|
||||
# for example:
|
||||
#read_extension("ExtensionName", true)
|
||||
pass
|
||||
|
||||
|
||||
|
@ -180,7 +180,7 @@ func _add_extension(file_name: String) -> void:
|
|||
read_extension(file_name)
|
||||
|
||||
|
||||
func read_extension(extension_file_or_folder_name: StringName, internal := false):
|
||||
func read_extension(extension_file_or_folder_name: StringName, internal := false) -> void:
|
||||
var file_name_no_ext := extension_file_or_folder_name.get_basename()
|
||||
var extension_path := "res://src/Extensions/%s/" % file_name_no_ext
|
||||
var extension_config_file_path := extension_path.path_join("extension.json")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class_name Patterns
|
||||
extends PopupPanel
|
||||
|
||||
signal pattern_selected(pattern)
|
||||
signal pattern_selected(pattern: Pattern)
|
||||
|
||||
var default_pattern: Pattern = null
|
||||
|
||||
|
@ -31,10 +31,10 @@ func create_button(image: Image) -> Node:
|
|||
|
||||
|
||||
func add(image: Image, hint := "") -> void:
|
||||
var button = create_button(image)
|
||||
var button := create_button(image)
|
||||
button.pattern.image = image
|
||||
button.tooltip_text = hint
|
||||
var container = get_node("ScrollContainer/PatternContainer")
|
||||
var container := get_node("ScrollContainer/PatternContainer")
|
||||
container.add_child(button)
|
||||
button.pattern.index = button.get_index()
|
||||
|
||||
|
@ -44,7 +44,7 @@ func add(image: Image, hint := "") -> void:
|
|||
|
||||
func get_pattern(index: int) -> Pattern:
|
||||
var container = Global.patterns_popup.get_node("ScrollContainer/PatternContainer")
|
||||
var pattern = default_pattern
|
||||
var pattern := default_pattern
|
||||
if index < container.get_child_count():
|
||||
pattern = container.get_child(index).pattern
|
||||
return pattern
|
||||
|
|
|
@ -19,7 +19,7 @@ func _ready() -> void:
|
|||
draw_guide_line()
|
||||
|
||||
|
||||
func draw_guide_line():
|
||||
func draw_guide_line() -> void:
|
||||
if type == Types.HORIZONTAL:
|
||||
points[0] = Vector2(-19999, 0)
|
||||
points[1] = Vector2(19999, 0)
|
||||
|
|
|
@ -229,7 +229,7 @@ func get_transformed_rect_polygon(rect: Rect2, t: Transform2D) -> PackedVector2A
|
|||
return final
|
||||
|
||||
|
||||
func populate_reference_menu(items: Array[ReferenceImage], default := false):
|
||||
func populate_reference_menu(items: Array[ReferenceImage], default := false) -> void:
|
||||
reference_menu.clear()
|
||||
# Default / Reset
|
||||
if default:
|
||||
|
@ -320,7 +320,7 @@ func _draw() -> void:
|
|||
# If we are dragging show where the Reference was coming from
|
||||
if dragging:
|
||||
var i: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
var prev_transform = Transform2D(og_rotation, og_scale, 0.0, og_pos)
|
||||
var prev_transform := Transform2D(og_rotation, og_scale, 0.0, og_pos)
|
||||
var prev_poly := get_transformed_rect_polygon(i.get_rect(), prev_transform)
|
||||
prev_poly.append(prev_poly[0])
|
||||
draw_polyline(prev_poly, Color(1, 0.29, 0.29), line_width)
|
||||
|
|
|
@ -807,7 +807,7 @@ func delete(selected_cels := true) -> void:
|
|||
|
||||
## Makes a project brush out of the current selection's content.
|
||||
func new_brush() -> void:
|
||||
var brush = get_enclosed_image()
|
||||
var brush := get_enclosed_image()
|
||||
if brush and !brush.is_invisible():
|
||||
var brush_used: Image = brush.get_region(brush.get_used_rect())
|
||||
Global.current_project.brushes.append(brush_used)
|
||||
|
|
|
@ -121,11 +121,11 @@ func _average(color_1: Color, color_2: Color) -> void:
|
|||
average_color.color = average
|
||||
|
||||
|
||||
func _on_CopyAverage_button_down():
|
||||
func _on_CopyAverage_button_down() -> void:
|
||||
average_color.visible = false
|
||||
|
||||
|
||||
func _on_CopyAverage_button_up():
|
||||
func _on_CopyAverage_button_up() -> void:
|
||||
average_color.visible = true
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ func _on_TileModeOffsetsDialog_about_to_show() -> void:
|
|||
update_preview()
|
||||
|
||||
|
||||
func _show_options():
|
||||
func _show_options() -> void:
|
||||
x_basis_x_spinbox.visible = true
|
||||
x_basis_y_spinbox.visible = true
|
||||
y_basis_x_spinbox.visible = true
|
||||
|
@ -102,12 +102,12 @@ func _on_TileModeOffsetsDialog_visibility_changed() -> void:
|
|||
Global.dialog_open(false)
|
||||
|
||||
|
||||
func _on_TileModeOffsetsDialog_size_changed():
|
||||
func _on_TileModeOffsetsDialog_size_changed() -> void:
|
||||
if tile_mode:
|
||||
update_preview()
|
||||
|
||||
|
||||
func _on_Reset_pressed():
|
||||
func _on_Reset_pressed() -> void:
|
||||
tile_mode.tiles.x_basis = Vector2i(Global.current_project.size.x, 0)
|
||||
tile_mode.tiles.y_basis = Vector2i(0, Global.current_project.size.y)
|
||||
x_basis_x_spinbox.value = Global.current_project.size.x
|
||||
|
@ -117,7 +117,7 @@ func _on_Reset_pressed():
|
|||
update_preview()
|
||||
|
||||
|
||||
func change_mask():
|
||||
func change_mask() -> void:
|
||||
if Global.current_project.tiles.mode == Tiles.MODE.NONE:
|
||||
return
|
||||
var frame_idx := Global.current_project.current_frame
|
||||
|
@ -135,7 +135,7 @@ func change_mask():
|
|||
load_mask(image)
|
||||
|
||||
|
||||
func load_mask(image: Image):
|
||||
func load_mask(image: Image) -> void:
|
||||
Global.current_project.tiles.tile_mask = image
|
||||
Global.current_project.tiles.has_mask = true
|
||||
|
||||
|
|
|
@ -1,49 +1,40 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://collailpx6ft5"]
|
||||
|
||||
[ext_resource path="res://src/UI/Nodes/ValueSlider.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://src/UI/Nodes/CollapsibleContainer.gd" type="Script" id=3]
|
||||
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="1"]
|
||||
[ext_resource type="Script" path="res://src/UI/Nodes/CollapsibleContainer.gd" id="3"]
|
||||
|
||||
[node name="LineButton" type="VBoxContainer"]
|
||||
offset_right = 159.0
|
||||
offset_bottom = 20.0
|
||||
theme_type_variation = "CollapsibleContainer"
|
||||
script = ExtResource( 3 )
|
||||
theme_type_variation = &"CollapsibleContainer"
|
||||
script = ExtResource("3")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
visible = false
|
||||
offset_top = 24.0
|
||||
offset_right = 159.0
|
||||
offset_bottom = 76.0
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Spacer" type="Control" parent="HBoxContainer"]
|
||||
offset_right = 20.0
|
||||
offset_bottom = 52.0
|
||||
custom_minimum_size = Vector2(20, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="HBoxContainer"]
|
||||
offset_left = 24.0
|
||||
offset_right = 28.0
|
||||
offset_bottom = 52.0
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Properties" type="VBoxContainer" parent="HBoxContainer"]
|
||||
offset_left = 32.0
|
||||
offset_right = 83.0
|
||||
offset_bottom = 52.0
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="AngleSlider" parent="HBoxContainer/Properties" instance=ExtResource( 1 )]
|
||||
offset_right = 51.0
|
||||
[node name="AngleSlider" parent="HBoxContainer/Properties" instance=ExtResource("1")]
|
||||
layout_mode = 2
|
||||
max_value = 359.999
|
||||
step = 0.001
|
||||
allow_greater = true
|
||||
prefix = "Angle:"
|
||||
suffix = "°"
|
||||
|
||||
[node name="LengthSlider" parent="HBoxContainer/Properties" instance=ExtResource( 1 )]
|
||||
[node name="LengthSlider" parent="HBoxContainer/Properties" instance=ExtResource("1")]
|
||||
unique_name_in_owner = true
|
||||
offset_top = 28.0
|
||||
offset_right = 51.0
|
||||
offset_bottom = 52.0
|
||||
layout_mode = 2
|
||||
min_value = 1.0
|
||||
max_value = 19999.0
|
||||
value = 19999.0
|
||||
|
@ -52,12 +43,8 @@ prefix = "Length:"
|
|||
suffix = "px"
|
||||
|
||||
[node name="Delete" type="Button" parent="HBoxContainer"]
|
||||
offset_left = 87.0
|
||||
offset_right = 151.0
|
||||
offset_bottom = 52.0
|
||||
layout_mode = 2
|
||||
text = "Remove"
|
||||
|
||||
[node name="VSeparator2" type="VSeparator" parent="HBoxContainer"]
|
||||
offset_left = 155.0
|
||||
offset_right = 159.0
|
||||
offset_bottom = 52.0
|
||||
layout_mode = 2
|
||||
|
|
|
@ -55,7 +55,7 @@ func delete_point(idx: int) -> void:
|
|||
|
||||
|
||||
func do_delete_point(idx: int) -> void:
|
||||
var point = vanishing_point_container.get_child(idx)
|
||||
var point := vanishing_point_container.get_child(idx)
|
||||
delete_pool.append(point.serialize())
|
||||
point.queue_free()
|
||||
point.update_data_to_project(true)
|
||||
|
|
|
@ -7,10 +7,10 @@ const CIRCLE_RAD := 4
|
|||
var angle := 0
|
||||
var length := 19999
|
||||
|
||||
var is_hidden = false
|
||||
var is_hidden := false
|
||||
var has_focus := false
|
||||
var track_mouse := false
|
||||
var change_length = false
|
||||
var change_length := false
|
||||
|
||||
var line_button: Node
|
||||
var _vanishing_point: Node
|
||||
|
@ -20,14 +20,14 @@ func serialize() -> Dictionary:
|
|||
return {"angle": angle, "length": length}
|
||||
|
||||
|
||||
func deserialize(data: Dictionary):
|
||||
func deserialize(data: Dictionary) -> void:
|
||||
if data.has("angle"):
|
||||
angle = data.angle
|
||||
if data.has("length"):
|
||||
length = data.length
|
||||
|
||||
|
||||
func initiate(data: Dictionary, vanishing_point: Node):
|
||||
func initiate(data: Dictionary, vanishing_point: Node) -> void:
|
||||
_vanishing_point = vanishing_point
|
||||
Global.canvas.add_child(self)
|
||||
deserialize(data)
|
||||
|
@ -37,12 +37,12 @@ func initiate(data: Dictionary, vanishing_point: Node):
|
|||
refresh()
|
||||
|
||||
|
||||
func refresh():
|
||||
func refresh() -> void:
|
||||
default_color = _vanishing_point.color
|
||||
draw_perspective_line()
|
||||
|
||||
|
||||
func draw_perspective_line():
|
||||
func draw_perspective_line() -> void:
|
||||
var start := Vector2(_vanishing_point.pos_x.value, _vanishing_point.pos_y.value)
|
||||
points[0] = start
|
||||
if is_hidden:
|
||||
|
@ -53,7 +53,7 @@ func draw_perspective_line():
|
|||
)
|
||||
|
||||
|
||||
func hide_perspective_line():
|
||||
func hide_perspective_line() -> void:
|
||||
var start := Vector2(_vanishing_point.pos_x.value, _vanishing_point.pos_y.value)
|
||||
points[1] = start
|
||||
is_hidden = true
|
||||
|
@ -88,7 +88,7 @@ func _input(event: InputEvent) -> void:
|
|||
queue_redraw()
|
||||
|
||||
|
||||
func try_rotate_scale():
|
||||
func try_rotate_scale() -> void:
|
||||
var mouse_point := Global.canvas.current_pixel
|
||||
var project_size := Global.current_project.size
|
||||
var test_line := (points[1] - points[0]).rotated(deg_to_rad(90)).normalized()
|
||||
|
|
|
@ -5,10 +5,10 @@ var perspective_lines := []
|
|||
var color := Color(randf(), randf(), randf(), 1)
|
||||
|
||||
var tracker_line: PerspectiveLine
|
||||
@onready var color_picker_button = $"%ColorPickerButton"
|
||||
@onready var color_picker_button := $"%ColorPickerButton" as ColorPickerButton
|
||||
@onready var title := $"%PointCollapseContainer"
|
||||
@onready var pos_x := $"%X"
|
||||
@onready var pos_y := $"%Y"
|
||||
@onready var pos_y := $"%Y" as ValueSlider
|
||||
@onready var pos_x := $"%X" as ValueSlider
|
||||
@onready var line_buttons_container := $"%LinesContainer"
|
||||
@onready var boundary_l := $Content/BoundaryL
|
||||
@onready var boundary_r := $Content/BoundaryR
|
||||
|
@ -19,7 +19,7 @@ func serialize() -> Dictionary:
|
|||
var lines_data := []
|
||||
for line in perspective_lines:
|
||||
lines_data.append(line.serialize())
|
||||
var data = {
|
||||
var data := {
|
||||
"pos_x": pos_x.value,
|
||||
"pos_y": pos_y.value,
|
||||
"lines": lines_data,
|
||||
|
@ -28,7 +28,7 @@ func serialize() -> Dictionary:
|
|||
return data
|
||||
|
||||
|
||||
func deserialize(start_data: Dictionary):
|
||||
func deserialize(start_data: Dictionary) -> void:
|
||||
if start_data: # Data is not {} means the project knows about this point
|
||||
if start_data.has("pos_x") and start_data.has("pos_y"):
|
||||
pos_x.value = start_data.pos_x
|
||||
|
@ -47,7 +47,7 @@ func deserialize(start_data: Dictionary):
|
|||
update_boundary_color()
|
||||
|
||||
|
||||
func initiate(start_data: Dictionary = {}, idx = -1) -> void:
|
||||
func initiate(start_data := {}, idx := -1) -> void:
|
||||
deserialize(start_data)
|
||||
# Title of Vanishing point button
|
||||
if idx != -1: # If the initialization is part of a Redo
|
||||
|
@ -60,7 +60,7 @@ func initiate(start_data: Dictionary = {}, idx = -1) -> void:
|
|||
pos_y.value_changed.connect(_on_pos_value_changed)
|
||||
|
||||
|
||||
func update_boundary_color():
|
||||
func update_boundary_color() -> void:
|
||||
var luminance := (0.2126 * color.r) + (0.7152 * color.g) + (0.0722 * color.b)
|
||||
color.a = 0.9 - luminance * 0.4 # Interpolates between 0.5 to 0.9
|
||||
boundary_l.color = color
|
||||
|
@ -68,10 +68,10 @@ func update_boundary_color():
|
|||
boundary_b.color = color
|
||||
|
||||
|
||||
func _input(_event: InputEvent):
|
||||
var mouse_point = Global.canvas.current_pixel
|
||||
var project_size = Global.current_project.size
|
||||
var start = Vector2(pos_x.value, pos_y.value)
|
||||
func _input(_event: InputEvent) -> void:
|
||||
var mouse_point := Global.canvas.current_pixel
|
||||
var project_size := Global.current_project.size
|
||||
var start := Vector2(pos_x.value, pos_y.value)
|
||||
if (
|
||||
Input.is_action_just_pressed("left_mouse")
|
||||
and Global.can_draw
|
||||
|
@ -104,7 +104,7 @@ func _on_Delete_pressed() -> void:
|
|||
Global.perspective_editor.delete_point(get_index())
|
||||
|
||||
|
||||
func _on_color_changed(_color: Color):
|
||||
func _on_color_changed(_color: Color) -> void:
|
||||
update_boundary_color()
|
||||
color = _color
|
||||
refresh(-1)
|
||||
|
@ -116,32 +116,32 @@ func _on_pos_value_changed(_value: float) -> void:
|
|||
update_data_to_project()
|
||||
|
||||
|
||||
func angle_changed(value: float, line_button):
|
||||
func angle_changed(value: float, line_button: Node) -> void:
|
||||
# check if the properties are changing the line or is the line changing properties
|
||||
var angle_slider = line_button.find_child("AngleSlider")
|
||||
var angle_slider := line_button.find_child("AngleSlider")
|
||||
if angle_slider.value != value: # the line is changing the properties
|
||||
angle_slider.value = value
|
||||
else:
|
||||
var line_index = line_button.get_index()
|
||||
var line_index := line_button.get_index()
|
||||
perspective_lines[line_index].angle = value
|
||||
refresh(line_index)
|
||||
update_data_to_project()
|
||||
|
||||
|
||||
func length_changed(value: float, line_button):
|
||||
func length_changed(value: float, line_button: Node) -> void:
|
||||
# check if the properties are changing the line or is the line changing properties
|
||||
var length_slider = line_button.find_child("LengthSlider")
|
||||
var length_slider := line_button.find_child("LengthSlider")
|
||||
if length_slider.value != value: # the line is changing the properties
|
||||
length_slider.value = value
|
||||
else:
|
||||
var line_index = line_button.get_index()
|
||||
var line_index := line_button.get_index()
|
||||
perspective_lines[line_index].length = value
|
||||
refresh(line_index)
|
||||
update_data_to_project()
|
||||
|
||||
|
||||
func _remove_line_pressed(line_button):
|
||||
var index = line_button.get_index()
|
||||
func _remove_line_pressed(line_button: Node) -> void:
|
||||
var index := line_button.get_index()
|
||||
remove_line(index)
|
||||
line_button.queue_free()
|
||||
update_data_to_project()
|
||||
|
@ -159,7 +159,7 @@ func generate_line_data(initial_data: Dictionary = {}) -> Dictionary:
|
|||
return line_data
|
||||
|
||||
|
||||
func add_line(loaded_line_data := {}, is_tracker := false):
|
||||
func add_line(loaded_line_data := {}, is_tracker := false) -> void:
|
||||
var p_size := Global.current_project.size # for use later in function
|
||||
|
||||
# Note: line_data will automatically get default values if loaded_line_data = {}
|
||||
|
@ -190,7 +190,7 @@ func add_line(loaded_line_data := {}, is_tracker := false):
|
|||
else: # Settings for Normal mode
|
||||
var line_button := preload("res://src/UI/PerspectiveEditor/LineButton.tscn").instantiate()
|
||||
line_buttons_container.add_child(line_button)
|
||||
var index = line_button.get_parent().get_child_count() - 2
|
||||
var index := line_button.get_parent().get_child_count() - 2
|
||||
line_button.get_parent().move_child(line_button, index)
|
||||
|
||||
var line_name := str("Line", line_button.get_index() + 1, " (", absi(line_data.angle), "°)")
|
||||
|
@ -210,13 +210,13 @@ func add_line(loaded_line_data := {}, is_tracker := false):
|
|||
perspective_lines.append(line)
|
||||
|
||||
|
||||
func remove_line(line_index):
|
||||
func remove_line(line_index: int) -> void:
|
||||
var line_to_remove = perspective_lines[line_index]
|
||||
perspective_lines.remove_at(line_index)
|
||||
line_to_remove.queue_free()
|
||||
|
||||
|
||||
func update_data_to_project(removal := false):
|
||||
func update_data_to_project(removal := false) -> void:
|
||||
var project := Global.current_project
|
||||
var idx := get_index()
|
||||
# If deletion is requested
|
||||
|
@ -233,7 +233,7 @@ func update_data_to_project(removal := false):
|
|||
Global.current_project.has_changed = true
|
||||
|
||||
|
||||
func refresh(index: int):
|
||||
func refresh(index: int) -> void:
|
||||
if index == -1: # means all lines should be refreshed (including the tracker line)
|
||||
refresh_tracker()
|
||||
for i in perspective_lines.size():
|
||||
|
@ -242,15 +242,15 @@ func refresh(index: int):
|
|||
refresh_line(index)
|
||||
|
||||
|
||||
func refresh_line(index: int):
|
||||
var line_button = line_buttons_container.get_child(index)
|
||||
func refresh_line(index: int) -> void:
|
||||
var line_button := line_buttons_container.get_child(index)
|
||||
var line_data = perspective_lines[index].serialize()
|
||||
var line_name := str("Line", line_button.get_index() + 1, " (", absi(line_data.angle), "°)")
|
||||
line_button.text = line_name
|
||||
perspective_lines[index].refresh()
|
||||
|
||||
|
||||
func refresh_tracker():
|
||||
func refresh_tracker() -> void:
|
||||
tracker_line.refresh()
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ func _ready() -> void:
|
|||
references_container.reference_image_changed.connect(_on_reference_image_changed)
|
||||
|
||||
|
||||
func _update_properties():
|
||||
func _update_properties() -> void:
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
if !ri:
|
||||
return
|
||||
|
@ -121,7 +121,7 @@ func _on_Filter_toggled(pressed: bool) -> void:
|
|||
ri.filter = pressed
|
||||
|
||||
|
||||
func _on_Reset_pressed():
|
||||
func _on_Reset_pressed() -> void:
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
if !ri:
|
||||
return
|
||||
|
@ -130,7 +130,7 @@ func _on_Reset_pressed():
|
|||
references_container.commit_undo("Reset Reference Image Position", undo_data_tmp)
|
||||
|
||||
|
||||
func _on_Remove_pressed():
|
||||
func _on_Remove_pressed() -> void:
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
if !ri:
|
||||
return
|
||||
|
@ -146,7 +146,7 @@ func _on_Remove_pressed():
|
|||
Global.dialog_open(true)
|
||||
|
||||
|
||||
func _on_X_value_changed(value: float):
|
||||
func _on_X_value_changed(value: float) -> void:
|
||||
if _ignore_spinbox_changes:
|
||||
return
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
|
@ -158,7 +158,7 @@ func _on_X_value_changed(value: float):
|
|||
ri.position.x = value
|
||||
|
||||
|
||||
func _on_Y_value_changed(value: float):
|
||||
func _on_Y_value_changed(value: float) -> void:
|
||||
if _ignore_spinbox_changes:
|
||||
return
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
|
@ -170,7 +170,7 @@ func _on_Y_value_changed(value: float):
|
|||
ri.position.y = value
|
||||
|
||||
|
||||
func _on_Scale_value_changed(value: float):
|
||||
func _on_Scale_value_changed(value: float) -> void:
|
||||
if _ignore_spinbox_changes:
|
||||
return
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
|
@ -183,7 +183,7 @@ func _on_Scale_value_changed(value: float):
|
|||
ri.scale.y = value / 100
|
||||
|
||||
|
||||
func _on_Rotation_value_changed(value: float):
|
||||
func _on_Rotation_value_changed(value: float) -> void:
|
||||
if _ignore_spinbox_changes:
|
||||
return
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
|
@ -195,7 +195,7 @@ func _on_Rotation_value_changed(value: float):
|
|||
ri.rotation_degrees = value
|
||||
|
||||
|
||||
func _on_Overlay_color_changed(color: Color):
|
||||
func _on_Overlay_color_changed(color: Color) -> void:
|
||||
if _ignore_spinbox_changes:
|
||||
return
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
|
@ -207,7 +207,7 @@ func _on_Overlay_color_changed(color: Color):
|
|||
ri.overlay_color = Color(color, ri.overlay_color.a)
|
||||
|
||||
|
||||
func _on_Opacity_value_changed(value: float):
|
||||
func _on_Opacity_value_changed(value: float) -> void:
|
||||
if _ignore_spinbox_changes:
|
||||
return
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
|
@ -219,7 +219,7 @@ func _on_Opacity_value_changed(value: float):
|
|||
ri.overlay_color.a = value / 100
|
||||
|
||||
|
||||
func _on_ColorClamping_value_changed(value: float):
|
||||
func _on_ColorClamping_value_changed(value: float) -> void:
|
||||
if _ignore_spinbox_changes:
|
||||
return
|
||||
var ri: ReferenceImage = Global.current_project.get_current_reference_image()
|
||||
|
|
|
@ -156,7 +156,7 @@ func _on_LayerVBox_resized() -> void:
|
|||
adjust_scroll_container()
|
||||
|
||||
|
||||
func adjust_scroll_container():
|
||||
func adjust_scroll_container() -> void:
|
||||
tag_spacer.custom_minimum_size.x = (
|
||||
frame_scroll_container.global_position.x - tag_scroll_container.global_position.x
|
||||
)
|
||||
|
@ -386,7 +386,7 @@ func copy_frames(
|
|||
)
|
||||
project.undos += 1
|
||||
project.undo_redo.create_action("Add Frame")
|
||||
var last_focus_cels = []
|
||||
var last_focus_cels := []
|
||||
for f in indices:
|
||||
var src_frame := project.frames[f]
|
||||
var new_frame := Frame.new()
|
||||
|
@ -453,7 +453,7 @@ func copy_frames(
|
|||
project.undo_redo.add_do_method(project.add_frames.bind(copied_frames, copied_indices))
|
||||
project.undo_redo.add_undo_method(project.remove_frames.bind(copied_indices))
|
||||
if select_all_cels:
|
||||
var all_new_cels = []
|
||||
var all_new_cels := []
|
||||
# Select all the new frames so that it is easier to move/offset collectively if user wants
|
||||
# To ease animation workflow, new current frame is the first copied frame instead of the last
|
||||
var range_start := copied_indices[-1]
|
||||
|
@ -884,7 +884,7 @@ func change_layer_order(up: bool) -> void:
|
|||
for l in from_indices:
|
||||
from_parents.append(project.layers[l].parent)
|
||||
var to_parents := from_parents.duplicate()
|
||||
var to_index = layer.index - child_count # the index where the LOWEST shifted layer should end up
|
||||
var to_index := layer.index - child_count # the index where the LOWEST shifted layer should end up
|
||||
|
||||
if up:
|
||||
var above_layer := project.layers[project.current_layer + 1]
|
||||
|
@ -1091,10 +1091,10 @@ func project_changed() -> void:
|
|||
if layer < vbox_child_count:
|
||||
var cel_hbox: HBoxContainer = Global.cel_vbox.get_child(vbox_child_count - 1 - layer)
|
||||
if frame < cel_hbox.get_child_count():
|
||||
var cel_button = cel_hbox.get_child(frame)
|
||||
var cel_button := cel_hbox.get_child(frame)
|
||||
cel_button.button_pressed = true
|
||||
|
||||
var layer_button = Global.layer_vbox.get_child(vbox_child_count - 1 - layer)
|
||||
var layer_button := Global.layer_vbox.get_child(vbox_child_count - 1 - layer)
|
||||
layer_button.button_pressed = true
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
extends ConfirmationDialog
|
||||
|
||||
var frame_indices := []
|
||||
@onready var frame_num = $GridContainer/FrameNum
|
||||
@onready var frame_dur = $GridContainer/FrameTime
|
||||
@onready var frame_num := $GridContainer/FrameNum
|
||||
@onready var frame_dur := $GridContainer/FrameTime
|
||||
|
||||
|
||||
func _on_FrameProperties_about_to_show() -> void:
|
||||
|
|
|
@ -5,7 +5,7 @@ const PADDING := 1
|
|||
@export var h_scroll_bar: HScrollBar
|
||||
|
||||
|
||||
func _ready():
|
||||
func _ready() -> void:
|
||||
sort_children.connect(_on_sort_children)
|
||||
if is_instance_valid(h_scroll_bar):
|
||||
h_scroll_bar.resized.connect(_update_scroll)
|
||||
|
@ -34,7 +34,7 @@ func _update_scroll() -> void:
|
|||
get_child(0).position.x = -h_scroll_bar.value + PADDING
|
||||
|
||||
|
||||
func ensure_control_visible(control: Control):
|
||||
func ensure_control_visible(control: Control) -> void:
|
||||
if not is_instance_valid(control):
|
||||
return
|
||||
# Based on Godot's implementation in ScrollContainer
|
||||
|
|
|
@ -6,7 +6,7 @@ var delete_tag_button: Button
|
|||
|
||||
@onready var main_vbox_cont: VBoxContainer = $VBoxContainer/ScrollContainer/VBoxTagContainer
|
||||
@onready var add_tag_button: Button = $VBoxContainer/ScrollContainer/VBoxTagContainer/AddTag
|
||||
@onready var options_dialog = $TagOptions
|
||||
@onready var options_dialog := $TagOptions
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -79,8 +79,8 @@ func _on_AddTag_pressed() -> void:
|
|||
|
||||
|
||||
func _on_EditButton_pressed(_tag_id: int, edit_button: Button) -> void:
|
||||
var x_pos = edit_button.global_position.x
|
||||
var y_pos = edit_button.global_position.y + 2 * edit_button.size.y
|
||||
var x_pos := edit_button.global_position.x
|
||||
var y_pos := edit_button.global_position.y + 2 * edit_button.size.y
|
||||
options_dialog.popup(Rect2i(position + Vector2i(x_pos, y_pos), options_dialog.size))
|
||||
current_tag_id = _tag_id
|
||||
var animation_tag: AnimationTag = Global.current_project.animation_tags[_tag_id]
|
||||
|
|
|
@ -21,10 +21,10 @@ func _ready() -> void:
|
|||
func refresh_list() -> void:
|
||||
animation_tags_list.clear()
|
||||
for tag in from_project.animation_tags:
|
||||
var img = Image.create(5, 5, true, Image.FORMAT_RGBA8)
|
||||
var img := Image.create(5, 5, true, Image.FORMAT_RGBA8)
|
||||
img.fill(tag.color)
|
||||
var tex = ImageTexture.create_from_image(img)
|
||||
var tag_title = tag.name
|
||||
var tex := ImageTexture.create_from_image(img)
|
||||
var tag_title := tag.name
|
||||
if tag_title == "":
|
||||
tag_title = "(Untitled)"
|
||||
animation_tags_list.add_item(tag_title, tex)
|
||||
|
@ -60,7 +60,7 @@ func _on_FromProject_changed(id: int) -> void:
|
|||
|
||||
func _on_TagList_id_pressed(id: int) -> void:
|
||||
var tag: AnimationTag = from_project.animation_tags[id]
|
||||
var frames = []
|
||||
var frames := []
|
||||
for i in range(tag.from - 1, tag.to):
|
||||
frames.append(i)
|
||||
if create_new_tags:
|
||||
|
@ -71,7 +71,7 @@ func _on_TagList_id_pressed(id: int) -> void:
|
|||
|
||||
|
||||
## Gets frame indices of [member from_project] and dumps it in the current project.
|
||||
func add_animation(indices: Array, destination: int, from_tag: AnimationTag = null):
|
||||
func add_animation(indices: Array, destination: int, from_tag: AnimationTag = null) -> void:
|
||||
var project: Project = Global.current_project
|
||||
if from_project == project: ## If we are copying tags within project
|
||||
Global.animation_timeline.copy_frames(indices, destination, true, from_tag)
|
||||
|
@ -212,7 +212,7 @@ func add_animation(indices: Array, destination: int, from_tag: AnimationTag = nu
|
|||
project.undo_redo.add_do_property(Global.current_project, "selected_cels", [])
|
||||
project.undo_redo.add_undo_property(Global.current_project, "selected_cels", [])
|
||||
|
||||
var all_new_cels = []
|
||||
var all_new_cels := []
|
||||
# Select all the new frames so that it is easier to move/offset collectively if user wants
|
||||
# To ease animation workflow, new current frame is the first copied frame instead of the last
|
||||
var range_start: int = copied_indices[-1]
|
||||
|
|
|
@ -485,8 +485,7 @@ func _on_open_last_project_file_menu_option_pressed() -> void:
|
|||
if Global.config_cache.has_section_key("data", "last_project_path"):
|
||||
Global.control.load_last_project()
|
||||
else:
|
||||
Global.error_dialog.set_text("You haven't saved or opened any project in Pixelorama yet!")
|
||||
_popup_dialog(Global.error_dialog)
|
||||
Global.popup_error("You haven't saved or opened any project in Pixelorama yet!")
|
||||
|
||||
|
||||
func _save_project_file() -> void:
|
||||
|
|
Loading…
Reference in a new issue