Skip to content

Commit

Permalink
Merge pull request #4 from Xrayez/icon-reload-native
Browse files Browse the repository at this point in the history
Use Godot's own reload icon from current editor theme
  • Loading branch information
willnationsdev authored Jul 29, 2019
2 parents 47faab6 + a8e3ca8 commit a0e5c93
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 109 deletions.
6 changes: 0 additions & 6 deletions addons/godot-plugin-refresher/icons/icon_reload_small.svg

This file was deleted.

34 changes: 0 additions & 34 deletions addons/godot-plugin-refresher/icons/icon_reload_small.svg.import

This file was deleted.

3 changes: 3 additions & 0 deletions addons/godot-plugin-refresher/plugin_refresher.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ func select_plugin(p_name):
if plugin == p_name:
options.selected = options.get_item_id(idx)

func set_refresh_button_icon(p_icon):
$RefreshButton.icon = p_icon

func _on_RefreshButton_pressed():
if options.selected == -1:
return # nothing selected
Expand Down
74 changes: 6 additions & 68 deletions addons/godot-plugin-refresher/plugin_refresher.tscn
Original file line number Diff line number Diff line change
@@ -1,87 +1,25 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]

[ext_resource path="res://addons/godot-plugin-refresher/plugin_refresher.gd" type="Script" id=1]
[ext_resource path="res://addons/godot-plugin-refresher/icons/icon_reload_small.svg" type="Texture" id=2]

[node name="HBoxContainer" type="HBoxContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="HBoxContainer" type="HBoxContainer"]
margin_right = 40.0
margin_bottom = 40.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
script = ExtResource( 1 )

[node name="VSeparator" type="VSeparator" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="VSeparator" type="VSeparator" parent="."]
margin_right = 4.0
margin_bottom = 40.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1

[node name="OptionButton" type="OptionButton" parent="." index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="OptionButton" type="OptionButton" parent="."]
margin_left = 8.0
margin_right = 158.0
margin_bottom = 40.0
rect_min_size = Vector2( 150, 0 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
action_mode = 0
enabled_focus_mode = 2
shortcut = null
group = null
flat = false
align = 0
items = [ ]
selected = -1
_sections_unfolded = [ "Rect" ]

[node name="RefreshButton" type="ToolButton" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
[node name="RefreshButton" type="ToolButton" parent="."]
margin_left = 162.0
margin_right = 188.0
margin_right = 174.0
margin_bottom = 40.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
icon = ExtResource( 2 )
flat = true
align = 1
_sections_unfolded = [ "icon" ]

[connection signal="pressed" from="RefreshButton" to="." method="_on_RefreshButton_pressed"]
11 changes: 10 additions & 1 deletion addons/godot-plugin-refresher/plugin_refresher_plugin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ func _enter_tree():
refresher = PluginRefresherScn.instance()
add_control_to_container(CONTAINER_TOOLBAR, refresher)

var efs = get_editor_interface().get_resource_filesystem()
var eds = get_editor_interface()

# Set reload icon from Godot's own theme
var godot_editor = eds.get_base_control()
var reload_icon = godot_editor.theme.get_icon('Reload', 'EditorIcons')
assert(reload_icon != null)
refresher.set_refresh_button_icon(reload_icon)

# Watch whether any plugin is changed, added or removed on the filesystem
var efs = eds.get_resource_filesystem()
efs.connect("filesystem_changed", self, "_on_filesystem_changed")

refresher.connect("request_refresh_plugin", self, "_on_request_refresh_plugin")
Expand Down

0 comments on commit a0e5c93

Please sign in to comment.