From 895a446f6a1e8a81f1f5e392f81ac5a20bca77ae Mon Sep 17 00:00:00 2001 From: Kris Date: Sat, 19 Oct 2024 12:09:57 +0200 Subject: [PATCH] Fix a critical issue where a function was referring to Loggie while Loggie might not be present, causing a cascade of errors on fresh installation. --- addons/loggie/loggie_settings.gd | 3 ++- addons/loggie/tools/loggie_system_specs.gd | 13 +++++++++++++ addons/loggie/tools/loggie_tools.gd | 12 ------------ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/loggie/loggie_settings.gd b/addons/loggie/loggie_settings.gd index 065240d..33246e0 100644 --- a/addons/loggie/loggie_settings.gd +++ b/addons/loggie/loggie_settings.gd @@ -274,6 +274,7 @@ func to_dict() -> Dictionary: "format_warning_msg", "format_notice_msg", "format_info_msg", "format_debug_msg", "h_separator_symbol", "box_characters_mode", "box_symbols_compatible", "box_symbols_pretty", ] + for var_name in included: - dict[var_name] = Loggie.settings.get(var_name) + dict[var_name] = get(var_name) return dict diff --git a/addons/loggie/tools/loggie_system_specs.gd b/addons/loggie/tools/loggie_system_specs.gd index 025e3e8..ef4f26f 100644 --- a/addons/loggie/tools/loggie_system_specs.gd +++ b/addons/loggie/tools/loggie_system_specs.gd @@ -170,3 +170,16 @@ func embed_input_specs() -> LoggieSystemSpecsMsg: self.add(loggie.msg("Virtual keyboard height:").bold(), DisplayServer.virtual_keyboard_get_height()) return self + +## Prints out a bunch of useful data about a given script. +## Useful for debugging. +func embed_script_data(script : Script): + var loggie = get_logger() + var msg = loggie.msg("Script Data for:", script.get_path()).color("pink") + msg.add(":").nl() + msg.add(loggie.msg("get_class():").color("slate_blue").bold()).add(script.get_class()).nl() + msg.add(loggie.msg("get_global_name():").color("slate_blue").bold()).add(script.get_global_name()).nl() + msg.add(loggie.msg("get_base_script():").color("slate_blue").bold()).add(script.get_base_script().resource_path if script.get_base_script() != null else "No base script.").nl() + msg.add(loggie.msg("get_instance_base_type():").color("slate_blue").bold()).add(script.get_instance_base_type()).nl() + msg.add(loggie.msg("get_script_property_list():").color("slate_blue").bold()).add(script.get_script_property_list()).nl() + return self diff --git a/addons/loggie/tools/loggie_tools.gd b/addons/loggie/tools/loggie_tools.gd index c0c76f4..fa5977b 100644 --- a/addons/loggie/tools/loggie_tools.gd +++ b/addons/loggie/tools/loggie_tools.gd @@ -194,18 +194,6 @@ static func extract_class_name_from_gd_script(path_or_script : Variant, proxy : return _class_name -## Prints out a bunch of useful data about a given script. -## Useful for debugging. -static func print_script_data(script : Script): - var msg = Loggie.msg("Script Data for:", script.get_path()).color("pink") - msg.add(":").nl() - msg.add(Loggie.msg("get_class():").color("slate_blue").bold()).add(script.get_class()).nl() - msg.add(Loggie.msg("get_global_name():").color("slate_blue").bold()).add(script.get_global_name()).nl() - msg.add(Loggie.msg("get_base_script():").color("slate_blue").bold()).add(script.get_base_script().resource_path if script.get_base_script() != null else "No base script.").nl() - msg.add(Loggie.msg("get_instance_base_type():").color("slate_blue").bold()).add(script.get_instance_base_type()).nl() - msg.add(Loggie.msg("get_script_property_list():").color("slate_blue").bold()).add(script.get_script_property_list()).nl() - msg.info() - ## A dictionary of named colors matching the constants from [Color] used to help with rich text coloring. ## There may be a way to obtain these Color values without this dictionary if one can somehow check for the ## existence and value of a constant on the Color class (since they're already there),