diff options
| author | Rémi Verschelde | 2017-06-14 23:11:41 +0200 |
|---|---|---|
| committer | GitHub | 2017-06-14 23:11:41 +0200 |
| commit | 19017a760cbddee9bf0b40824ae9fbf5ca6d9042 (patch) | |
| tree | c0338f78ed6a476261f16ee684f0654471eae5d5 /modules/gdscript/gd_editor.cpp | |
| parent | 80de0c35df3aea7155c6e8026448896c3c749126 (diff) | |
| parent | 8361b1ce07266350ef6b6a2d34411030b7e587b2 (diff) | |
| download | godot-19017a760cbddee9bf0b40824ae9fbf5ca6d9042.tar.gz godot-19017a760cbddee9bf0b40824ae9fbf5ca6d9042.tar.zst godot-19017a760cbddee9bf0b40824ae9fbf5ca6d9042.zip | |
Merge pull request #9158 from Hinsbart/script_templates
Add ability to use custom script templates.
Diffstat (limited to '')
| -rw-r--r-- | modules/gdscript/gd_editor.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index eea5b1523..5e3ce31dd 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -69,6 +69,19 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str return script; } +bool GDScriptLanguage::is_using_templates() { + + return true; +} + +void GDScriptLanguage::make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) { + + String src = p_script->get_source_code(); + src = src.replace("%BASE%", p_base_class_name); + src = src.replace("%TS%", _get_indentation()); + p_script->set_source_code(src); +} + bool GDScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { GDParser parser; |
