Handle null resource for beta15

This commit is contained in:
Haoyu Qiu 2023-01-25 20:20:02 +08:00
parent 140033208e
commit eb69d75178
3 changed files with 9 additions and 6 deletions

View File

@ -86,7 +86,14 @@ func _notification(what: int):
popup.set_item_icon(popup.get_item_index(ExtraOption.PASTE), get_theme_icon("ActionPaste", "EditorIcons"))
func edit(path: String) -> void:
func edit(object: Variant) -> void:
if not object:
if not _modified:
_set_editing_file("")
# TODO: prompt?
return
var path := object.resource_path as String
if _modified:
_popup_confirm(
translator.tr("There are unsaved changes.\nOpen '%s' anyway?") % path,

View File

@ -29,7 +29,7 @@ func _handles(object: Variant) -> bool:
func _edit(object: Variant):
sfxr_editor.edit(object.resource_path) # Should already passed `handles()` checks
sfxr_editor.edit(object)
func _make_visible(visible: bool):

View File

@ -15,10 +15,6 @@ run/main_scene="res://example/Example.tscn"
config/features=PackedStringArray("4.0")
config/icon="res://icon.png"
[editor]
export/convert_text_resources_to_binary=true
[editor_plugins]
enabled=PackedStringArray("res://addons/gdfxr/plugin.cfg")