delete unused classes

This commit is contained in:
Nordup 2023-06-01 23:16:53 +03:00
parent 43cce4cb30
commit 9a02682fb1
7 changed files with 47 additions and 173 deletions

View file

@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://the_gates/scripts/app.gd" id="1_skc7d"]
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://the_gates/resources/gate_events.res" id="2_cdryv"]
[ext_resource type="PackedScene" uid="uid://5btb7nvgmfhl" path="res://the_gates/scenes/menu.tscn" id="3_o1f7b"]
[ext_resource type="PackedScene" uid="uid://dle3s7sp53jat" path="res://the_gates/scenes/world.tscn" id="4_cmlvo"]
[ext_resource type="PackedScene" uid="uid://kywrsqro3d5i" path="res://the_gates/scenes/world.tscn" id="4_cmlvo"]
[ext_resource type="Script" path="res://the_gates/scripts/bookmark_saver.gd" id="5_ev0ch"]
[ext_resource type="Resource" uid="uid://bewhdj6jugt6q" path="res://the_gates/resources/bookmarks.tres" id="6_rupvx"]
[ext_resource type="PackedScene" uid="uid://byrcbqat0n2px" path="res://the_gates/scenes/debug.tscn" id="7_3xeb8"]

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=36 format=3 uid="uid://dle3s7sp53jat"]
[gd_scene load_steps=36 format=3 uid="uid://kywrsqro3d5i"]
[ext_resource type="Script" path="res://the_gates/scripts/loading/pack_loader.gd" id="1_5swiq"]
[ext_resource type="Script" path="res://the_gates/scripts/loading/gate_loader.gd" id="1_coscx"]
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://the_gates/resources/gate_events.res" id="2_ot8b0"]
[ext_resource type="Script" path="res://the_gates/scripts/loading/sandbox_manager.gd" id="3_u7ft0"]
[ext_resource type="Shader" path="res://the_gates/shaders/blur.gdshader" id="4_fnp53"]
[ext_resource type="PackedScene" uid="uid://ctam0fxigbefk" path="res://the_gates/scenes/components/search.tscn" id="4_sg0oy"]
[ext_resource type="Texture2D" uid="uid://bpj05amcrq1cq" path="res://the_gates/textures/slide-up.png" id="4_x2j1m"]
@ -74,17 +74,46 @@ font_size = 27
[node name="World" type="Node"]
[node name="Loaders" type="Node" parent="."]
[node name="GateLoader" type="Node" parent="Loaders"]
[node name="GateLoader" type="Node" parent="."]
script = ExtResource("1_coscx")
gate_events = ExtResource("2_ot8b0")
[node name="PackLoader" type="Node" parent="Loaders" node_paths=PackedStringArray("render_result")]
script = ExtResource("1_5swiq")
[node name="SandboxManager" type="Node" parent="." node_paths=PackedStringArray("render_result")]
script = ExtResource("3_u7ft0")
gate_events = ExtResource("2_ot8b0")
render_result = NodePath("../../WorldCanvas/RenderResult")
sandbox_executable = "Sandbox.exe"
render_result = NodePath("../WorldCanvas/RenderResult")
sandbox_executable = "godot.linuxbsd.editor.dev.sandbox.x86_64.llvm"
[node name="WorldCanvas" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_lock_ = true
[node name="RenderResult" type="TextureRect" parent="WorldCanvas"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("19_vfqxk")
gate_events = ExtResource("2_ot8b0")
command_events = ExtResource("22_lfk5j")
splash_screen = ExtResource("9_req2b")
[node name="InputSync" type="Node" parent="WorldCanvas"]
script = ExtResource("19_7opuh")
gate_events = ExtResource("2_ot8b0")
ui_events = ExtResource("22_ryq4n")
[node name="CommandSync" type="CommandSync" parent="WorldCanvas"]
script = ExtResource("20_js3fi")
gate_events = ExtResource("2_ot8b0")
command_events = ExtResource("22_lfk5j")
[node name="UICanvas" type="CanvasLayer" parent="."]
follow_viewport_enabled = true
@ -707,37 +736,6 @@ layout_mode = 2
texture = ExtResource("4_x2j1m")
expand_mode = 1
[node name="WorldCanvas" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
metadata/_edit_lock_ = true
[node name="RenderResult" type="TextureRect" parent="WorldCanvas"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("19_vfqxk")
gate_events = ExtResource("2_ot8b0")
command_events = ExtResource("22_lfk5j")
splash_screen = ExtResource("9_req2b")
[node name="InputSync" type="Node" parent="WorldCanvas"]
script = ExtResource("19_7opuh")
gate_events = ExtResource("2_ot8b0")
ui_events = ExtResource("22_ryq4n")
[node name="CommandSync" type="CommandSync" parent="WorldCanvas"]
script = ExtResource("20_js3fi")
gate_events = ExtResource("2_ot8b0")
command_events = ExtResource("22_lfk5j")
[connection signal="pressed" from="UICanvas/UI/Blur/HideOnPress" to="UICanvas/UI" method="hide_ui"]
[connection signal="pressed" from="UICanvas/UI/GateInfo/Bookmark/Star" to="UICanvas/UI/GateInfo" method="_on_star_pressed"]
[connection signal="pressed" from="UICanvas/UI/GateInfo/Bookmark/Unstar" to="UICanvas/UI/GateInfo" method="_on_unstar_pressed"]

View file

@ -4,8 +4,6 @@ class_name ConfigGate
var title: String
var description: String
var image_url: String
var godot_config_url: String
var global_script_class_url: String
var resource_pack_url: String
const section = "gate"
@ -16,6 +14,4 @@ func _init(path: String, base_url: String) -> void:
title = get_string(section, "title")
description = get_string(section, "description")
image_url = Url.join(base_url, get_string(section, "image"))
godot_config_url = Url.join(base_url, get_string(section, "godot_config"))
global_script_class_url = Url.join(base_url, get_string(section, "global_script_class"))
resource_pack_url = Url.join(base_url, get_string(section, "resource_pack"))

View file

@ -1,28 +0,0 @@
extends ConfigBase
class_name ConfigGlobalScript
# for unloading
var scripts
func _init(path: String) -> void:
super._init(path)
func load_config() -> void:
load_global_classes()
func unload_config() -> void:
unload_global_classes()
func load_global_classes() -> void:
scripts = get_value("", "list")
if scripts == null: return
for script in scripts: CppExposed.add_global_class(script)
func unload_global_classes() -> void:
if scripts == null: return
for script in scripts: CppExposed.remove_global_class(script)

View file

@ -1,55 +0,0 @@
extends ConfigBase
class_name ConfigGodot
var scene_path: String
# for unloading
var autoloads
var actions
func _init(path: String) -> void:
super._init(path)
scene_path = get_string("application", "run/main_scene")
func load_config() -> void:
load_autoloads()
load_input_map()
func unload_config() -> void:
unload_autoloads()
unload_input_map()
func load_autoloads() -> void:
autoloads = get_section_keys("autoload")
if autoloads == null: return
for autoload in autoloads:
var path = get_value("autoload", autoload)
CppExposed.add_autoload(autoload, path)
func unload_autoloads() -> void:
if autoloads == null: return
for autoload in autoloads:
CppExposed.remove_autoload(autoload)
func load_input_map() -> void:
actions = get_section_keys("input")
if actions == null: return
for action_name in actions:
var action = get_value("input", action_name)
if not InputMap.has_action(action_name):
InputMap.add_action(action_name, action["deadzone"])
for event in action["events"]:
if not event is InputEvent: continue
InputMap.action_add_event(action_name, event)
func unload_input_map() -> void:
if actions == null: return
for action_name in actions: Input.action_release(action_name)
InputMap.load_from_project_settings()

View file

@ -1,34 +0,0 @@
extends Node
class_name CppExposed
static func add_global_class(script) -> void:
ScriptServerExposed.add_global_class(
script["class"], script["base"], script["language"], script["path"])
static func remove_global_class(script) -> void:
ScriptServerExposed.remove_global_class(script["class"])
static func print_global_classes() -> void:
# ProjectSettings.get_global_class_list() // Can be replaced with this
var global_classes = ScriptServerExposed.get_global_class_list()
Debug.logr("Global classes: " + str(global_classes))
static func add_autoload(autoload: String, path: String) -> void:
var is_singleton = false
if path.begins_with("*"):
path = path.trim_prefix("*")
is_singleton = true
ProjectSettingsExposed.add_autoload(autoload, path, is_singleton)
static func remove_autoload(autoload: String) -> void:
ProjectSettingsExposed.remove_autoload(autoload)
static func print_autoloads() -> void:
var autoloads = ProjectSettingsExposed.get_autoload_list()
Debug.logr("Autoloads: " + str(autoloads))

View file

@ -1,21 +1,18 @@
extends Node
class_name PackLoader
class_name SandboxManager
@export var gate_events: GateEvents
@export var render_result: RenderResult
@export var sandbox_executable: String
var gate: Gate
var pid: int
var sandbox_pid: int
func _ready() -> void:
gate_events.gate_loaded.connect(create_process)
func create_process(_gate: Gate) -> void:
gate = _gate
func create_process(gate: Gate) -> void:
var executable_dir = OS.get_executable_path().get_base_dir() + "/"
var sandbox_path = executable_dir + sandbox_executable
var pack_file = ProjectSettings.globalize_path(gate.resource_pack)
@ -26,16 +23,16 @@ func create_process(_gate: Gate) -> void:
"--fd-path", render_result.fd_path
]
Debug.logclr(sandbox_path + " " + " ".join(args), Color.DARK_VIOLET)
pid = OS.create_process(sandbox_path, args)
sandbox_pid = OS.create_process(sandbox_path, args)
if OS.get_name() == "Windows": render_result.fd_path += "|" + str(pid)
if OS.get_name() == "Windows": render_result.fd_path += "|" + str(sandbox_pid)
gate_events.gate_entered_emit()
func kill_process() -> void:
if OS.is_process_running(pid):
OS.kill(pid)
Debug.logclr("Process killed " + str(pid), Color.DIM_GRAY)
if OS.is_process_running(sandbox_pid):
OS.kill(sandbox_pid)
Debug.logclr("Process killed " + str(sandbox_pid), Color.DIM_GRAY)
func _exit_tree() -> void: