diff options
author | Andreas Haas <hinsbart@gmail.com> | 2017-06-13 20:03:08 +0000 |
---|---|---|
committer | Andreas Haas <hinsbart@gmail.com> | 2017-06-13 20:03:08 +0000 |
commit | 8361b1ce07266350ef6b6a2d34411030b7e587b2 (patch) | |
tree | ff9cab7037410224c1b76aab30f394305b523fe8 /modules/gdscript/gd_script.cpp | |
parent | a8a1f2e2a864e6b58d5bcf1c7e53a43cdb6d95d9 (diff) | |
download | redot-engine-8361b1ce07266350ef6b6a2d34411030b7e587b2.tar.gz |
Add ability to use custom script templates.
Templates will be loaded from .godot/script_templates
For now they're disabled for GDNative.
Ideas for further improvements:
- Add a "Save as Template" option to the script editor, as it can normally only save to res://
- Support more placeholders / custom placeholders
Diffstat (limited to 'modules/gdscript/gd_script.cpp')
-rw-r--r-- | modules/gdscript/gd_script.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index dcc0e24098..1dcc442234 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -615,6 +615,11 @@ Error GDScript::reload(bool p_keep_state) { if (basedir != "") basedir = basedir.get_base_dir(); + if (basedir.find("res://") == -1 && basedir.find("user://") == -1) { + //loading a template, don't parse + return OK; + } + valid = false; GDParser parser; Error err = parser.parse(source, basedir, false, path); |