From 6e46cf0c8d845258406067293adfc845ab75c86d Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Sat, 8 Jul 2023 17:47:24 +0300 Subject: [PATCH] Minor code/scene changes Renames "Centralize" to "Center", as it is a more appropriate verb. --- Translations/Translations.pot | 2 +- src/Autoload/DrawingAlgos.gd | 6 +++--- src/Autoload/Global.gd | 2 +- src/Classes/BaseCel.gd | 1 - src/Tools/Draw.gd | 4 ++-- src/UI/Dialogs/ExportDialog.tscn | 1 - src/UI/Dialogs/ImageEffects/DropShadowDialog.gd | 10 ++++------ src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn | 4 +++- src/UI/Timeline/FrameButton.gd | 6 +++--- src/UI/Timeline/FrameButton.tscn | 2 +- 10 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Translations/Translations.pot b/Translations/Translations.pot index 84a809a16..80f4fed28 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -158,7 +158,7 @@ msgstr "" msgid "Wrap around:" msgstr "" -msgid "Centralize Image" +msgid "Center Frames" msgstr "" msgid "Rotate Image" diff --git a/src/Autoload/DrawingAlgos.gd b/src/Autoload/DrawingAlgos.gd index 785e82053..7ed930d5f 100644 --- a/src/Autoload/DrawingAlgos.gd +++ b/src/Autoload/DrawingAlgos.gd @@ -462,11 +462,11 @@ func scale_image(width: int, height: int, interpolation: int) -> void: general_undo_scale() -func centralize(indices: Array) -> void: +func center(indices: Array) -> void: var project: Project = Global.current_project Global.canvas.selection.transform_content_confirm() project.undos += 1 - project.undo_redo.create_action("Centralize") + project.undo_redo.create_action("Center Frames") for frame in indices: # Find used rect of the current frame (across all of the layers) var used_rect := Rect2() @@ -479,7 +479,7 @@ func centralize(indices: Array) -> void: if used_rect.has_no_area(): continue - # Now apply Centralization + # Now apply centering var offset: Vector2 = (0.5 * (project.size - used_rect.size)).floor() for cel in project.frames[frame].cels: if not cel is PixelCel: diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index 644f65236..9df4fcd45 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -463,7 +463,7 @@ func undo_or_redo( "Select", "Move Selection", "Scale", - "Centralize", + "Center Frames", "Merge Layer", "Link Cel", "Unlink Cel" diff --git a/src/Classes/BaseCel.gd b/src/Classes/BaseCel.gd index 364737939..57c3c78c1 100644 --- a/src/Classes/BaseCel.gd +++ b/src/Classes/BaseCel.gd @@ -54,7 +54,6 @@ func update_texture() -> void: if self in Global.current_project.frames[frame].cels: for cel in link_set["cels"]: cel.emit_signal("texture_changed") - return func serialize() -> Dictionary: diff --git a/src/Tools/Draw.gd b/src/Tools/Draw.gd index c492a4fcb..022284298 100644 --- a/src/Tools/Draw.gd +++ b/src/Tools/Draw.gd @@ -331,6 +331,7 @@ func draw_fill_gap(start: Vector2, end: Vector2) -> void: var x := start.x var y := start.y _prepare_tool() + # This needs to be a dictionary to ensure duplicate coordinates are not being added var coords_to_draw := {} while !(x == end.x && y == end.y): e2 = err << 1 @@ -340,8 +341,7 @@ func draw_fill_gap(start: Vector2, end: Vector2) -> void: if e2 <= dx: err += dx y += sy - #coords_to_draw.append_array(_draw_tool(Vector2(x, y))) - var current_pixel_coord = Vector2(x, y) + var current_pixel_coord := Vector2(x, y) if _spacing_mode: current_pixel_coord = get_spacing_position(current_pixel_coord) for coord in _draw_tool(current_pixel_coord): diff --git a/src/UI/Dialogs/ExportDialog.tscn b/src/UI/Dialogs/ExportDialog.tscn index 7e8f1caa9..8121de8d4 100644 --- a/src/UI/Dialogs/ExportDialog.tscn +++ b/src/UI/Dialogs/ExportDialog.tscn @@ -246,7 +246,6 @@ margin_left = 36.0 margin_right = 382.0 margin_bottom = 24.0 size_flags_horizontal = 3 -align = 2 caret_blink = true caret_blink_speed = 0.5 diff --git a/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd b/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd index ed9be62f2..d4868467d 100644 --- a/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd +++ b/src/UI/Dialogs/ImageEffects/DropShadowDialog.gd @@ -1,9 +1,8 @@ extends ImageEffect enum Animate { OFFSET_X, OFFSET_Y } -var offset := Vector2(5, 5) var color := Color.black -var shader: Shader = load("res://src/Shaders/DropShadow.tres") +var shader: Shader = preload("res://src/Shaders/DropShadow.tres") onready var shadow_color := $VBoxContainer/ShadowOptions/ShadowColor as ColorPickerButton @@ -25,8 +24,8 @@ func _ready() -> void: func commit_action(cel: Image, project: Project = Global.current_project) -> void: - var offset_x = animate_panel.get_animated_value(commit_idx, Animate.OFFSET_X) - var offset_y = animate_panel.get_animated_value(commit_idx, Animate.OFFSET_Y) + var offset_x := animate_panel.get_animated_value(commit_idx, Animate.OFFSET_X) + var offset_y := animate_panel.get_animated_value(commit_idx, Animate.OFFSET_Y) var selection_tex := ImageTexture.new() if selection_checkbox.pressed and project.has_selection: selection_tex.create_from_image(project.selection_map, 0) @@ -45,8 +44,7 @@ func commit_action(cel: Image, project: Project = Global.current_project) -> voi yield(gen, "done") -func _on_OffsetSliders_value_changed(value: Vector2) -> void: - offset = value +func _on_OffsetSliders_value_changed(_value: Vector2) -> void: update_preview() diff --git a/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn b/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn index 824a1bc7d..f69aa514e 100644 --- a/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn +++ b/src/UI/Dialogs/ImageEffects/DropShadowDialog.tscn @@ -5,7 +5,6 @@ [ext_resource path="res://src/UI/Nodes/ValueSliderV2.tscn" type="PackedScene" id=3] [node name="DropShadowDialog" instance=ExtResource( 1 )] -visible = false window_title = "Drop Shadow" script = ExtResource( 2 ) @@ -70,6 +69,9 @@ color = Color( 0.0823529, 0.0823529, 0.0823529, 0.627451 ) margin_top = 308.0 margin_bottom = 332.0 +[node name="AffectOptionButton" parent="VBoxContainer/OptionsContainer" index="1"] +items = [ "Selected cels", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ] + [node name="AnimateDialog" parent="." index="4"] margin_bottom = 340.0 diff --git a/src/UI/Timeline/FrameButton.gd b/src/UI/Timeline/FrameButton.gd index 3ddb5b1bc..3115bf636 100644 --- a/src/UI/Timeline/FrameButton.gd +++ b/src/UI/Timeline/FrameButton.gd @@ -1,6 +1,6 @@ extends Button -enum { REMOVE, CLONE, MOVE_LEFT, MOVE_RIGHT, PROPERTIES, REVERSE, CENTRALIZE } +enum { REMOVE, CLONE, MOVE_LEFT, MOVE_RIGHT, PROPERTIES, REVERSE, CENTER } var frame := 0 @@ -92,8 +92,8 @@ func _on_PopupMenu_id_pressed(id: int) -> void: Global.dialog_open(true) REVERSE: Global.animation_timeline.reverse_frames(indices) - CENTRALIZE: - DrawingAlgos.centralize(indices) + CENTER: + DrawingAlgos.center(indices) func change_frame_order(rate: int) -> void: diff --git a/src/UI/Timeline/FrameButton.tscn b/src/UI/Timeline/FrameButton.tscn index 3cc5c93f9..895025315 100644 --- a/src/UI/Timeline/FrameButton.tscn +++ b/src/UI/Timeline/FrameButton.tscn @@ -20,7 +20,7 @@ __meta__ = { margin_right = 20.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 -items = [ "Remove Frame", null, 0, false, true, -1, 0, null, "", false, "Clone Frame", null, 0, false, false, -1, 0, null, "", false, "Move Left", null, 0, false, true, -1, 0, null, "", false, "Move Right", null, 0, false, true, -1, 0, null, "", false, "Frame Properties", null, 0, false, false, -1, 0, null, "", false, "Reverse Frames", null, 0, false, true, 5, 0, null, "", false, "Centralize Frames", null, 0, false, false, 6, 0, null, "", false ] +items = [ "Remove Frame", null, 0, false, true, -1, 0, null, "", false, "Clone Frame", null, 0, false, false, -1, 0, null, "", false, "Move Left", null, 0, false, true, -1, 0, null, "", false, "Move Right", null, 0, false, true, -1, 0, null, "", false, "Frame Properties", null, 0, false, false, -1, 0, null, "", false, "Reverse Frames", null, 0, false, true, 5, 0, null, "", false, "Center Frames", null, 0, false, false, 6, 0, null, "", false ] __meta__ = { "_edit_use_anchors_": false }