diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2022-08-06 14:27:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-06 14:27:17 +0200 |
| commit | 77d3ac700d5f528c0393d6aff1306e76f07b0d83 (patch) | |
| tree | 31e3560386c2b6d2af4f2bb9a050ec0edae37de2 /core/object/script_language.cpp | |
| parent | c81ef515030ba262c9e507a0453a8bc86258e309 (diff) | |
| parent | 0e1f7e9f89e74ebf4b2dec04f26ffab13c32a237 (diff) | |
| download | redot-engine-77d3ac700d5f528c0393d6aff1306e76f07b0d83.tar.gz | |
Merge pull request #63712 from object71/fix-export-issues
Diffstat (limited to 'core/object/script_language.cpp')
| -rw-r--r-- | core/object/script_language.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 226fd8b791..b06c2e8896 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -101,6 +101,31 @@ Dictionary Script::_get_script_constant_map() { return ret; } +#ifdef TOOLS_ENABLED + +PropertyInfo Script::get_class_category() const { + String path = get_path(); + String name; + + if (is_built_in()) { + if (get_name().is_empty()) { + name = TTR("Built-in script"); + } else { + name = vformat("%s (%s)", get_name(), TTR("Built-in")); + } + } else { + if (get_name().is_empty()) { + name = path.get_file(); + } else { + name = get_name(); + } + } + + return PropertyInfo(Variant::NIL, name, PROPERTY_HINT_NONE, path, PROPERTY_USAGE_CATEGORY); +} + +#endif // TOOLS_ENABLED + void Script::_bind_methods() { ClassDB::bind_method(D_METHOD("can_instantiate"), &Script::can_instantiate); //ClassDB::bind_method(D_METHOD("instance_create","base_object"),&Script::instance_create); |
