-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from willnationsdev/cleanup
Apply GDScript formatting. Use static type hints. Use EditorInterface singleton.
- Loading branch information
Showing
4 changed files
with
130 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,65 @@ | ||
@tool | ||
extends HBoxContainer | ||
|
||
signal request_refresh_plugin(p_name) | ||
signal confirm_refresh_plugin(p_name) | ||
signal request_refresh_plugin(p_name: String) | ||
signal confirm_refresh_plugin(p_name: String) | ||
|
||
@onready var options = $OptionButton | ||
@onready var options: OptionButton = $OptionButton | ||
|
||
func _ready(): | ||
|
||
func _ready() -> void: | ||
if get_tree().edited_scene_root == self: | ||
return # This is the scene opened in the editor! | ||
return # This is the scene opened in the editor! | ||
$RefreshButton.icon = EditorInterface.get_editor_theme().get_icon("Reload", "EditorIcons") | ||
|
||
|
||
func update_items(p_plugins): | ||
func update_items(p_plugins: Dictionary) -> void: | ||
if not options: | ||
return | ||
options.clear() | ||
var plugin_dirs = p_plugins.keys() | ||
var plugin_dirs: Array[String] = [] | ||
plugin_dirs.assign(p_plugins.keys()) | ||
for idx in plugin_dirs.size(): | ||
var plugin_dirname = plugin_dirs[idx] | ||
var plugin_name = p_plugins[plugin_dirname] | ||
var plugin_dirname := plugin_dirs[idx] as String | ||
var plugin_name := p_plugins[plugin_dirname] as String | ||
options.add_item(plugin_name, idx) | ||
options.set_item_metadata(idx, plugin_dirname) | ||
|
||
|
||
func select_plugin(p_name): | ||
if not options: | ||
return | ||
if p_name == null or p_name.is_empty(): | ||
# Note: For whatever reason, statically typing `p_name` inexplicably causes | ||
# an error about converting from Nil to String, even if the value is converted. | ||
func select_plugin(p_name) -> void: | ||
if not options or not p_name: | ||
return | ||
|
||
for idx in options.get_item_count(): | ||
var plugin = options.get_item_metadata(idx) | ||
if plugin == p_name: | ||
var plugin := str(options.get_item_metadata(idx)) | ||
if plugin == str(p_name): | ||
options.selected = options.get_item_id(idx) | ||
break | ||
|
||
|
||
func _on_RefreshButton_pressed(): | ||
func _on_RefreshButton_pressed() -> void: | ||
if options.selected == -1: | ||
return # nothing selected | ||
return # nothing selected | ||
|
||
var plugin = options.get_item_metadata(options.selected) | ||
if not plugin or plugin.is_empty(): | ||
var plugin := str(options.get_item_metadata(options.selected)) | ||
if not plugin: | ||
return | ||
emit_signal("request_refresh_plugin", plugin) | ||
|
||
|
||
func show_warning(p_name): | ||
$ConfirmationDialog.dialog_text = """ | ||
func show_warning(p_name: String) -> void: | ||
$ConfirmationDialog.dialog_text = ( | ||
""" | ||
Plugin `%s` is currently disabled.\n | ||
Do you want to enable it now? | ||
""" % [p_name] | ||
""" | ||
% [p_name] | ||
) | ||
$ConfirmationDialog.popup_centered() | ||
|
||
|
||
func _on_ConfirmationDialog_confirmed(): | ||
var plugin = options.get_item_metadata(options.selected) | ||
func _on_ConfirmationDialog_confirmed() -> void: | ||
var plugin := options.get_item_metadata(options.selected) as String | ||
emit_signal("confirm_refresh_plugin", plugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" | ||
type="CompressedTexture2D" | ||
uid="uid://c1hfjj7vmjkda" | ||
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.png" | ||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] | ||
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/bptc_ldr=0 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
flags/repeat=0 | ||
flags/filter=true | ||
flags/mipmaps=false | ||
flags/anisotropic=false | ||
flags/srgb=2 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
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 | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 |
Oops, something went wrong.