mirror of
https://github.com/godotengine/godot.git
synced 2025-01-24 03:24:32 -05:00
Merge pull request #80487 from theraot/expose_set_global_name
Expose `Script.get_global_name()`
This commit is contained in:
commit
80c3ed6845
2 changed files with 23 additions and 0 deletions
|
@ -138,6 +138,8 @@ void Script::_bind_methods() {
|
||||||
ClassDB::bind_method(D_METHOD("get_base_script"), &Script::get_base_script);
|
ClassDB::bind_method(D_METHOD("get_base_script"), &Script::get_base_script);
|
||||||
ClassDB::bind_method(D_METHOD("get_instance_base_type"), &Script::get_instance_base_type);
|
ClassDB::bind_method(D_METHOD("get_instance_base_type"), &Script::get_instance_base_type);
|
||||||
|
|
||||||
|
ClassDB::bind_method(D_METHOD("get_global_name"), &Script::get_global_name);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("has_script_signal", "signal_name"), &Script::has_script_signal);
|
ClassDB::bind_method(D_METHOD("has_script_signal", "signal_name"), &Script::has_script_signal);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_script_property_list"), &Script::_get_script_property_list);
|
ClassDB::bind_method(D_METHOD("get_script_property_list"), &Script::_get_script_property_list);
|
||||||
|
|
|
@ -24,6 +24,27 @@
|
||||||
Returns the script directly inherited by this script.
|
Returns the script directly inherited by this script.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="get_global_name" qualifiers="const">
|
||||||
|
<return type="StringName" />
|
||||||
|
<description>
|
||||||
|
Returns the class name associated with the script, if there is one. Returns an empty string otherwise.
|
||||||
|
To give the script a global name, you can use the [code]class_name[/code] keyword in GDScript and the [code][GlobalClass][/code] attribute in C#.
|
||||||
|
[codeblocks]
|
||||||
|
[gdscript]
|
||||||
|
class_name MyNode
|
||||||
|
extends Node
|
||||||
|
[/gdscript]
|
||||||
|
[csharp]
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class MyNode : Node
|
||||||
|
{
|
||||||
|
}
|
||||||
|
[/csharp]
|
||||||
|
[/codeblocks]
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="get_instance_base_type" qualifiers="const">
|
<method name="get_instance_base_type" qualifiers="const">
|
||||||
<return type="StringName" />
|
<return type="StringName" />
|
||||||
<description>
|
<description>
|
||||||
|
|
Loading…
Add table
Reference in a new issue