diff options
author | fabriceci <fabricecipolla@gmail.com> | 2021-10-11 11:30:59 +0200 |
---|---|---|
committer | jmb462 <jmb462@gmail.com> | 2022-01-02 21:52:09 +0100 |
commit | 9d5b80705912d85c3c7301ac0ea0afbf9372a660 (patch) | |
tree | e9528ac06fcfc29bc43846713d1c3ddb94becc22 /core/object/script_language.h | |
parent | 28174d531b7128f0281fc2b88da2f4962fd3513e (diff) |
Improve editor template workflow
Co-Authored-By: jmb462 <jmb462@gmail.com>
Diffstat (limited to 'core/object/script_language.h')
-rw-r--r-- | core/object/script_language.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/core/object/script_language.h b/core/object/script_language.h index 8d76cbf479..4754b01a07 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -274,13 +274,32 @@ public: String message; }; + enum TemplateLocation { + TEMPLATE_BUILT_IN, + TEMPLATE_EDITOR, + TEMPLATE_PROJECT + }; + + struct ScriptTemplate { + String inherit = "Object"; + String name; + String description; + String content; + int id = 0; + TemplateLocation origin = TemplateLocation::TEMPLATE_BUILT_IN; + + String get_hash() const { + return itos(origin) + inherit + name; + } + }; + void get_core_type_words(List<String> *p_core_type_words) const; virtual void get_reserved_words(List<String> *p_words) const = 0; virtual bool is_control_flow_keyword(String p_string) const = 0; virtual void get_comment_delimiters(List<String> *p_delimiters) const = 0; virtual void get_string_delimiters(List<String> *p_delimiters) const = 0; - virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const = 0; - virtual void make_template(const String &p_class_name, const String &p_base_class_name, Ref<Script> &p_script) {} + virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const { return Ref<Script>(); } + virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) { return Vector<ScriptTemplate>(); } virtual bool is_using_templates() { return false; } virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const = 0; virtual String validate_path(const String &p_path) const { return ""; } |