From 6203b3a71ca1cd06a97347d3b3198e19a9426494 Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 4 May 2021 13:26:07 +0300 Subject: [PATCH] Minor UI changes in the tool options of shape tools --- Translations/Translations.pot | 2 +- src/Tools/ShapeDrawer.tscn | 30 +++++++++++++++++++++--------- src/UI/Canvas/Selection.gd | 18 +++++++++--------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/Translations/Translations.pot b/Translations/Translations.pot index 885c6fb3b..5335c3f0a 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -28,7 +28,7 @@ msgstr "" msgid "Frame Size" msgstr "" -msgid "Size" +msgid "Size:" msgstr "" msgid "Width:" diff --git a/src/Tools/ShapeDrawer.tscn b/src/Tools/ShapeDrawer.tscn index ce7aaec0b..4923c3db7 100644 --- a/src/Tools/ShapeDrawer.tscn +++ b/src/Tools/ShapeDrawer.tscn @@ -10,31 +10,39 @@ script = ExtResource( 1 ) visible = false [node name="ShapeThickness" type="HBoxContainer" parent="." index="2"] +margin_left = 6.0 margin_top = 18.0 -margin_right = 116.0 +margin_right = 110.0 margin_bottom = 42.0 +size_flags_horizontal = 4 +custom_constants/separation = 0 -[node name="Label" type="Label" parent="ShapeThickness" index="0"] +[node name="Label2" type="Label" parent="ShapeThickness" index="0"] margin_top = 5.0 -margin_right = 26.0 +margin_right = 30.0 margin_bottom = 19.0 -text = "Size" +text = "Size:" +align = 1 [node name="ThicknessSpinbox" type="SpinBox" parent="ShapeThickness" index="1"] margin_left = 30.0 -margin_right = 116.0 +margin_right = 104.0 margin_bottom = 24.0 -size_flags_horizontal = 3 +mouse_default_cursor_shape = 2 +size_flags_horizontal = 4 min_value = 1.0 value = 1.0 align = 1 suffix = "px" [node name="ThicknessSlider" type="HSlider" parent="." index="3"] +margin_left = 12.0 margin_top = 46.0 -margin_right = 116.0 +margin_right = 104.0 margin_bottom = 62.0 -size_flags_horizontal = 3 +rect_min_size = Vector2( 92, 0 ) +mouse_default_cursor_shape = 2 +size_flags_horizontal = 4 size_flags_vertical = 1 min_value = 1.0 value = 1.0 @@ -54,10 +62,13 @@ margin_top = 66.0 margin_bottom = 128.0 [node name="FillCheckbox" type="CheckBox" parent="." index="7"] +margin_left = 13.0 margin_top = 66.0 -margin_right = 116.0 +margin_right = 102.0 margin_bottom = 90.0 hint_tooltip = "Fills the drawn shape with color, instead of drawing a hollow shape" +mouse_default_cursor_shape = 2 +size_flags_horizontal = 4 text = "Fill Shape" [node name="EmptySpacer" parent="." index="8"] @@ -67,6 +78,7 @@ margin_bottom = 106.0 [node name="Mirror" parent="." index="9"] margin_top = 110.0 margin_bottom = 127.0 + [connection signal="value_changed" from="ShapeThickness/ThicknessSpinbox" to="." method="_on_Thickness_value_changed"] [connection signal="value_changed" from="ThicknessSlider" to="." method="_on_Thickness_value_changed"] [connection signal="toggled" from="FillCheckbox" to="." method="_on_FillCheckbox_toggled"] diff --git a/src/UI/Canvas/Selection.gd b/src/UI/Canvas/Selection.gd index f46c6c375..33629122b 100644 --- a/src/UI/Canvas/Selection.gd +++ b/src/UI/Canvas/Selection.gd @@ -341,10 +341,10 @@ func transform_content_confirm() -> void: return var project : Project = Global.current_project var cel_image : Image = project.frames[project.current_frame].cels[project.current_layer].image - cel_image.blit_rect_mask(preview_image, preview_image, Rect2(Vector2.ZERO, Global.current_project.selection_bitmap.get_size()), big_bounding_rectangle.position) - var selected_bitmap_copy = Global.current_project.selection_bitmap.duplicate() - Global.current_project.move_bitmap_values(selected_bitmap_copy) - Global.current_project.selection_bitmap = selected_bitmap_copy + cel_image.blit_rect_mask(preview_image, preview_image, Rect2(Vector2.ZERO, project.selection_bitmap.get_size()), big_bounding_rectangle.position) + var selected_bitmap_copy = project.selection_bitmap.duplicate() + project.move_bitmap_values(selected_bitmap_copy) + project.selection_bitmap = selected_bitmap_copy original_preview_image = Image.new() preview_image = Image.new() @@ -434,8 +434,8 @@ func copy() -> void: var to_copy := Image.new() if is_moving_content: to_copy.copy_from(preview_image) - var selected_bitmap_copy := Global.current_project.selection_bitmap.duplicate() - Global.current_project.move_bitmap_values(selected_bitmap_copy, false) + var selected_bitmap_copy := project.selection_bitmap.duplicate() + project.move_bitmap_values(selected_bitmap_copy, false) clipboard.selection_bitmap = selected_bitmap_copy else: to_copy = image.get_rect(big_bounding_rectangle) @@ -469,9 +469,9 @@ func paste() -> void: undo_data = _get_undo_data(true) var project := Global.current_project - original_bitmap = Global.current_project.selection_bitmap.duplicate() + original_bitmap = project.selection_bitmap.duplicate() original_big_bounding_rectangle = big_bounding_rectangle - original_offset = Global.current_project.selection_offset + original_offset = project.selection_offset project.selection_bitmap = clipboard.selection_bitmap.duplicate() self.big_bounding_rectangle = clipboard.big_bounding_rectangle @@ -527,7 +527,7 @@ func invert() -> void: selection_bitmap_copy = project.resize_bitmap(selection_bitmap_copy, project.size) project.invert_bitmap(selection_bitmap_copy) project.selection_bitmap = selection_bitmap_copy - Global.current_project.selection_bitmap_changed() + project.selection_bitmap_changed() self.big_bounding_rectangle = project.get_selection_rectangle(selection_bitmap_copy) project.selection_offset = Vector2.ZERO commit_undo("Rectangle Select", _undo_data)