From 71d71d55b5c0d6da4d1555823ac432bf0b33389a Mon Sep 17 00:00:00 2001 From: Braden Bodily Date: Wed, 14 Aug 2019 20:57:49 -0600 Subject: Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/' Condensed some if and ERR statements. Added dots to end of error messages Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?), core/os/memory.cpp, drivers/png/png_driver_common.cpp, drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?) --- core/project_settings.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'core/project_settings.cpp') diff --git a/core/project_settings.cpp b/core/project_settings.cpp index c1d4967f55..0a673fb638 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -500,8 +500,7 @@ Error ProjectSettings::_load_settings_binary(const String &p_path) { if (hdr[0] != 'E' || hdr[1] != 'C' || hdr[2] != 'F' || hdr[3] != 'G') { memdelete(f); - ERR_EXPLAIN("Corrupted header in binary project.binary (not ECFG)"); - ERR_FAIL_V(ERR_FILE_CORRUPT); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Corrupted header in binary project.binary (not ECFG)."); } uint32_t count = f->get_32(); @@ -522,8 +521,7 @@ Error ProjectSettings::_load_settings_binary(const String &p_path) { f->get_buffer(d.ptrw(), vlen); Variant value; err = decode_variant(value, d.ptr(), d.size(), NULL, true); - ERR_EXPLAIN("Error decoding property: " + key); - ERR_CONTINUE(err != OK); + ERR_CONTINUE_MSG(err != OK, "Error decoding property: " + key + "."); set(key, value); } @@ -577,8 +575,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) { config_version = value; if (config_version > CONFIG_VERSION) { memdelete(f); - ERR_EXPLAIN(vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, CONFIG_VERSION)); - ERR_FAIL_V(ERR_FILE_CANT_OPEN); + ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, vformat("Can't open project at '%s', its `config_version` (%d) is from a more recent and incompatible version of the engine. Expected config version: %d.", p_path, config_version, CONFIG_VERSION)); } } else { if (section == String()) { @@ -645,11 +642,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Mapstore_buffer(hdr, 4); @@ -738,10 +731,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Mapstore_line("; Engine configuration file."); file->store_line("; It's best edited using the editor UI and not directly,"); @@ -872,8 +862,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust return _save_settings_binary(p_path, props, p_custom, custom_features); else { - ERR_EXPLAIN("Unknown config file format: " + p_path); - ERR_FAIL_V(ERR_FILE_UNRECOGNIZED); + ERR_FAIL_V_MSG(ERR_FILE_UNRECOGNIZED, "Unknown config file format: " + p_path + "."); } } -- cgit v1.2.3 From f013596760da0631bc6efb4c5ab527bf1553c1de Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Thu, 22 Aug 2019 18:59:43 +0300 Subject: Allow to define and load script templates per project Previously it was only possible to create custom script templates per editor instance which could lead to certain name collisions, but now one can create such templates per project tailored for specific use cases. The default path to search for custom script templates is defined in project settings via `editor/script_templates_search_path` setting as `res://script_templates` path, yet this can be configured per project. Templates have at most two origins now: 1. Project-specific, defined in `ProjectSettings`, for instance: - res://script_templates/ 2. Editor script templates, for instance: - %APPDATA%/Godot/script_templates/ As script templates can have the same name over different paths, the override mechanism was also added, enabling project-specific templates over the editor ones. --- core/project_settings.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core/project_settings.cpp') diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 0a673fb638..eb88143db3 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -1019,6 +1019,9 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF("editor/search_in_file_extensions", extensions); custom_prop_info["editor/search_in_file_extensions"] = PropertyInfo(Variant::POOL_STRING_ARRAY, "editor/search_in_file_extensions"); + GLOBAL_DEF("editor/script_templates_search_path", "res://script_templates"); + custom_prop_info["editor/script_templates_search_path"] = PropertyInfo(Variant::STRING, "editor/script_templates_search_path", PROPERTY_HINT_DIR); + action = Dictionary(); action["deadzone"] = Variant(0.5f); events = Array(); -- cgit v1.2.3 From 5bd01bf6378b301f34ca23b55f501555e8724978 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 17 Aug 2019 18:20:17 +0200 Subject: Add a project description setting The description is displayed as a tooltip when hovering the project in the Project Manager. It can span multiple lines. This partially addresses #8167. --- core/project_settings.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/project_settings.cpp') diff --git a/core/project_settings.cpp b/core/project_settings.cpp index eb88143db3..ec2c5ecbb3 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -1000,6 +1000,8 @@ ProjectSettings::ProjectSettings() { Ref joyb; GLOBAL_DEF("application/config/name", ""); + GLOBAL_DEF("application/config/description", ""); + custom_prop_info["application/config/description"] = PropertyInfo(Variant::STRING, "application/config/description", PROPERTY_HINT_MULTILINE_TEXT); GLOBAL_DEF("application/run/main_scene", ""); custom_prop_info["application/run/main_scene"] = PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "*.tscn,*.scn,*.res"); GLOBAL_DEF("application/run/disable_stdout", false); -- cgit v1.2.3