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