diff --git a/addons/godot-plugin-refresher/icons/icon_reload_small.svg b/addons/godot-plugin-refresher/icons/icon_reload_small.svg deleted file mode 100644 index 270c045..0000000 --- a/addons/godot-plugin-refresher/icons/icon_reload_small.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/addons/godot-plugin-refresher/icons/icon_reload_small.svg.import b/addons/godot-plugin-refresher/icons/icon_reload_small.svg.import deleted file mode 100644 index 73c703d..0000000 --- a/addons/godot-plugin-refresher/icons/icon_reload_small.svg.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/icon_reload_small.svg-2fb3864c9ab2acd4651c8b485b98ddf5.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://addons/godot-plugin-refresher/icons/icon_reload_small.svg" -dest_files=[ "res://.import/icon_reload_small.svg-2fb3864c9ab2acd4651c8b485b98ddf5.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/addons/godot-plugin-refresher/plugin_refresher.gd b/addons/godot-plugin-refresher/plugin_refresher.gd index c4fd551..5eae15d 100644 --- a/addons/godot-plugin-refresher/plugin_refresher.gd +++ b/addons/godot-plugin-refresher/plugin_refresher.gd @@ -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 diff --git a/addons/godot-plugin-refresher/plugin_refresher.tscn b/addons/godot-plugin-refresher/plugin_refresher.tscn index 6d0628a..b35b1be 100644 --- a/addons/godot-plugin-refresher/plugin_refresher.tscn +++ b/addons/godot-plugin-refresher/plugin_refresher.tscn @@ -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"] diff --git a/addons/godot-plugin-refresher/plugin_refresher_plugin.gd b/addons/godot-plugin-refresher/plugin_refresher_plugin.gd index 01e06e3..c9fe43e 100644 --- a/addons/godot-plugin-refresher/plugin_refresher_plugin.gd +++ b/addons/godot-plugin-refresher/plugin_refresher_plugin.gd @@ -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")