diff options
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/script_language.cpp | 7 | ||||
-rw-r--r-- | core/object/script_language.h | 14 | ||||
-rw-r--r-- | core/object/script_language_extension.cpp | 1 | ||||
-rw-r--r-- | core/object/script_language_extension.h | 1 |
4 files changed, 23 insertions, 0 deletions
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 3b9b1f9094..d358a8d2a0 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -535,6 +535,13 @@ TypedArray<int> ScriptLanguage::CodeCompletionOption::get_option_cached_characte return charac; } +void ScriptLanguage::_bind_methods() { + BIND_ENUM_CONSTANT(SCRIPT_NAME_CASING_AUTO); + BIND_ENUM_CONSTANT(SCRIPT_NAME_CASING_PASCAL_CASE); + BIND_ENUM_CONSTANT(SCRIPT_NAME_CASING_SNAKE_CASE); + BIND_ENUM_CONSTANT(SCRIPT_NAME_CASING_KEBAB_CASE); +} + bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_value) { if (script->is_placeholder_fallback_enabled()) { return false; diff --git a/core/object/script_language.h b/core/object/script_language.h index 4217bc9f96..95e9d2b4af 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -193,6 +193,10 @@ public: class ScriptLanguage : public Object { GDCLASS(ScriptLanguage, Object) + +protected: + static void _bind_methods(); + public: virtual String get_name() const = 0; @@ -224,6 +228,13 @@ public: TEMPLATE_PROJECT }; + enum ScriptNameCasing { + SCRIPT_NAME_CASING_AUTO, + SCRIPT_NAME_CASING_PASCAL_CASE, + SCRIPT_NAME_CASING_SNAKE_CASE, + SCRIPT_NAME_CASING_KEBAB_CASE, + }; + struct ScriptTemplate { String inherit = "Object"; String name; @@ -260,6 +271,7 @@ public: virtual bool can_make_function() const { return true; } virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; } virtual bool overrides_external_editor() { return false; } + virtual ScriptNameCasing preferred_file_name_casing() const { return SCRIPT_NAME_CASING_SNAKE_CASE; } // Keep enums in sync with: // scene/gui/code_edit.h - CodeEdit::CodeCompletionKind @@ -405,6 +417,8 @@ public: virtual ~ScriptLanguage() {} }; +VARIANT_ENUM_CAST(ScriptLanguage::ScriptNameCasing); + extern uint8_t script_encryption_key[32]; class PlaceHolderScriptInstance : public ScriptInstance { diff --git a/core/object/script_language_extension.cpp b/core/object/script_language_extension.cpp index 3a9b171f28..ec99c7cf4e 100644 --- a/core/object/script_language_extension.cpp +++ b/core/object/script_language_extension.cpp @@ -112,6 +112,7 @@ void ScriptLanguageExtension::_bind_methods() { GDVIRTUAL_BIND(_can_make_function); GDVIRTUAL_BIND(_open_in_external_editor, "script", "line", "column"); GDVIRTUAL_BIND(_overrides_external_editor); + GDVIRTUAL_BIND(_preferred_file_name_casing); GDVIRTUAL_BIND(_complete_code, "code", "path", "owner"); GDVIRTUAL_BIND(_lookup_code, "code", "symbol", "path", "owner"); diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h index aa0788b8bf..18105ec8cd 100644 --- a/core/object/script_language_extension.h +++ b/core/object/script_language_extension.h @@ -376,6 +376,7 @@ public: EXBIND0RC(bool, can_make_function) EXBIND3R(Error, open_in_external_editor, const Ref<Script> &, int, int) EXBIND0R(bool, overrides_external_editor) + EXBIND0RC(ScriptNameCasing, preferred_file_name_casing) GDVIRTUAL3RC(Dictionary, _complete_code, const String &, const String &, Object *) |