Skip to content

Commit 34388fb

Browse files
committed
🎉 feat: added a feature to open the path of a scene in editor
1 parent f3155e8 commit 34388fb

File tree

5 files changed

+71
-9
lines changed

5 files changed

+71
-9
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
UNRELEASED
55
----------
66

7+
* 🎉 feat: added a feature to open the path of a scene in editor
78

89
3.6.0 (2023-08-05)
910
------------------
737 Bytes
Loading

addons/scene_manager/scene_item.gd

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extends HBoxContainer
99
var _setting: ItemSetting
1010
var _sub_section: Control
1111
var _list: Control
12+
var _mouse_is_over_value: bool
1213

1314
# Finds and fills `_root` variable properly
1415
func _ready() -> void:
@@ -96,10 +97,22 @@ func _on_popup_button_button_up():
9697
var popup_size = _popup_menu.size
9798
_popup_menu.popup(Rect2(get_global_mouse_position(), popup_size))
9899

99-
# Open scene
100+
# Happens when open scene button clicks
100101
func _on_open_scene_button_up():
101-
var scenePath = get_value()
102-
EditorPlugin.new().get_editor_interface().open_scene_from_path(scenePath)
102+
EditorPlugin.new().get_editor_interface().open_scene_from_path(get_value())
103+
104+
# Happens on input on the value element
105+
func _on_value_gui_input(event: InputEvent):
106+
if event is InputEventMouseButton and event.is_released() and event.button_index == MOUSE_BUTTON_LEFT and _mouse_is_over_value:
107+
EditorPlugin.new().get_editor_interface().get_file_system_dock().navigate_to_path(get_value())
108+
109+
# Happens when mouse is over value input
110+
func _on_value_mouse_entered():
111+
_mouse_is_over_value = true
112+
113+
# Happens when mouse is out of value input
114+
func _on_value_mouse_exited():
115+
_mouse_is_over_value = false
103116

104117
# Happens when an item is selected
105118
func _on_popup_menu_index_pressed(index: int):

addons/scene_manager/scene_item.tscn

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
[gd_scene load_steps=4 format=3 uid="uid://hh0sw1g7upfc"]
1+
[gd_scene load_steps=5 format=3 uid="uid://hh0sw1g7upfc"]
22

33
[ext_resource type="Script" path="res://addons/scene_manager/scene_item.gd" id="2"]
44
[ext_resource type="Texture2D" uid="uid://brxxaey30q7uk" path="res://addons/scene_manager/icons/GuiTabMenuHl.svg" id="3"]
55
[ext_resource type="Script" path="res://addons/scene_manager/popup_button.gd" id="3_nwus0"]
6-
[ext_resource type="Texture2D" uid="uid://c7652b22u400p" path="res://addons/scene_manager/icons/eye_open.png" id="4"]
6+
[ext_resource type="Texture2D" uid="uid://b4xi5nvjb3rhr" path="res://addons/scene_manager/icons/PlayOverlay.png" id="4_pt2e1"]
77

88
[node name="item" type="HBoxContainer"]
99
offset_right = 280.0
@@ -27,9 +27,10 @@ size_flags_horizontal = 3
2727
editable = false
2828

2929
[node name="open_button" type="Button" parent="."]
30+
texture_filter = 1
3031
custom_minimum_size = Vector2(28, 28)
3132
layout_mode = 2
32-
icon = ExtResource("4")
33+
icon = ExtResource("4_pt2e1")
3334

3435
[node name="popup_menu" type="PopupMenu" parent="."]
3536
size = Vector2i(100, 28)
@@ -40,5 +41,8 @@ hide_on_item_selection = false
4041
[connection signal="tree_exited" from="." to="." method="_on_tree_exited"]
4142
[connection signal="button_up" from="popup_button" to="." method="_on_popup_button_button_up"]
4243
[connection signal="gui_input" from="key" to="." method="_on_key_gui_input"]
44+
[connection signal="gui_input" from="value" to="." method="_on_value_gui_input"]
45+
[connection signal="mouse_entered" from="value" to="." method="_on_value_mouse_entered"]
46+
[connection signal="mouse_exited" from="value" to="." method="_on_value_mouse_exited"]
4347
[connection signal="button_up" from="open_button" to="." method="_on_open_scene_button_up"]
4448
[connection signal="index_pressed" from="popup_menu" to="." method="_on_popup_menu_index_pressed"]

demo/loading.tscn

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,52 @@ region = Rect2(0, 224, 16, 16)
6565

6666
[sub_resource type="SpriteFrames" id="SpriteFrames_lmmu3"]
6767
animations = [{
68-
"frames": [SubResource("AtlasTexture_jf28a"), SubResource("AtlasTexture_dd3is"), SubResource("AtlasTexture_jvn0q"), SubResource("AtlasTexture_efm7h"), SubResource("AtlasTexture_6clc4"), SubResource("AtlasTexture_gnbdr"), SubResource("AtlasTexture_hdkdb"), SubResource("AtlasTexture_1pitr"), SubResource("AtlasTexture_ot3c6"), SubResource("AtlasTexture_bugdx"), SubResource("AtlasTexture_c18fr"), SubResource("AtlasTexture_hwcbt"), SubResource("AtlasTexture_bsknd"), SubResource("AtlasTexture_0rimh"), SubResource("AtlasTexture_x4rg0")],
68+
"frames": [{
69+
"duration": 1.0,
70+
"texture": SubResource("AtlasTexture_jf28a")
71+
}, {
72+
"duration": 1.0,
73+
"texture": SubResource("AtlasTexture_dd3is")
74+
}, {
75+
"duration": 1.0,
76+
"texture": SubResource("AtlasTexture_jvn0q")
77+
}, {
78+
"duration": 1.0,
79+
"texture": SubResource("AtlasTexture_efm7h")
80+
}, {
81+
"duration": 1.0,
82+
"texture": SubResource("AtlasTexture_6clc4")
83+
}, {
84+
"duration": 1.0,
85+
"texture": SubResource("AtlasTexture_gnbdr")
86+
}, {
87+
"duration": 1.0,
88+
"texture": SubResource("AtlasTexture_hdkdb")
89+
}, {
90+
"duration": 1.0,
91+
"texture": SubResource("AtlasTexture_1pitr")
92+
}, {
93+
"duration": 1.0,
94+
"texture": SubResource("AtlasTexture_ot3c6")
95+
}, {
96+
"duration": 1.0,
97+
"texture": SubResource("AtlasTexture_bugdx")
98+
}, {
99+
"duration": 1.0,
100+
"texture": SubResource("AtlasTexture_c18fr")
101+
}, {
102+
"duration": 1.0,
103+
"texture": SubResource("AtlasTexture_hwcbt")
104+
}, {
105+
"duration": 1.0,
106+
"texture": SubResource("AtlasTexture_bsknd")
107+
}, {
108+
"duration": 1.0,
109+
"texture": SubResource("AtlasTexture_0rimh")
110+
}, {
111+
"duration": 1.0,
112+
"texture": SubResource("AtlasTexture_x4rg0")
113+
}],
69114
"loop": true,
70115
"name": &"default",
71116
"speed": 5.0
@@ -126,9 +171,8 @@ layout_mode = 2
126171
texture_filter = 1
127172
position = Vector2(15, 505)
128173
scale = Vector2(10.375, 10.375)
129-
frames = SubResource("SpriteFrames_lmmu3")
174+
sprite_frames = SubResource("SpriteFrames_lmmu3")
130175
speed_scale = 2.0
131-
playing = true
132176
centered = false
133177

134178
[connection signal="button_up" from="VBoxContainer2/HBoxContainer/MarginContainer/Next" to="." method="_on_next_button_up"]

0 commit comments

Comments
 (0)