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
This commit is contained in:
Andreas Haas 2017-06-13 20:03:08 +00:00
parent a8a1f2e2a8
commit 8361b1ce07
10 changed files with 111 additions and 4 deletions

View file

@ -2369,6 +2369,17 @@ Ref<Script> VisualScriptLanguage::get_template(const String &p_class_name, const
script->set_instance_base_type(p_base_class_name);
return script;
}
bool VisualScriptLanguage::is_using_templates() {
return true;
}
void VisualScriptLanguage::make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {
Ref<VisualScript> script = p_script;
script->set_instance_base_type(p_base_class_name);
}
bool VisualScriptLanguage::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 {
return false;