mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fix multiple inferring errors
This commit is contained in:
parent
d6a199c53f
commit
a1ed703b56
|
@ -1,6 +1,6 @@
|
|||
extends BaseButton
|
||||
|
||||
export var brush_type = Global.BRUSH_TYPES.PIXEL
|
||||
export var brush_type = 0 # Global.BRUSH_TYPES.PIXEL
|
||||
export var custom_brush_index := -3
|
||||
# warning-ignore:unused_class_variable
|
||||
var random_brushes := []
|
||||
|
@ -77,7 +77,7 @@ func _on_DeleteButton_pressed() -> void:
|
|||
Global.undo_redo.add_do_property(bb, "custom_brush_index", bb.custom_brush_index - 1)
|
||||
Global.undo_redo.add_undo_property(bb, "custom_brush_index", bb.custom_brush_index)
|
||||
|
||||
var custom_brushes := Global.custom_brushes.duplicate()
|
||||
var custom_brushes: Array = Global.custom_brushes.duplicate()
|
||||
custom_brushes.remove(custom_brush_index)
|
||||
|
||||
Global.undo_redo.add_do_property(Global, "custom_brushes", custom_brushes)
|
||||
|
|
|
@ -88,7 +88,7 @@ func _ready() -> void:
|
|||
TranslationServer.set_locale(saved_locale)
|
||||
|
||||
# Set the language option menu's default selected option to the loaded locale
|
||||
var locale_index := Global.loaded_locales.find(saved_locale)
|
||||
var locale_index: int = Global.loaded_locales.find(saved_locale)
|
||||
$PreferencesDialog.languages.get_child(1).pressed = false
|
||||
$PreferencesDialog.languages.get_child(locale_index + 2).pressed = true
|
||||
else: # If the user doesn't have a language preference, set it to their OS' locale
|
||||
|
@ -503,13 +503,13 @@ func _on_SaveSprite_file_selected(path) -> void:
|
|||
file.store_line("END_GUIDES")
|
||||
file.store_line("END_FRAMES")
|
||||
|
||||
#Save tool options
|
||||
var left_color := Global.left_color_picker.color
|
||||
var right_color := Global.right_color_picker.color
|
||||
var left_brush_size := Global.left_brush_size
|
||||
var right_brush_size := Global.right_brush_size
|
||||
var left_palette := Global.left_color_picker.get_picker().get_presets()
|
||||
var right_palette := Global.right_color_picker.get_picker().get_presets()
|
||||
# Save tool options
|
||||
var left_color: Color = Global.left_color_picker.color
|
||||
var right_color: Color = Global.right_color_picker.color
|
||||
var left_brush_size: int = Global.left_brush_size
|
||||
var right_brush_size: int = Global.right_brush_size
|
||||
var left_palette: PoolColorArray = Global.left_color_picker.get_picker().get_presets()
|
||||
var right_palette: PoolColorArray = Global.right_color_picker.get_picker().get_presets()
|
||||
file.store_var(left_color)
|
||||
file.store_var(right_color)
|
||||
file.store_8(left_brush_size)
|
||||
|
@ -534,7 +534,7 @@ func _on_ImportSprites_files_selected(paths) -> void:
|
|||
#Find the biggest image and let it handle the camera zoom options
|
||||
var max_size : Vector2
|
||||
var biggest_canvas : Canvas
|
||||
var i := Global.canvases.size()
|
||||
var i: int = Global.canvases.size()
|
||||
for path in paths:
|
||||
var image := Image.new()
|
||||
var err := image.load(path)
|
||||
|
@ -882,7 +882,7 @@ func add_layer(is_new := true) -> void:
|
|||
var new_layer_tex := ImageTexture.new()
|
||||
new_layer_tex.create_from_image(new_layer, 0)
|
||||
|
||||
var new_layers := Global.canvas.layers.duplicate()
|
||||
var new_layers: Array = Global.canvas.layers.duplicate()
|
||||
new_layers.append([new_layer, new_layer_tex, null, true, 1])
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Add Layer")
|
||||
|
@ -894,7 +894,7 @@ func add_layer(is_new := true) -> void:
|
|||
Global.undo_redo.commit_action()
|
||||
|
||||
func _on_RemoveLayerButton_pressed() -> void:
|
||||
var new_layers := Global.canvas.layers.duplicate()
|
||||
var new_layers: Array = Global.canvas.layers.duplicate()
|
||||
new_layers.remove(Global.canvas.current_layer_index)
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Remove Layer")
|
||||
|
@ -908,7 +908,7 @@ func _on_RemoveLayerButton_pressed() -> void:
|
|||
func change_layer_order(rate : int) -> void:
|
||||
var change = Global.canvas.current_layer_index + rate
|
||||
|
||||
var new_layers := Global.canvas.layers.duplicate()
|
||||
var new_layers: Array = Global.canvas.layers.duplicate()
|
||||
var temp = new_layers[Global.canvas.current_layer_index]
|
||||
new_layers[Global.canvas.current_layer_index] = new_layers[change]
|
||||
new_layers[change] = temp
|
||||
|
@ -923,7 +923,7 @@ func change_layer_order(rate : int) -> void:
|
|||
Global.undo_redo.commit_action()
|
||||
|
||||
func _on_MergeLayer_pressed() -> void:
|
||||
var new_layers := Global.canvas.layers.duplicate()
|
||||
var new_layers: Array = Global.canvas.layers.duplicate()
|
||||
new_layers.remove(Global.canvas.current_layer_index)
|
||||
var selected_layer = Global.canvas.layers[Global.canvas.current_layer_index][0]
|
||||
|
||||
|
@ -948,9 +948,9 @@ func add_frame() -> void:
|
|||
new_canvas.size = Global.canvas.size
|
||||
new_canvas.frame = Global.canvases.size()
|
||||
|
||||
var new_canvases := Global.canvases.duplicate()
|
||||
var new_canvases: Array = Global.canvases.duplicate()
|
||||
new_canvases.append(new_canvas)
|
||||
var new_hidden_canvases := Global.hidden_canvases.duplicate()
|
||||
var new_hidden_canvases: Array = Global.hidden_canvases.duplicate()
|
||||
new_hidden_canvases.append(new_canvas)
|
||||
|
||||
Global.undos += 1
|
||||
|
@ -1089,7 +1089,7 @@ func _on_SplitScreenButton_toggled(button_pressed) -> void:
|
|||
$SplitScreenButton.hint_tooltip = tr("SPLITSCREEN_HT")
|
||||
|
||||
func _on_ColorSwitch_pressed() -> void:
|
||||
var temp := Global.left_color_picker.color
|
||||
var temp: Color = Global.left_color_picker.color
|
||||
Global.left_color_picker.color = Global.right_color_picker.color
|
||||
Global.right_color_picker.color = temp
|
||||
update_left_custom_brush()
|
||||
|
|
|
@ -53,7 +53,7 @@ func on_palette_import_file_selected(path) -> void:
|
|||
if not Global.palettes.has(palette.name):
|
||||
Global.palettes[palette.name] = palette
|
||||
Global.palette_option_button.add_item(palette.name)
|
||||
var index := Global.palette_option_button.get_item_count() - 1
|
||||
var index: int = Global.palette_option_button.get_item_count() - 1
|
||||
Global.palette_option_button.set_item_metadata(index, palette.name)
|
||||
Global.palette_option_button.select(index)
|
||||
on_palette_select(palette.name)
|
||||
|
@ -108,7 +108,7 @@ func create_new_palette(name : String, _from_palette : Palette) -> String: # Ret
|
|||
# Add palette to Global and options
|
||||
Global.palettes[name] = new_palette
|
||||
Global.palette_option_button.add_item(name)
|
||||
var index := Global.palette_option_button.get_item_count() - 1
|
||||
var index: int = Global.palette_option_button.get_item_count() - 1
|
||||
Global.palette_option_button.set_item_metadata(index, name)
|
||||
Global.palette_option_button.select(index)
|
||||
|
||||
|
@ -161,7 +161,7 @@ func _load_palettes() -> void:
|
|||
if palette:
|
||||
Global.palettes[palette.name] = palette
|
||||
Global.palette_option_button.add_item(palette.name)
|
||||
var index := Global.palette_option_button.get_item_count() - 1
|
||||
var index: int = Global.palette_option_button.get_item_count() - 1
|
||||
Global.palette_option_button.set_item_metadata(index, palette.name)
|
||||
if palette.name == "Default":
|
||||
Global.palette_option_button.select(index)
|
||||
|
@ -174,7 +174,7 @@ func _load_palettes() -> void:
|
|||
if palette:
|
||||
Global.palettes[palette.name] = palette
|
||||
Global.palette_option_button.add_item(palette.name)
|
||||
var index := Global.palette_option_button.get_item_count() - 1
|
||||
var index: int = Global.palette_option_button.get_item_count() - 1
|
||||
Global.palette_option_button.set_item_metadata(index, palette.name)
|
||||
|
||||
func get_palette_files(path : String) -> Array:
|
||||
|
@ -199,7 +199,7 @@ func remove_current_palette() -> void:
|
|||
if Global.palettes[current_palette].editable:
|
||||
_delete_palette_file(current_palette + ".json")
|
||||
Global.palettes.erase(current_palette)
|
||||
var selected_index := Global.palette_option_button.selected
|
||||
var selected_index: int = Global.palette_option_button.selected
|
||||
Global.palette_option_button.remove_item(selected_index)
|
||||
if(selected_index - 1 >= 0):
|
||||
Global.palette_option_button.select(selected_index - 1)
|
||||
|
|
|
@ -56,8 +56,8 @@ func _process(delta : float) -> void:
|
|||
|
||||
func _draw() -> void:
|
||||
if has_focus:
|
||||
var viewport_size := Global.main_viewport.rect_size
|
||||
var zoom := Global.camera.zoom
|
||||
var viewport_size: Vector2 = Global.main_viewport.rect_size
|
||||
var zoom: Vector2 = Global.camera.zoom
|
||||
if type == TYPE.HORIZONTAL:
|
||||
draw_set_transform(Vector2(Global.camera.offset.x - (viewport_size.x / 2) * zoom.x, points[0].y + font.get_height() * zoom.x * 2), rotation, zoom * 2)
|
||||
draw_string(font, Vector2.ZERO, "%spx" % str(round(mouse_pos.y)))
|
||||
|
@ -84,4 +84,4 @@ func outside_canvas(undo := false) -> bool:
|
|||
return false
|
||||
|
||||
func point_in_rectangle(p : Vector2, coord1 : Vector2, coord2 : Vector2) -> bool:
|
||||
return p.x > coord1.x && p.y > coord1.y && p.x < coord2.x && p.y < coord2.y
|
||||
return p.x > coord1.x && p.y > coord1.y && p.x < coord2.x && p.y < coord2.y
|
||||
|
|
|
@ -9,8 +9,8 @@ var minor_subdivision := 4
|
|||
var first : Vector2
|
||||
var last : Vector2
|
||||
|
||||
onready var _prev_camera_offset := Global.camera.offset
|
||||
onready var _prev_camera_zoom := Global.camera.zoom
|
||||
onready var _prev_camera_offset: Vector2 = Global.camera.offset
|
||||
onready var _prev_camera_zoom: Vector2 = Global.camera.zoom
|
||||
|
||||
func _ready() -> void:
|
||||
Global.main_viewport.connect("item_rect_changed", self, "update")
|
||||
|
@ -35,7 +35,7 @@ func _draw() -> void:
|
|||
var ruler_transform := Transform2D()
|
||||
var major_subdivide := Transform2D()
|
||||
var minor_subdivide := Transform2D()
|
||||
var zoom := 1 / Global.camera.zoom.x
|
||||
var zoom: float = 1 / Global.camera.zoom.x
|
||||
transform.x = Vector2(zoom, zoom)
|
||||
|
||||
transform.origin = Global.main_viewport.rect_size / 2 + Global.camera.offset * -zoom
|
||||
|
|
|
@ -9,8 +9,8 @@ var minor_subdivision := 4
|
|||
var first : Vector2
|
||||
var last : Vector2
|
||||
|
||||
onready var _prev_camera_offset := Global.camera.offset
|
||||
onready var _prev_camera_zoom := Global.camera.zoom
|
||||
onready var _prev_camera_offset: Vector2 = Global.camera.offset
|
||||
onready var _prev_camera_zoom: Vector2 = Global.camera.zoom
|
||||
|
||||
func _ready() -> void:
|
||||
Global.main_viewport.connect("item_rect_changed", self, "update")
|
||||
|
@ -30,7 +30,7 @@ func _draw() -> void:
|
|||
var ruler_transform := Transform2D()
|
||||
var major_subdivide := Transform2D()
|
||||
var minor_subdivide := Transform2D()
|
||||
var zoom := 1 / Global.camera.zoom.x
|
||||
var zoom: float = 1 / Global.camera.zoom.x
|
||||
transform.y = Vector2(zoom, zoom)
|
||||
|
||||
transform.origin = Global.main_viewport.rect_size / 2 + Global.camera.offset * -zoom
|
||||
|
|
|
@ -19,11 +19,11 @@ func _ready() -> void:
|
|||
|
||||
# warning-ignore:unused_argument
|
||||
func _process(delta : float) -> void:
|
||||
var mouse_pos := get_local_mouse_position() - Global.canvas.location
|
||||
var mouse_pos: Vector2 = get_local_mouse_position() - Global.canvas.location
|
||||
var mouse_pos_floored := mouse_pos.floor()
|
||||
var start_pos := polygon[0]
|
||||
var end_pos := polygon[2]
|
||||
var current_layer_index := Global.canvas.current_layer_index
|
||||
var current_layer_index: int = Global.canvas.current_layer_index
|
||||
var layer : Image = Global.canvas.layers[current_layer_index][0]
|
||||
|
||||
if end_pos == start_pos:
|
||||
|
|
Loading…
Reference in a new issue