diff options
author | Juan Linietsky <reduzio@gmail.com> | 2023-01-19 19:12:25 +0100 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2023-01-21 14:19:27 +0100 |
commit | dddd8d43f618874642a228800187fb0912c46c20 (patch) | |
tree | ffb66d3db3d61157b119b0e1610a558170f506af /modules | |
parent | 14fdd28de9f1f9979cb6cffa4b715a16d406439d (diff) |
Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.
Properly fixes #66179. Supersedes #66215 and supersedes #62417
**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript.h | 1 | ||||
-rw-r--r-- | modules/mono/csharp_script.cpp | 4 | ||||
-rw-r--r-- | modules/mono/csharp_script.h | 2 |
4 files changed, 11 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 28f478e9cd..1d13ecfdb1 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -248,6 +248,10 @@ Ref<Script> GDScript::get_base_script() const { } } +StringName GDScript::get_global_name() const { + return name; +} + StringName GDScript::get_instance_base_type() const { if (native.is_valid()) { return native->get_name(); diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index a53785a98d..436b44af4e 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -228,6 +228,7 @@ public: virtual bool can_instantiate() const override; virtual Ref<Script> get_base_script() const override; + virtual StringName get_global_name() const override; virtual StringName get_instance_base_type() const override; // this may not work in all scripts, will return empty if so virtual ScriptInstance *instance_create(Object *p_this) override; diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 7606465b8a..ca94917938 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -2606,6 +2606,10 @@ Ref<Script> CSharpScript::get_base_script() const { return base_script; } +StringName CSharpScript::get_global_name() const { + return StringName(); +} + void CSharpScript::get_script_property_list(List<PropertyInfo> *r_list) const { #ifdef TOOLS_ENABLED const CSharpScript *top = this; diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index ef381fd76a..6021555255 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -186,6 +186,8 @@ public: bool inherits_script(const Ref<Script> &p_script) const override; Ref<Script> get_base_script() const override; + StringName get_global_name() const override; + ScriptLanguage *get_language() const override; void get_script_method_list(List<MethodInfo> *p_list) const override; |