LastOpenFiles is a reference now.

This commit is contained in:
Relintai 2022-07-15 10:20:59 +02:00
parent da0b10d43f
commit 5d1ca70aef
5 changed files with 17 additions and 12 deletions

View File

@ -62,7 +62,7 @@ var confirmation_close : ConfirmationDialog = null
var select_font_dialog : FileDialog = null
var LastOpenedFiles = preload("res://addons/file-editor/scripts/LastOpenedFiles.gd").new()
var LastOpenedFiles = null
var Preview = preload("res://addons/file-editor/scripts/Preview.gd")
var VanillaEditor = preload("res://addons/file-editor/scripts/VanillaEditor.gd")
@ -277,9 +277,10 @@ func _ready():
clean_editor()
connect_signals()
var opened_files : Array = LastOpenedFiles.load_opened_files()
for opened_file in opened_files:
open_file(opened_file[1], opened_file[2])
if LastOpenedFiles:
var opened_files : Array = LastOpenedFiles.load_opened_files()
for opened_file in opened_files:
open_file(opened_file[1], opened_file[2])
file_list.set_filters(EXTENSIONS)
@ -466,6 +467,7 @@ func generate_file_item(path : String , veditor : Control):
func open_in_vanillaeditor(path : String) -> Control:
var editor = VanillaEditor.new()
editor.LastOpenedFiles = LastOpenedFiles
editor.file_list = file_list
split_editor_container.add_child(editor,true)

View File

@ -1,9 +1,11 @@
tool
extends Node
extends Reference
var editor_plugin : EditorPlugin = null
var editor_settings : EditorSettings = null
const lastopenedfile_path : String = "res://addons/file-editor/lastopenedfiles.lastcfg"
func _ready():
pass
@ -43,5 +45,5 @@ func store_editor_fonts(file_name : String, font_path : String):
file.save(lastopenedfile_path)
func get_editor_font():
var editor_plugin : EditorPlugin = EditorPlugin.new()
#var editor_plugin : EditorPlugin = EditorPlugin.new()
return editor_plugin.get_editor_interface().get_editor_settings().get_setting("interface/editor/code_font")

View File

@ -1,8 +1,6 @@
tool
extends WindowDialog
var LastOpenedFiles = preload("res://addons/file-editor/scripts/LastOpenedFiles.gd").new()
var text_preview : RichTextLabel = null
var table_preview : GridContainer = null

View File

@ -1,7 +1,7 @@
tool
extends VBoxContainer
var LastOpenedFiles = preload("res://addons/file-editor/scripts/LastOpenedFiles.gd").new()
var LastOpenedFiles = null
var text_editor : TextEdit = null

View File

@ -2,17 +2,20 @@ tool
extends EditorPlugin
var IconLoader = preload("res://addons/file-editor/scripts/IconLoader.gd").new()
var LastOpenedFiles = preload("res://addons/file-editor/scripts/LastOpenedFiles.gd").new()
var FileEditor
func _enter_tree():
add_autoload_singleton("LastOpenedFiles","res://addons/file-editor/scripts/LastOpenedFiles.gd")
LastOpenedFiles.editor_plugin = self
LastOpenedFiles.editor_settings = get_editor_interface().get_editor_settings()
FileEditor = preload("res://addons/file-editor/scripts/FileEditor.gd").new()
FileEditor.LastOpenedFiles = LastOpenedFiles
get_editor_interface().get_editor_viewport().add_child(FileEditor)
FileEditor.hide()
func _exit_tree():
remove_autoload_singleton("LastOpenedFiles")
get_editor_interface().get_editor_viewport().remove_child(FileEditor)
func has_main_screen():