mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Add buttons with menus that move the symmetry guides to the center of the canvas, or the view center
This commit is contained in:
parent
7eeb0b0cba
commit
39afb5e15b
|
@ -1957,10 +1957,18 @@ msgstr ""
|
|||
msgid "Enable horizontal mirrored drawing"
|
||||
msgstr ""
|
||||
|
||||
msgid "Vertical"
|
||||
msgstr ""
|
||||
|
||||
msgid "Enable vertical mirrored drawing"
|
||||
msgstr ""
|
||||
|
||||
msgid "Vertical"
|
||||
#. Found in the global tool options, in the menu that appears next to each mirror button. It affects the position of a symmetry guide.
|
||||
msgid "Move to canvas center"
|
||||
msgstr ""
|
||||
|
||||
#. Found in the global tool options, in the menu that appears next to each mirror button. It affects the position of a symmetry guide.
|
||||
msgid "Move to view center"
|
||||
msgstr ""
|
||||
|
||||
msgid "Current frame:"
|
||||
|
|
|
@ -11,6 +11,8 @@ extends PanelContainer
|
|||
|
||||
func _ready() -> void:
|
||||
Tools.options_reset.connect(reset_options)
|
||||
%HorizontalMirrorOptions.get_popup().id_pressed.connect(_on_horizontal_mirror_options_id_pressed)
|
||||
%VerticalMirrorOptions.get_popup().id_pressed.connect(_on_vertical_mirror_options_id_pressed)
|
||||
# Resize tools panel when window gets resized
|
||||
get_tree().get_root().size_changed.connect(_on_resized)
|
||||
horizontal_mirror.button_pressed = Tools.horizontal_mirror
|
||||
|
@ -89,3 +91,23 @@ func _on_alpha_lock_toggled(toggled_on: bool) -> void:
|
|||
func _on_Dynamics_pressed() -> void:
|
||||
var pos := dynamics.global_position + Vector2(0, 32)
|
||||
dynamics_panel.popup_on_parent(Rect2(pos, dynamics_panel.size))
|
||||
|
||||
|
||||
func _on_horizontal_mirror_options_id_pressed(id: int) -> void:
|
||||
var project := Global.current_project
|
||||
if id == 0:
|
||||
project.x_symmetry_point = project.size.x - 1
|
||||
elif id == 1:
|
||||
project.x_symmetry_point = Global.camera.camera_screen_center.x * 2
|
||||
project.y_symmetry_axis.points[0].x = project.x_symmetry_point / 2 + 0.5
|
||||
project.y_symmetry_axis.points[1].x = project.x_symmetry_point / 2 + 0.5
|
||||
|
||||
|
||||
func _on_vertical_mirror_options_id_pressed(id: int) -> void:
|
||||
var project := Global.current_project
|
||||
if id == 0:
|
||||
project.y_symmetry_point = project.size.y - 1
|
||||
elif id == 1:
|
||||
project.y_symmetry_point = Global.camera.camera_screen_center.y * 2
|
||||
project.x_symmetry_axis.points[0].y = project.y_symmetry_point / 2 + 0.5
|
||||
project.x_symmetry_axis.points[1].y = project.y_symmetry_point / 2 + 0.5
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=24 format=3 uid="uid://wo0hqxkst808"]
|
||||
[gd_scene load_steps=25 format=3 uid="uid://wo0hqxkst808"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cjrokejjsp5dm" path="res://assets/graphics/misc/horizontal_mirror_off.png" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://hiduvaa73fr6" path="res://assets/graphics/misc/vertical_mirror_off.png" id="2"]
|
||||
[ext_resource type="Script" path="res://src/UI/GlobalToolOptions/GlobalToolOptions.gd" id="3"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct8wn8m6x4m54" path="res://assets/graphics/misc/value_arrow.svg" id="3_faalk"]
|
||||
[ext_resource type="Texture2D" uid="uid://22h12g8p3jtd" path="res://assets/graphics/misc/pixel_perfect_off.png" id="4"]
|
||||
[ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="5"]
|
||||
[ext_resource type="Texture2D" uid="uid://j8eywwy082a4" path="res://assets/graphics/misc/alpha_lock_off.png" id="5_jv20x"]
|
||||
|
@ -73,7 +74,7 @@ size_flags_vertical = 0
|
|||
columns = 5
|
||||
|
||||
[node name="Horizontal" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
custom_minimum_size = Vector2(44, 32)
|
||||
layout_mode = 2
|
||||
tooltip_text = "Enable horizontal mirrored drawing"
|
||||
mouse_default_cursor_shape = 2
|
||||
|
@ -81,19 +82,49 @@ toggle_mode = true
|
|||
shortcut = SubResource("Shortcut_eld87")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Horizontal"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 5.0
|
||||
offset_top = -10.0
|
||||
offset_right = 25.0
|
||||
offset_bottom = 11.0
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("1")
|
||||
|
||||
[node name="HorizontalMirrorOptions" type="MenuButton" parent="ScrollContainer/CenterContainer/GridContainer/Horizontal"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(22, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -22.0
|
||||
offset_top = -10.0
|
||||
offset_bottom = 10.0
|
||||
mouse_default_cursor_shape = 2
|
||||
item_count = 2
|
||||
popup/item_0/text = "Move to canvas center"
|
||||
popup/item_1/text = "Move to view center"
|
||||
popup/item_1/id = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Horizontal/HorizontalMirrorOptions"]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -10.0
|
||||
offset_top = -10.5
|
||||
offset_right = 10.0
|
||||
offset_bottom = 10.5
|
||||
texture = ExtResource("1")
|
||||
offset_left = -6.0
|
||||
offset_top = -6.0
|
||||
offset_right = 6.0
|
||||
offset_bottom = 6.0
|
||||
texture = ExtResource("3_faalk")
|
||||
|
||||
[node name="Vertical" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
custom_minimum_size = Vector2(44, 32)
|
||||
layout_mode = 2
|
||||
tooltip_text = "Enable vertical mirrored drawing"
|
||||
mouse_default_cursor_shape = 2
|
||||
|
@ -101,16 +132,48 @@ toggle_mode = true
|
|||
shortcut = SubResource("Shortcut_ai7qc")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Vertical"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 5.0
|
||||
offset_top = -10.0
|
||||
offset_right = 25.0
|
||||
offset_bottom = 10.0
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2")
|
||||
|
||||
[node name="VerticalMirrorOptions" type="MenuButton" parent="ScrollContainer/CenterContainer/GridContainer/Vertical"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(22, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -22.0
|
||||
offset_top = -10.0
|
||||
offset_bottom = 10.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
mouse_default_cursor_shape = 2
|
||||
item_count = 2
|
||||
popup/item_0/text = "Move to canvas center"
|
||||
popup/item_1/text = "Move to view center"
|
||||
popup/item_1/id = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/Vertical/VerticalMirrorOptions"]
|
||||
layout_mode = 0
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -10.0
|
||||
offset_top = -10.0
|
||||
offset_right = 10.0
|
||||
offset_bottom = 10.0
|
||||
texture = ExtResource("2")
|
||||
offset_left = -6.0
|
||||
offset_top = -6.0
|
||||
offset_right = 6.0
|
||||
offset_bottom = 6.0
|
||||
texture = ExtResource("3_faalk")
|
||||
|
||||
[node name="PixelPerfect" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
|
|
Loading…
Reference in a new issue