summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/debugger/remote_debugger.cpp7
-rw-r--r--core/doc_data.h13
-rw-r--r--core/io/file_access.cpp37
-rw-r--r--core/io/multiplayer_api.cpp8
-rw-r--r--core/io/multiplayer_api.h2
-rw-r--r--core/io/multiplayer_peer.cpp3
-rw-r--r--core/io/multiplayer_peer.h2
-rw-r--r--core/object/script_language.h1
-rw-r--r--core/os/os.cpp8
-rw-r--r--core/os/os.h4
-rw-r--r--doc/classes/AcceptDialog.xml2
-rw-r--r--doc/classes/Button.xml40
-rw-r--r--doc/classes/CheckBox.xml50
-rw-r--r--doc/classes/CheckButton.xml50
-rw-r--r--doc/classes/CodeEdit.xml90
-rw-r--r--doc/classes/ColorPicker.xml26
-rw-r--r--doc/classes/ColorPickerButton.xml30
-rw-r--r--doc/classes/File.xml11
-rw-r--r--doc/classes/FileDialog.xml20
-rw-r--r--doc/classes/GraphEdit.xml30
-rw-r--r--doc/classes/GraphNode.xml38
-rw-r--r--doc/classes/GridContainer.xml4
-rw-r--r--doc/classes/HBoxContainer.xml2
-rw-r--r--doc/classes/HScrollBar.xml18
-rw-r--r--doc/classes/HSeparator.xml4
-rw-r--r--doc/classes/HSlider.xml14
-rw-r--r--doc/classes/HSplitContainer.xml8
-rw-r--r--doc/classes/ItemList.xml34
-rw-r--r--doc/classes/Label.xml22
-rw-r--r--doc/classes/LineEdit.xml32
-rw-r--r--doc/classes/LinkButton.xml18
-rw-r--r--doc/classes/MarginContainer.xml8
-rw-r--r--doc/classes/MenuButton.xml28
-rw-r--r--doc/classes/MultiplayerAPI.xml1
-rw-r--r--doc/classes/MultiplayerPeer.xml4
-rw-r--r--doc/classes/OptionButton.xml40
-rw-r--r--doc/classes/Panel.xml4
-rw-r--r--doc/classes/PanelContainer.xml2
-rw-r--r--doc/classes/PopupMenu.xml50
-rw-r--r--doc/classes/PopupPanel.xml2
-rw-r--r--doc/classes/ProgressBar.xml16
-rw-r--r--doc/classes/RichTextLabel.xml54
-rw-r--r--doc/classes/ScrollContainer.xml2
-rw-r--r--doc/classes/Shortcut.xml16
-rw-r--r--doc/classes/SpinBox.xml2
-rw-r--r--doc/classes/TabContainer.xml38
-rw-r--r--doc/classes/Tabs.xml36
-rw-r--r--doc/classes/TextEdit.xml44
-rw-r--r--doc/classes/Tree.xml92
-rw-r--r--doc/classes/VBoxContainer.xml2
-rw-r--r--doc/classes/VScrollBar.xml18
-rw-r--r--doc/classes/VSeparator.xml4
-rw-r--r--doc/classes/VSlider.xml14
-rw-r--r--doc/classes/VSplitContainer.xml8
-rw-r--r--doc/classes/Window.xml26
-rwxr-xr-xdoc/tools/makerst.py66
-rw-r--r--editor/animation_bezier_editor.cpp4
-rw-r--r--editor/animation_track_editor.cpp6
-rw-r--r--editor/debugger/SCsub2
-rw-r--r--editor/debugger/debug_adapter/SCsub5
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_parser.cpp425
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_parser.h88
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.cpp497
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.h140
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_server.cpp102
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_server.h59
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_types.h270
-rw-r--r--editor/debugger/editor_debugger_node.cpp15
-rw-r--r--editor/debugger/editor_debugger_node.h5
-rw-r--r--editor/debugger/script_editor_debugger.cpp49
-rw-r--r--editor/debugger/script_editor_debugger.h10
-rw-r--r--editor/doc_tools.cpp97
-rw-r--r--editor/editor_help.cpp8
-rw-r--r--editor/editor_help_search.cpp4
-rw-r--r--editor/editor_help_search.h4
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/editor_settings.cpp18
-rw-r--r--editor/editor_themes.cpp3
-rw-r--r--editor/import/editor_importer_bake_reset.cpp17
-rw-r--r--editor/import/resource_importer_scene.cpp25
-rw-r--r--editor/inspector_dock.cpp28
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp26
-rw-r--r--editor/plugins/editor_debugger_plugin.cpp2
-rw-r--r--editor/plugins/editor_debugger_plugin.h2
-rw-r--r--editor/plugins/node_3d_editor_plugin.cpp41
-rw-r--r--editor/plugins/theme_editor_plugin.cpp57
-rw-r--r--editor/plugins/theme_editor_plugin.h2
-rw-r--r--editor/quick_open.cpp11
-rw-r--r--editor/settings_config_dialog.cpp10
-rw-r--r--main/main.cpp15
-rw-r--r--methods.py2
-rw-r--r--misc/dist/shell/_godot.zsh-completion2
-rw-r--r--misc/dist/shell/godot.bash-completion2
-rw-r--r--misc/dist/shell/godot.fish2
-rw-r--r--modules/enet/enet_multiplayer_peer.cpp41
-rw-r--r--modules/enet/enet_multiplayer_peer.h12
-rw-r--r--modules/gdnative/include/net/godot_net.h2
-rw-r--r--modules/gdnative/net/multiplayer_peer_gdnative.cpp11
-rw-r--r--modules/gdnative/net/multiplayer_peer_gdnative.h2
-rw-r--r--modules/gdscript/gdscript_editor.cpp1
-rw-r--r--modules/gdscript/gdscript_parser.cpp2
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.cpp4
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp28
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.h2
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.cpp125
-rw-r--r--modules/gdscript/language_server/gdscript_workspace.h3
-rw-r--r--modules/gdscript/language_server/lsp.hpp60
-rw-r--r--modules/mono/csharp_script.cpp7
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs2
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs259
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs24
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs4
-rw-r--r--modules/mono/glue/collections_glue.cpp15
-rw-r--r--modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml2
-rw-r--r--modules/webrtc/webrtc_multiplayer_peer.cpp97
-rw-r--r--modules/webrtc/webrtc_multiplayer_peer.h24
-rw-r--r--modules/websocket/websocket_multiplayer_peer.cpp8
-rw-r--r--modules/websocket/websocket_multiplayer_peer.h2
-rw-r--r--scene/2d/physics_body_2d.cpp4
-rw-r--r--scene/2d/tile_map.cpp24
-rw-r--r--scene/2d/tile_map.h4
-rw-r--r--scene/3d/physics_body_3d.cpp4
-rw-r--r--scene/gui/base_button.cpp4
-rw-r--r--scene/gui/popup_menu.cpp6
-rw-r--r--scene/gui/shortcut.cpp33
-rw-r--r--scene/gui/shortcut.h12
-rw-r--r--scene/resources/shader.cpp3
-rw-r--r--tests/data/translations.csv5
-rw-r--r--tests/test_file_access.h29
130 files changed, 3222 insertions, 919 deletions
diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp
index 0add12ff3d..62d5126e57 100644
--- a/core/debugger/remote_debugger.cpp
+++ b/core/debugger/remote_debugger.cpp
@@ -706,6 +706,8 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
Array msg;
msg.push_back(p_can_continue);
msg.push_back(error_str);
+ ERR_FAIL_COND(!script_lang);
+ msg.push_back(script_lang->debug_get_stack_level_count() > 0);
send_message("debug_enter", msg);
servers_profiler->skip_profile_frame = true; // Avoid frame time spike in debug.
@@ -754,7 +756,6 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
break;
} else if (command == "get_stack_dump") {
- ERR_FAIL_COND(!script_lang);
DebuggerMarshalls::ScriptStackDump dump;
int slc = script_lang->debug_get_stack_level_count();
for (int i = 0; i < slc; i++) {
@@ -790,7 +791,9 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
script_lang->debug_get_globals(&globals, &globals_vals);
ERR_FAIL_COND(globals.size() != globals_vals.size());
- send_message("stack_frame_vars", Array());
+ Array var_size;
+ var_size.push_back(local_vals.size() + member_vals.size() + globals_vals.size());
+ send_message("stack_frame_vars", var_size);
_send_stack_vars(locals, local_vals, 0);
_send_stack_vars(members, member_vals, 1);
_send_stack_vars(globals, globals_vals, 2);
diff --git a/core/doc_data.h b/core/doc_data.h
index 46ab697768..a3011fe275 100644
--- a/core/doc_data.h
+++ b/core/doc_data.h
@@ -116,6 +116,17 @@ public:
}
};
+ struct ThemeItemDoc {
+ String name;
+ String type;
+ String data_type;
+ String description;
+ String default_value;
+ bool operator<(const ThemeItemDoc &p_theme_item) const {
+ return name < p_theme_item.name;
+ }
+ };
+
struct TutorialDoc {
String link;
String title;
@@ -133,7 +144,7 @@ public:
Vector<ConstantDoc> constants;
Map<String, String> enums;
Vector<PropertyDoc> properties;
- Vector<PropertyDoc> theme_properties;
+ Vector<ThemeItemDoc> theme_properties;
bool is_script_doc = false;
String script_path;
bool operator<(const ClassDoc &p_class) const {
diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp
index d21c0bd9a2..e6e79dff8a 100644
--- a/core/io/file_access.cpp
+++ b/core/io/file_access.cpp
@@ -316,52 +316,53 @@ String FileAccess::get_line() const {
}
Vector<String> FileAccess::get_csv_line(const String &p_delim) const {
- ERR_FAIL_COND_V(p_delim.length() != 1, Vector<String>());
+ ERR_FAIL_COND_V_MSG(p_delim.length() != 1, Vector<String>(), "Only single character delimiters are supported to parse CSV lines.");
+ ERR_FAIL_COND_V_MSG(p_delim[0] == '"', Vector<String>(), "The double quotation mark character (\") is not supported as a delimiter for CSV lines.");
- String l;
+ String line;
+
+ // CSV can support entries with line breaks as long as they are enclosed
+ // in double quotes. So our "line" might be more than a single line in the
+ // text file.
int qc = 0;
do {
if (eof_reached()) {
break;
}
-
- l += get_line() + "\n";
+ line += get_line() + "\n";
qc = 0;
- for (int i = 0; i < l.length(); i++) {
- if (l[i] == '"') {
+ for (int i = 0; i < line.length(); i++) {
+ if (line[i] == '"') {
qc++;
}
}
-
} while (qc % 2);
- l = l.substr(0, l.length() - 1);
+ // Remove the extraneous newline we've added above.
+ line = line.substr(0, line.length() - 1);
Vector<String> strings;
bool in_quote = false;
String current;
- for (int i = 0; i < l.length(); i++) {
- char32_t c = l[i];
- char32_t s[2] = { 0, 0 };
-
+ for (int i = 0; i < line.length(); i++) {
+ char32_t c = line[i];
+ // A delimiter ends the current entry, unless it's in a quoted string.
if (!in_quote && c == p_delim[0]) {
strings.push_back(current);
current = String();
} else if (c == '"') {
- if (l[i + 1] == '"' && in_quote) {
- s[0] = '"';
- current += s;
+ // Doubled quotes are escapes for intentional quotes in the string.
+ if (line[i + 1] == '"' && in_quote) {
+ current += '"';
i++;
} else {
in_quote = !in_quote;
}
} else {
- s[0] = c;
- current += s;
+ current += c;
}
}
-
strings.push_back(current);
return strings;
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index d4f09b2135..1c3f231170 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -478,6 +478,7 @@ void MultiplayerAPI::_process_simplify_path(int p_from, const uint8_t *p_packet,
packet.write[1] = valid_rpc_checksum;
encode_cstring(pname.get_data(), &packet.write[2]);
+ network_peer->set_transfer_channel(0);
network_peer->set_transfer_mode(MultiplayerPeer::TRANSFER_MODE_RELIABLE);
network_peer->set_target_peer(p_from);
network_peer->put_packet(packet.ptr(), packet.size());
@@ -557,6 +558,7 @@ bool MultiplayerAPI::_send_confirm_path(Node *p_node, NodePath p_path, PathSentC
for (int &E : peers_to_add) {
network_peer->set_target_peer(E); // To all of you.
+ network_peer->set_transfer_channel(0);
network_peer->set_transfer_mode(MultiplayerPeer::TRANSFER_MODE_RELIABLE);
network_peer->put_packet(packet.ptr(), packet.size());
@@ -858,6 +860,7 @@ void MultiplayerAPI::_send_rpc(Node *p_from, int p_to, uint16_t p_rpc_id, const
#endif
// Take chance and set transfer mode, since all send methods will use it.
+ network_peer->set_transfer_channel(p_config.channel);
network_peer->set_transfer_mode(p_config.transfer_mode);
if (has_all_peers) {
@@ -996,7 +999,7 @@ void MultiplayerAPI::rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const
ERR_FAIL_COND_MSG(p_peer_id == node_id && !config.sync, "RPC '" + p_method + "' on yourself is not allowed by selected mode.");
}
-Error MultiplayerAPI::send_bytes(Vector<uint8_t> p_data, int p_to, MultiplayerPeer::TransferMode p_mode) {
+Error MultiplayerAPI::send_bytes(Vector<uint8_t> p_data, int p_to, MultiplayerPeer::TransferMode p_mode, int p_channel) {
ERR_FAIL_COND_V_MSG(p_data.size() < 1, ERR_INVALID_DATA, "Trying to send an empty raw packet.");
ERR_FAIL_COND_V_MSG(!network_peer.is_valid(), ERR_UNCONFIGURED, "Trying to send a raw packet while no network peer is active.");
ERR_FAIL_COND_V_MSG(network_peer->get_connection_status() != MultiplayerPeer::CONNECTION_CONNECTED, ERR_UNCONFIGURED, "Trying to send a raw packet via a network peer which is not connected.");
@@ -1007,6 +1010,7 @@ Error MultiplayerAPI::send_bytes(Vector<uint8_t> p_data, int p_to, MultiplayerPe
memcpy(&packet_cache.write[1], &r[0], p_data.size());
network_peer->set_target_peer(p_to);
+ network_peer->set_transfer_channel(p_channel);
network_peer->set_transfer_mode(p_mode);
return network_peer->put_packet(packet_cache.ptr(), p_data.size() + 1);
@@ -1066,7 +1070,7 @@ bool MultiplayerAPI::is_object_decoding_allowed() const {
void MultiplayerAPI::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_root_node", "node"), &MultiplayerAPI::set_root_node);
ClassDB::bind_method(D_METHOD("get_root_node"), &MultiplayerAPI::get_root_node);
- ClassDB::bind_method(D_METHOD("send_bytes", "bytes", "id", "mode"), &MultiplayerAPI::send_bytes, DEFVAL(MultiplayerPeer::TARGET_PEER_BROADCAST), DEFVAL(MultiplayerPeer::TRANSFER_MODE_RELIABLE));
+ ClassDB::bind_method(D_METHOD("send_bytes", "bytes", "id", "mode", "channel"), &MultiplayerAPI::send_bytes, DEFVAL(MultiplayerPeer::TARGET_PEER_BROADCAST), DEFVAL(MultiplayerPeer::TRANSFER_MODE_RELIABLE), DEFVAL(0));
ClassDB::bind_method(D_METHOD("has_network_peer"), &MultiplayerAPI::has_network_peer);
ClassDB::bind_method(D_METHOD("get_network_peer"), &MultiplayerAPI::get_network_peer);
ClassDB::bind_method(D_METHOD("get_network_unique_id"), &MultiplayerAPI::get_network_unique_id);
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index cc994a9852..011bc3dde9 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -132,7 +132,7 @@ public:
Node *get_root_node();
void set_network_peer(const Ref<MultiplayerPeer> &p_peer);
Ref<MultiplayerPeer> get_network_peer() const;
- Error send_bytes(Vector<uint8_t> p_data, int p_to = MultiplayerPeer::TARGET_PEER_BROADCAST, MultiplayerPeer::TransferMode p_mode = MultiplayerPeer::TRANSFER_MODE_RELIABLE);
+ Error send_bytes(Vector<uint8_t> p_data, int p_to = MultiplayerPeer::TARGET_PEER_BROADCAST, MultiplayerPeer::TransferMode p_mode = MultiplayerPeer::TRANSFER_MODE_RELIABLE, int p_channel = 0);
// Called by Node.rpc
void rpcp(Node *p_node, int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount);
diff --git a/core/io/multiplayer_peer.cpp b/core/io/multiplayer_peer.cpp
index 8b3b1eef8e..83cf24d7e3 100644
--- a/core/io/multiplayer_peer.cpp
+++ b/core/io/multiplayer_peer.cpp
@@ -54,6 +54,8 @@ uint32_t MultiplayerPeer::generate_unique_id() const {
}
void MultiplayerPeer::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_transfer_channel", "channel"), &MultiplayerPeer::set_transfer_channel);
+ ClassDB::bind_method(D_METHOD("get_transfer_channel"), &MultiplayerPeer::get_transfer_channel);
ClassDB::bind_method(D_METHOD("set_transfer_mode", "mode"), &MultiplayerPeer::set_transfer_mode);
ClassDB::bind_method(D_METHOD("get_transfer_mode"), &MultiplayerPeer::get_transfer_mode);
ClassDB::bind_method(D_METHOD("set_target_peer", "id"), &MultiplayerPeer::set_target_peer);
@@ -71,6 +73,7 @@ void MultiplayerPeer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_connections"), "set_refuse_new_connections", "is_refusing_new_connections");
ADD_PROPERTY(PropertyInfo(Variant::INT, "transfer_mode", PROPERTY_HINT_ENUM, "Unreliable,Unreliable Ordered,Reliable"), "set_transfer_mode", "get_transfer_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "transfer_channel", PROPERTY_HINT_RANGE, "0,255,1"), "set_transfer_channel", "get_transfer_channel");
BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE);
BIND_ENUM_CONSTANT(TRANSFER_MODE_UNRELIABLE_ORDERED);
diff --git a/core/io/multiplayer_peer.h b/core/io/multiplayer_peer.h
index 91a3ad7954..7ca4e7930b 100644
--- a/core/io/multiplayer_peer.h
+++ b/core/io/multiplayer_peer.h
@@ -56,6 +56,8 @@ public:
CONNECTION_CONNECTED,
};
+ virtual void set_transfer_channel(int p_channel) = 0;
+ virtual int get_transfer_channel() const = 0;
virtual void set_transfer_mode(TransferMode p_mode) = 0;
virtual TransferMode get_transfer_mode() const = 0;
virtual void set_target_peer(int p_peer_id) = 0;
diff --git a/core/object/script_language.h b/core/object/script_language.h
index 2cbaa0f52e..385bf79c1a 100644
--- a/core/object/script_language.h
+++ b/core/object/script_language.h
@@ -310,6 +310,7 @@ public:
Ref<Script> script;
String class_name;
String class_member;
+ String class_path;
int location;
};
diff --git a/core/os/os.cpp b/core/os/os.cpp
index f7af74da3e..cdb570bb73 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -215,14 +215,6 @@ void OS::dump_resources_to_file(const char *p_file) {
ResourceCache::dump(p_file);
}
-void OS::set_no_window_mode(bool p_enable) {
- _no_window = p_enable;
-}
-
-bool OS::is_no_window_mode_enabled() const {
- return _no_window;
-}
-
int OS::get_exit_code() const {
return _exit_code;
}
diff --git a/core/os/os.h b/core/os/os.h
index fcb195afe1..0466d94acd 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -53,7 +53,6 @@ class OS {
bool _verbose_stdout = false;
bool _debug_stdout = false;
String _local_clipboard;
- bool _no_window = false;
int _exit_code = EXIT_FAILURE; // unexpected exit is marked as failure
int _orientation;
bool _allow_hidpi = false;
@@ -269,9 +268,6 @@ public:
virtual Error move_to_trash(const String &p_path) { return FAILED; }
- virtual void set_no_window_mode(bool p_enable);
- virtual bool is_no_window_mode_enabled() const;
-
virtual void debug_break();
virtual int get_exit_code() const;
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 868ec5a774..077c062d6b 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -93,7 +93,7 @@
<constants>
</constants>
<theme_items>
- <theme_item name="panel" type="StyleBox">
+ <theme_item name="panel" data_type="style" type="StyleBox">
Panel that fills up the background of the window.
</theme_item>
</theme_items>
diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml
index 823eda9c33..dfbd6c0680 100644
--- a/doc/classes/Button.xml
+++ b/doc/classes/Button.xml
@@ -104,64 +104,64 @@
</constant>
</constants>
<theme_items>
- <theme_item name="disabled" type="StyleBox">
+ <theme_item name="disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is disabled.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] of the [Button]'s text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Default text [Color] of the [Button].
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
Text [Color] used when the [Button] is disabled.
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Text [Color] used when the [Button] is being hovered.
</theme_item>
- <theme_item name="font_hover_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_hover_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [Button] is being hovered and pressed.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [Button].
</theme_item>
- <theme_item name="font_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [Button] is being pressed.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [Button]'s text.
</theme_item>
- <theme_item name="hover" type="StyleBox">
+ <theme_item name="hover" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is being hovered.
</theme_item>
- <theme_item name="hseparation" type="int" default="2">
+ <theme_item name="hseparation" data_type="constant" type="int" default="2">
The horizontal space between [Button]'s icon and text.
</theme_item>
- <theme_item name="icon_disabled_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="icon_disabled_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Icon modulate [Color] used when the [Button] is disabled.
</theme_item>
- <theme_item name="icon_hover_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="icon_hover_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Icon modulate [Color] used when the [Button] is being hovered.
</theme_item>
- <theme_item name="icon_hover_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="icon_hover_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Icon modulate [Color] used when the [Button] is being hovered and pressed.
</theme_item>
- <theme_item name="icon_normal_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="icon_normal_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Default icon modulate [Color] of the [Button].
</theme_item>
- <theme_item name="icon_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="icon_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Icon modulate [Color] used when the [Button] is being pressed.
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Default [StyleBox] for the [Button].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="pressed" type="StyleBox">
+ <theme_item name="pressed" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is being pressed.
</theme_item>
</theme_items>
diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml
index 90f3725172..f13a6ea34a 100644
--- a/doc/classes/CheckBox.xml
+++ b/doc/classes/CheckBox.xml
@@ -18,76 +18,76 @@
<constants>
</constants>
<theme_items>
- <theme_item name="check_vadjust" type="int" default="0">
+ <theme_item name="check_vadjust" data_type="constant" type="int" default="0">
The vertical offset used when rendering the check icons (in pixels).
</theme_item>
- <theme_item name="checked" type="Texture2D">
+ <theme_item name="checked" data_type="icon" type="Texture2D">
The check icon to display when the [CheckBox] is checked.
</theme_item>
- <theme_item name="checked_disabled" type="Texture2D">
+ <theme_item name="checked_disabled" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="disabled" type="StyleBox">
+ <theme_item name="disabled" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is disabled.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is focused.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
The [Font] to use for the [CheckBox] text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
The [CheckBox] text's font color.
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
The [CheckBox] text's font color when it's disabled.
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
The [CheckBox] text's font color when it's hovered.
</theme_item>
- <theme_item name="font_hover_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_hover_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckBox] text's font color when it's hovered and pressed.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [CheckBox].
</theme_item>
- <theme_item name="font_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckBox] text's font color when it's pressed.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [CheckBox]'s text.
</theme_item>
- <theme_item name="hover" type="StyleBox">
+ <theme_item name="hover" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is hovered.
</theme_item>
- <theme_item name="hover_pressed" type="StyleBox">
+ <theme_item name="hover_pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is hovered and pressed.
</theme_item>
- <theme_item name="hseparation" type="int" default="4">
+ <theme_item name="hseparation" data_type="constant" type="int" default="4">
The separation between the check icon and the text (in pixels).
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
The [StyleBox] to display as a background.
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="pressed" type="StyleBox">
+ <theme_item name="pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckBox] is pressed.
</theme_item>
- <theme_item name="radio_checked" type="Texture2D">
+ <theme_item name="radio_checked" data_type="icon" type="Texture2D">
If the [CheckBox] is configured as a radio button, the icon to display when the [CheckBox] is checked.
</theme_item>
- <theme_item name="radio_checked_disabled" type="Texture2D">
+ <theme_item name="radio_checked_disabled" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="radio_unchecked" type="Texture2D">
+ <theme_item name="radio_unchecked" data_type="icon" type="Texture2D">
If the [CheckBox] is configured as a radio button, the icon to display when the [CheckBox] is unchecked.
</theme_item>
- <theme_item name="radio_unchecked_disabled" type="Texture2D">
+ <theme_item name="radio_unchecked_disabled" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="unchecked" type="Texture2D">
+ <theme_item name="unchecked" data_type="icon" type="Texture2D">
The check icon to display when the [CheckBox] is unchecked.
</theme_item>
- <theme_item name="unchecked_disabled" type="Texture2D">
+ <theme_item name="unchecked_disabled" data_type="icon" type="Texture2D">
</theme_item>
</theme_items>
</class>
diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml
index 7fa7093b32..a0a05bcb79 100644
--- a/doc/classes/CheckButton.xml
+++ b/doc/classes/CheckButton.xml
@@ -18,79 +18,79 @@
<constants>
</constants>
<theme_items>
- <theme_item name="check_vadjust" type="int" default="0">
+ <theme_item name="check_vadjust" data_type="constant" type="int" default="0">
The vertical offset used when rendering the toggle icons (in pixels).
</theme_item>
- <theme_item name="disabled" type="StyleBox">
+ <theme_item name="disabled" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is disabled.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is focused.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
The [Font] to use for the [CheckButton] text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
The [CheckButton] text's font color.
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
The [CheckButton] text's font color when it's disabled.
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
The [CheckButton] text's font color when it's hovered.
</theme_item>
- <theme_item name="font_hover_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_hover_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckButton] text's font color when it's hovered and pressed.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [CheckButton].
</theme_item>
- <theme_item name="font_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The [CheckButton] text's font color when it's pressed.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [CheckButton]'s text.
</theme_item>
- <theme_item name="hover" type="StyleBox">
+ <theme_item name="hover" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is hovered.
</theme_item>
- <theme_item name="hover_pressed" type="StyleBox">
+ <theme_item name="hover_pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is hovered and pressed.
</theme_item>
- <theme_item name="hseparation" type="int" default="4">
+ <theme_item name="hseparation" data_type="constant" type="int" default="4">
The separation between the toggle icon and the text (in pixels).
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
The [StyleBox] to display as a background.
</theme_item>
- <theme_item name="off" type="Texture2D">
+ <theme_item name="off" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked (for left-to-right layouts).
</theme_item>
- <theme_item name="off_disabled" type="Texture2D">
+ <theme_item name="off_disabled" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked and disabled (for left-to-right layouts).
</theme_item>
- <theme_item name="off_disabled_mirrored" type="Texture2D">
+ <theme_item name="off_disabled_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked and disabled (for right-to-left layouts).
</theme_item>
- <theme_item name="off_mirrored" type="Texture2D">
+ <theme_item name="off_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is unchecked (for right-to-left layouts).
</theme_item>
- <theme_item name="on" type="Texture2D">
+ <theme_item name="on" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked (for left-to-right layouts).
</theme_item>
- <theme_item name="on_disabled" type="Texture2D">
+ <theme_item name="on_disabled" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked and disabled (for left-to-right layouts).
</theme_item>
- <theme_item name="on_disabled_mirrored" type="Texture2D">
+ <theme_item name="on_disabled_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked and disabled (for right-to-left layouts).
</theme_item>
- <theme_item name="on_mirrored" type="Texture2D">
+ <theme_item name="on_mirrored" data_type="icon" type="Texture2D">
The icon to display when the [CheckButton] is checked (for right-to-left layouts).
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="pressed" type="StyleBox">
+ <theme_item name="pressed" data_type="style" type="StyleBox">
The [StyleBox] to display as a background when the [CheckButton] is pressed.
</theme_item>
</theme_items>
diff --git a/doc/classes/CodeEdit.xml b/doc/classes/CodeEdit.xml
index 0b060ec277..eb1dad14f2 100644
--- a/doc/classes/CodeEdit.xml
+++ b/doc/classes/CodeEdit.xml
@@ -560,128 +560,128 @@
</constant>
</constants>
<theme_items>
- <theme_item name="background_color" type="Color" default="Color(0, 0, 0, 0)">
+ <theme_item name="background_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
Sets the background [Color].
</theme_item>
- <theme_item name="bookmark" type="Texture2D">
+ <theme_item name="bookmark" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] to draw in the bookmark gutter for bookmarked lines.
</theme_item>
- <theme_item name="bookmark_color" type="Color" default="Color(0.5, 0.64, 1, 0.8)">
+ <theme_item name="bookmark_color" data_type="color" type="Color" default="Color(0.5, 0.64, 1, 0.8)">
[Color] of the bookmark icon for bookmarked lines.
</theme_item>
- <theme_item name="brace_mismatch_color" type="Color" default="Color(1, 0.2, 0.2, 1)">
+ <theme_item name="brace_mismatch_color" data_type="color" type="Color" default="Color(1, 0.2, 0.2, 1)">
[Color] of the text to highlight mismatched braces.
</theme_item>
- <theme_item name="breakpoint" type="Texture2D">
+ <theme_item name="breakpoint" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] to draw in the breakpoint gutter for breakpointed lines.
</theme_item>
- <theme_item name="breakpoint_color" type="Color" default="Color(0.9, 0.29, 0.3, 1)">
+ <theme_item name="breakpoint_color" data_type="color" type="Color" default="Color(0.9, 0.29, 0.3, 1)">
[Color] of the breakpoint icon for bookmarked lines.
</theme_item>
- <theme_item name="can_fold" type="Texture2D">
+ <theme_item name="can_fold" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] to draw in the line folding gutter when a line can be folded.
</theme_item>
- <theme_item name="caret_background_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="caret_background_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
[Color] of the text behind the caret when block caret is enabled.
</theme_item>
- <theme_item name="caret_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="caret_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
[Color] of the caret.
</theme_item>
- <theme_item name="code_folding_color" type="Color" default="Color(0.8, 0.8, 0.8, 0.8)">
+ <theme_item name="code_folding_color" data_type="color" type="Color" default="Color(0.8, 0.8, 0.8, 0.8)">
[Color] for all icons related to line folding.
</theme_item>
- <theme_item name="completion" type="StyleBox">
+ <theme_item name="completion" data_type="style" type="StyleBox">
[StyleBox] for the code completion popup.
</theme_item>
- <theme_item name="completion_background_color" type="Color" default="Color(0.17, 0.16, 0.2, 1)">
+ <theme_item name="completion_background_color" data_type="color" type="Color" default="Color(0.17, 0.16, 0.2, 1)">
Sets the background [Color] for the code completion popup.
</theme_item>
- <theme_item name="completion_existing_color" type="Color" default="Color(0.87, 0.87, 0.87, 0.13)">
+ <theme_item name="completion_existing_color" data_type="color" type="Color" default="Color(0.87, 0.87, 0.87, 0.13)">
Background highlight [Color] for matching text in code completion options.
</theme_item>
- <theme_item name="completion_font_color" type="Color" default="Color(0.67, 0.67, 0.67, 1)">
+ <theme_item name="completion_font_color" data_type="color" type="Color" default="Color(0.67, 0.67, 0.67, 1)">
Font [Color] for the code completion popup.
</theme_item>
- <theme_item name="completion_lines" type="int" default="7">
+ <theme_item name="completion_lines" data_type="constant" type="int" default="7">
Max number of options to display in the code completion popup at any one time.
</theme_item>
- <theme_item name="completion_max_width" type="int" default="50">
+ <theme_item name="completion_max_width" data_type="constant" type="int" default="50">
Max width of options in the code completion popup. Options longer then this will be cut off.
</theme_item>
- <theme_item name="completion_scroll_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="completion_scroll_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
[Color] of the scrollbar in the code completion popup.
</theme_item>
- <theme_item name="completion_scroll_width" type="int" default="3">
+ <theme_item name="completion_scroll_width" data_type="constant" type="int" default="3">
Width of the scrollbar in the code completion popup.
</theme_item>
- <theme_item name="completion_selected_color" type="Color" default="Color(0.26, 0.26, 0.27, 1)">
+ <theme_item name="completion_selected_color" data_type="color" type="Color" default="Color(0.26, 0.26, 0.27, 1)">
Background highlight [Color] for the current selected option item in the code completion popup.
</theme_item>
- <theme_item name="current_line_color" type="Color" default="Color(0.25, 0.25, 0.26, 0.8)">
+ <theme_item name="current_line_color" data_type="color" type="Color" default="Color(0.25, 0.25, 0.26, 0.8)">
Background [Color] of the line containing the caret.
</theme_item>
- <theme_item name="executing_line" type="Texture2D">
+ <theme_item name="executing_line" data_type="icon" type="Texture2D">
Icon to draw in the executing gutter for executing lines.
</theme_item>
- <theme_item name="executing_line_color" type="Color" default="Color(0.98, 0.89, 0.27, 1)">
+ <theme_item name="executing_line_color" data_type="color" type="Color" default="Color(0.98, 0.89, 0.27, 1)">
[Color] of the executing icon for executing lines.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
Sets the [StyleBox] when in focus.
</theme_item>
- <theme_item name="folded" type="Texture2D">
+ <theme_item name="folded" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] to draw in the line folding gutter when a line is folded and can be unfolded.
</theme_item>
- <theme_item name="folded_eol_icon" type="Texture2D">
+ <theme_item name="folded_eol_icon" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] to draw at the end of a folded line.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
Sets the default [Font].
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Sets the font [Color].
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [CodeEdit].
</theme_item>
- <theme_item name="font_readonly_color" type="Color" default="Color(0.88, 0.88, 0.88, 0.5)">
- Sets the font [Color] when [member readonly] is enabled.
+ <theme_item name="font_readonly_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 0.5)">
+ Sets the font [Color] when [member TextEdit.readonly] is enabled.
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(0, 0, 0, 1)">
- Sets the [Color] of the selected text. [member override_selected_font_color] has to be enabled.
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
+ Sets the [Color] of the selected text. [member TextEdit.override_selected_font_color] has to be enabled.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Sets default font size.
</theme_item>
- <theme_item name="line_length_guideline_color" type="Color" default="Color(0.3, 0.5, 0.8, 0.1)">
+ <theme_item name="line_length_guideline_color" data_type="color" type="Color" default="Color(0.3, 0.5, 0.8, 0.1)">
[Color] of the main line length guideline, secondary guidelines will have 50% alpha applied.
</theme_item>
- <theme_item name="line_number_color" type="Color" default="Color(0.67, 0.67, 0.67, 0.4)">
+ <theme_item name="line_number_color" data_type="color" type="Color" default="Color(0.67, 0.67, 0.67, 0.4)">
Sets the [Color] of line numbers.
</theme_item>
- <theme_item name="line_spacing" type="int" default="4">
+ <theme_item name="line_spacing" data_type="constant" type="int" default="4">
Sets the spacing between the lines.
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Sets the [StyleBox].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="read_only" type="StyleBox">
- Sets the [StyleBox] when [member readonly] is enabled.
+ <theme_item name="read_only" data_type="style" type="StyleBox">
+ Sets the [StyleBox] when [member TextEdit.readonly] is enabled.
</theme_item>
- <theme_item name="selection_color" type="Color" default="Color(0.49, 0.49, 0.49, 1)">
+ <theme_item name="selection_color" data_type="color" type="Color" default="Color(0.49, 0.49, 0.49, 1)">
Sets the highlight [Color] of text selections.
</theme_item>
- <theme_item name="space" type="Texture2D">
+ <theme_item name="space" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] for space text characters.
</theme_item>
- <theme_item name="tab" type="Texture2D">
+ <theme_item name="tab" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] for tab text characters.
</theme_item>
- <theme_item name="word_highlighted_color" type="Color" default="Color(0.8, 0.9, 0.9, 0.15)">
- Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled.
+ <theme_item name="word_highlighted_color" data_type="color" type="Color" default="Color(0.8, 0.9, 0.9, 0.15)">
+ Sets the highlight [Color] of multiple occurrences. [member TextEdit.highlight_all_occurrences] has to be enabled.
</theme_item>
</theme_items>
</class>
diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml
index 7b357034eb..99e121de75 100644
--- a/doc/classes/ColorPicker.xml
+++ b/doc/classes/ColorPicker.xml
@@ -92,39 +92,39 @@
</constant>
</constants>
<theme_items>
- <theme_item name="add_preset" type="Texture2D">
+ <theme_item name="add_preset" data_type="icon" type="Texture2D">
The icon for the "Add Preset" button.
</theme_item>
- <theme_item name="bar_arrow" type="Texture2D">
+ <theme_item name="bar_arrow" data_type="icon" type="Texture2D">
The texture for the arrow grabber.
</theme_item>
- <theme_item name="color_hue" type="Texture2D">
+ <theme_item name="color_hue" data_type="icon" type="Texture2D">
Custom texture for the hue selection slider on the right.
</theme_item>
- <theme_item name="color_sample" type="Texture2D">
+ <theme_item name="color_sample" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="h_width" type="int" default="30">
+ <theme_item name="h_width" data_type="constant" type="int" default="30">
The width of the hue selection slider.
</theme_item>
- <theme_item name="label_width" type="int" default="10">
+ <theme_item name="label_width" data_type="constant" type="int" default="10">
</theme_item>
- <theme_item name="margin" type="int" default="4">
+ <theme_item name="margin" data_type="constant" type="int" default="4">
The margin around the [ColorPicker].
</theme_item>
- <theme_item name="overbright_indicator" type="Texture2D">
+ <theme_item name="overbright_indicator" data_type="icon" type="Texture2D">
The indicator used to signalize that the color value is outside the 0-1 range.
</theme_item>
- <theme_item name="picker_cursor" type="Texture2D">
+ <theme_item name="picker_cursor" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="preset_bg" type="Texture2D">
+ <theme_item name="preset_bg" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="screen_picker" type="Texture2D">
+ <theme_item name="screen_picker" data_type="icon" type="Texture2D">
The icon for the screen color picker button.
</theme_item>
- <theme_item name="sv_height" type="int" default="256">
+ <theme_item name="sv_height" data_type="constant" type="int" default="256">
The height of the saturation-value selection box.
</theme_item>
- <theme_item name="sv_width" type="int" default="256">
+ <theme_item name="sv_width" data_type="constant" type="int" default="256">
The width of the saturation-value selection box.
</theme_item>
</theme_items>
diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml
index 770daa79c6..6b5a9f2503 100644
--- a/doc/classes/ColorPickerButton.xml
+++ b/doc/classes/ColorPickerButton.xml
@@ -55,49 +55,49 @@
<constants>
</constants>
<theme_items>
- <theme_item name="bg" type="Texture2D">
+ <theme_item name="bg" data_type="icon" type="Texture2D">
The background of the color preview rect on the button.
</theme_item>
- <theme_item name="disabled" type="StyleBox">
+ <theme_item name="disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is disabled.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] of the [ColorPickerButton]'s text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Default text [Color] of the [ColorPickerButton].
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.9, 0.9, 0.9, 0.3)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.9, 0.9, 0.9, 0.3)">
Text [Color] used when the [ColorPickerButton] is disabled.
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [ColorPickerButton] is being hovered.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [ColorPickerButton].
</theme_item>
- <theme_item name="font_pressed_color" type="Color" default="Color(0.8, 0.8, 0.8, 1)">
+ <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(0.8, 0.8, 0.8, 1)">
Text [Color] used when the [ColorPickerButton] is being pressed.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [ColorPickerButton]'s text.
</theme_item>
- <theme_item name="hover" type="StyleBox">
+ <theme_item name="hover" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is being hovered.
</theme_item>
- <theme_item name="hseparation" type="int" default="2">
+ <theme_item name="hseparation" data_type="constant" type="int" default="2">
The horizontal space between [ColorPickerButton]'s icon and text.
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Default [StyleBox] for the [ColorPickerButton].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="pressed" type="StyleBox">
+ <theme_item name="pressed" data_type="style" type="StyleBox">
[StyleBox] used when the [ColorPickerButton] is being pressed.
</theme_item>
</theme_items>
diff --git a/doc/classes/File.xml b/doc/classes/File.xml
index de3beedf0f..6622619fb3 100644
--- a/doc/classes/File.xml
+++ b/doc/classes/File.xml
@@ -119,8 +119,15 @@
<return type="PackedStringArray" />
<argument index="0" name="delim" type="String" default="&quot;,&quot;" />
<description>
- Returns the next value of the file in CSV (Comma-Separated Values) format. You can pass a different delimiter [code]delim[/code] to use other than the default [code]","[/code] (comma). This delimiter must be one-character long.
- Text is interpreted as being UTF-8 encoded.
+ Returns the next value of the file in CSV (Comma-Separated Values) format. You can pass a different delimiter [code]delim[/code] to use other than the default [code]","[/code] (comma). This delimiter must be one-character long, and cannot be a double quotation mark.
+ Text is interpreted as being UTF-8 encoded. Text values must be enclosed in double quotes if they include the delimiter character. Double quotes within a text value can be escaped by doubling their occurrence.
+ For example, the following CSV lines are valid and will be properly parsed as two strings each:
+ [codeblock]
+ Alice,"Hello, Bob!"
+ Bob,Alice! What a surprise!
+ Alice,"I thought you'd reply with ""Hello, world""."
+ [/codeblock]
+ Note how the second line can omit the enclosing quotes as it does not include the delimiter. However it [i]could[/i] very well use quotes, it was only written without for demonstration purposes. The third line must use [code]""[/code] for each quotation mark that needs to be interpreted as such instead of the end of a text value.
</description>
</method>
<method name="get_double" qualifiers="const">
diff --git a/doc/classes/FileDialog.xml b/doc/classes/FileDialog.xml
index 7e16a6bf5a..22b5c72fa9 100644
--- a/doc/classes/FileDialog.xml
+++ b/doc/classes/FileDialog.xml
@@ -123,34 +123,34 @@
</constant>
</constants>
<theme_items>
- <theme_item name="back_folder" type="Texture2D">
+ <theme_item name="back_folder" data_type="icon" type="Texture2D">
Custom icon for the back arrow.
</theme_item>
- <theme_item name="file" type="Texture2D">
+ <theme_item name="file" data_type="icon" type="Texture2D">
Custom icon for files.
</theme_item>
- <theme_item name="file_icon_modulate" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="file_icon_modulate" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The color modulation applied to the file icon.
</theme_item>
- <theme_item name="files_disabled" type="Color" default="Color(0, 0, 0, 0.7)">
+ <theme_item name="files_disabled" data_type="color" type="Color" default="Color(0, 0, 0, 0.7)">
The color tint for disabled files (when the [FileDialog] is used in open folder mode).
</theme_item>
- <theme_item name="folder" type="Texture2D">
+ <theme_item name="folder" data_type="icon" type="Texture2D">
Custom icon for folders.
</theme_item>
- <theme_item name="folder_icon_modulate" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="folder_icon_modulate" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The color modulation applied to the folder icon.
</theme_item>
- <theme_item name="forward_folder" type="Texture2D">
+ <theme_item name="forward_folder" data_type="icon" type="Texture2D">
Custom icon for the forward arrow.
</theme_item>
- <theme_item name="parent_folder" type="Texture2D">
+ <theme_item name="parent_folder" data_type="icon" type="Texture2D">
Custom icon for the parent folder arrow.
</theme_item>
- <theme_item name="reload" type="Texture2D">
+ <theme_item name="reload" data_type="icon" type="Texture2D">
Custom icon for the reload button.
</theme_item>
- <theme_item name="toggle_hidden" type="Texture2D">
+ <theme_item name="toggle_hidden" data_type="icon" type="Texture2D">
Custom icon for the toggle hidden button.
</theme_item>
</theme_items>
diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml
index 44c571e800..2e5d2e6497 100644
--- a/doc/classes/GraphEdit.xml
+++ b/doc/classes/GraphEdit.xml
@@ -268,45 +268,45 @@
<constants>
</constants>
<theme_items>
- <theme_item name="activity" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="activity" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
</theme_item>
- <theme_item name="bezier_len_neg" type="int" default="160">
+ <theme_item name="bezier_len_neg" data_type="constant" type="int" default="160">
</theme_item>
- <theme_item name="bezier_len_pos" type="int" default="80">
+ <theme_item name="bezier_len_pos" data_type="constant" type="int" default="80">
</theme_item>
- <theme_item name="bg" type="StyleBox">
+ <theme_item name="bg" data_type="style" type="StyleBox">
The background drawn under the grid.
</theme_item>
- <theme_item name="grid_major" type="Color" default="Color(1, 1, 1, 0.2)">
+ <theme_item name="grid_major" data_type="color" type="Color" default="Color(1, 1, 1, 0.2)">
Color of major grid lines.
</theme_item>
- <theme_item name="grid_minor" type="Color" default="Color(1, 1, 1, 0.05)">
+ <theme_item name="grid_minor" data_type="color" type="Color" default="Color(1, 1, 1, 0.05)">
Color of minor grid lines.
</theme_item>
- <theme_item name="minimap" type="Texture2D">
+ <theme_item name="minimap" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="minus" type="Texture2D">
+ <theme_item name="minus" data_type="icon" type="Texture2D">
The icon for the zoom out button.
</theme_item>
- <theme_item name="more" type="Texture2D">
+ <theme_item name="more" data_type="icon" type="Texture2D">
The icon for the zoom in button.
</theme_item>
- <theme_item name="port_grab_distance_horizontal" type="int" default="48">
+ <theme_item name="port_grab_distance_horizontal" data_type="constant" type="int" default="48">
The horizontal range within which a port can be grabbed (on both sides).
</theme_item>
- <theme_item name="port_grab_distance_vertical" type="int" default="6">
+ <theme_item name="port_grab_distance_vertical" data_type="constant" type="int" default="6">
The vertical range within which a port can be grabbed (on both sides).
</theme_item>
- <theme_item name="reset" type="Texture2D">
+ <theme_item name="reset" data_type="icon" type="Texture2D">
The icon for the zoom reset button.
</theme_item>
- <theme_item name="selection_fill" type="Color" default="Color(1, 1, 1, 0.3)">
+ <theme_item name="selection_fill" data_type="color" type="Color" default="Color(1, 1, 1, 0.3)">
The fill color of the selection rectangle.
</theme_item>
- <theme_item name="selection_stroke" type="Color" default="Color(1, 1, 1, 0.8)">
+ <theme_item name="selection_stroke" data_type="color" type="Color" default="Color(1, 1, 1, 0.8)">
The outline color of the selection rectangle.
</theme_item>
- <theme_item name="snap" type="Texture2D">
+ <theme_item name="snap" data_type="icon" type="Texture2D">
The icon for the snap toggle button.
</theme_item>
</theme_items>
diff --git a/doc/classes/GraphNode.xml b/doc/classes/GraphNode.xml
index e1374b4f7a..ff6271d2aa 100644
--- a/doc/classes/GraphNode.xml
+++ b/doc/classes/GraphNode.xml
@@ -292,59 +292,59 @@
</constant>
</constants>
<theme_items>
- <theme_item name="breakpoint" type="StyleBox">
+ <theme_item name="breakpoint" data_type="style" type="StyleBox">
The background used when [member overlay] is set to [constant OVERLAY_BREAKPOINT].
</theme_item>
- <theme_item name="close" type="Texture2D">
+ <theme_item name="close" data_type="icon" type="Texture2D">
The icon for the close button, visible when [member show_close] is enabled.
</theme_item>
- <theme_item name="close_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="close_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
The color modulation applied to the close button icon.
</theme_item>
- <theme_item name="close_offset" type="int" default="18">
+ <theme_item name="close_offset" data_type="constant" type="int" default="18">
The vertical offset of the close button.
</theme_item>
- <theme_item name="comment" type="StyleBox">
+ <theme_item name="comment" data_type="style" type="StyleBox">
The [StyleBox] used when [member comment] is enabled.
</theme_item>
- <theme_item name="commentfocus" type="StyleBox">
+ <theme_item name="commentfocus" data_type="style" type="StyleBox">
The [StyleBox] used when [member comment] is enabled and the [GraphNode] is focused.
</theme_item>
- <theme_item name="defaultfocus" type="StyleBox">
+ <theme_item name="defaultfocus" data_type="style" type="StyleBox">
</theme_item>
- <theme_item name="defaultframe" type="StyleBox">
+ <theme_item name="defaultframe" data_type="style" type="StyleBox">
</theme_item>
- <theme_item name="frame" type="StyleBox">
+ <theme_item name="frame" data_type="style" type="StyleBox">
The default background for [GraphNode].
</theme_item>
- <theme_item name="port" type="Texture2D">
+ <theme_item name="port" data_type="icon" type="Texture2D">
The icon used for representing ports.
</theme_item>
- <theme_item name="port_offset" type="int" default="3">
+ <theme_item name="port_offset" data_type="constant" type="int" default="3">
Horizontal offset for the ports.
</theme_item>
- <theme_item name="position" type="StyleBox">
+ <theme_item name="position" data_type="style" type="StyleBox">
The background used when [member overlay] is set to [constant OVERLAY_POSITION].
</theme_item>
- <theme_item name="resizer" type="Texture2D">
+ <theme_item name="resizer" data_type="icon" type="Texture2D">
The icon used for resizer, visible when [member resizable] is enabled.
</theme_item>
- <theme_item name="resizer_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="resizer_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
The color modulation applied to the resizer icon.
</theme_item>
- <theme_item name="selectedframe" type="StyleBox">
+ <theme_item name="selectedframe" data_type="style" type="StyleBox">
The background used when the [GraphNode] is selected.
</theme_item>
- <theme_item name="separation" type="int" default="1">
+ <theme_item name="separation" data_type="constant" type="int" default="1">
The vertical distance between ports.
</theme_item>
- <theme_item name="title_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="title_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
Color of the title text.
</theme_item>
- <theme_item name="title_font" type="Font">
+ <theme_item name="title_font" data_type="font" type="Font">
Font used for the title text.
</theme_item>
- <theme_item name="title_offset" type="int" default="20">
+ <theme_item name="title_offset" data_type="constant" type="int" default="20">
Vertical offset of the title text.
</theme_item>
</theme_items>
diff --git a/doc/classes/GridContainer.xml b/doc/classes/GridContainer.xml
index ca6b4e69c3..34e7cbcd79 100644
--- a/doc/classes/GridContainer.xml
+++ b/doc/classes/GridContainer.xml
@@ -21,10 +21,10 @@
<constants>
</constants>
<theme_items>
- <theme_item name="hseparation" type="int" default="4">
+ <theme_item name="hseparation" data_type="constant" type="int" default="4">
The horizontal separation of children nodes.
</theme_item>
- <theme_item name="vseparation" type="int" default="4">
+ <theme_item name="vseparation" data_type="constant" type="int" default="4">
The vertical separation of children nodes.
</theme_item>
</theme_items>
diff --git a/doc/classes/HBoxContainer.xml b/doc/classes/HBoxContainer.xml
index 7c76b8b001..9c3efb384e 100644
--- a/doc/classes/HBoxContainer.xml
+++ b/doc/classes/HBoxContainer.xml
@@ -13,7 +13,7 @@
<constants>
</constants>
<theme_items>
- <theme_item name="separation" type="int" default="4">
+ <theme_item name="separation" data_type="constant" type="int" default="4">
The horizontal space between the [HBoxContainer]'s elements.
</theme_item>
</theme_items>
diff --git a/doc/classes/HScrollBar.xml b/doc/classes/HScrollBar.xml
index 963454dab8..3bdd739cdf 100644
--- a/doc/classes/HScrollBar.xml
+++ b/doc/classes/HScrollBar.xml
@@ -13,31 +13,31 @@
<constants>
</constants>
<theme_items>
- <theme_item name="decrement" type="Texture2D">
+ <theme_item name="decrement" data_type="icon" type="Texture2D">
Icon used as a button to scroll the [ScrollBar] left. Supports custom step using the [member ScrollBar.custom_step] property.
</theme_item>
- <theme_item name="decrement_highlight" type="Texture2D">
+ <theme_item name="decrement_highlight" data_type="icon" type="Texture2D">
Displayed when the mouse cursor hovers over the decrement button.
</theme_item>
- <theme_item name="grabber" type="StyleBox">
+ <theme_item name="grabber" data_type="style" type="StyleBox">
Used as texture for the grabber, the draggable element representing current scroll.
</theme_item>
- <theme_item name="grabber_highlight" type="StyleBox">
+ <theme_item name="grabber_highlight" data_type="style" type="StyleBox">
Used when the mouse hovers over the grabber.
</theme_item>
- <theme_item name="grabber_pressed" type="StyleBox">
+ <theme_item name="grabber_pressed" data_type="style" type="StyleBox">
Used when the grabber is being dragged.
</theme_item>
- <theme_item name="increment" type="Texture2D">
+ <theme_item name="increment" data_type="icon" type="Texture2D">
Icon used as a button to scroll the [ScrollBar] right. Supports custom step using the [member ScrollBar.custom_step] property.
</theme_item>
- <theme_item name="increment_highlight" type="Texture2D">
+ <theme_item name="increment_highlight" data_type="icon" type="Texture2D">
Displayed when the mouse cursor hovers over the increment button.
</theme_item>
- <theme_item name="scroll" type="StyleBox">
+ <theme_item name="scroll" data_type="style" type="StyleBox">
Used as background of this [ScrollBar].
</theme_item>
- <theme_item name="scroll_focus" type="StyleBox">
+ <theme_item name="scroll_focus" data_type="style" type="StyleBox">
Used as background when the [ScrollBar] has the GUI focus.
</theme_item>
</theme_items>
diff --git a/doc/classes/HSeparator.xml b/doc/classes/HSeparator.xml
index 5b418d6428..24495d208e 100644
--- a/doc/classes/HSeparator.xml
+++ b/doc/classes/HSeparator.xml
@@ -13,10 +13,10 @@
<constants>
</constants>
<theme_items>
- <theme_item name="separation" type="int" default="4">
+ <theme_item name="separation" data_type="constant" type="int" default="4">
The height of the area covered by the separator. Effectively works like a minimum height.
</theme_item>
- <theme_item name="separator" type="StyleBox">
+ <theme_item name="separator" data_type="style" type="StyleBox">
The style for the separator line. Works best with [StyleBoxLine].
</theme_item>
</theme_items>
diff --git a/doc/classes/HSlider.xml b/doc/classes/HSlider.xml
index 0cbb4fd455..37aa968161 100644
--- a/doc/classes/HSlider.xml
+++ b/doc/classes/HSlider.xml
@@ -14,24 +14,24 @@
<constants>
</constants>
<theme_items>
- <theme_item name="grabber" type="Texture2D">
+ <theme_item name="grabber" data_type="icon" type="Texture2D">
The texture for the grabber (the draggable element).
</theme_item>
- <theme_item name="grabber_area" type="StyleBox">
+ <theme_item name="grabber_area" data_type="style" type="StyleBox">
The background of the area to the left of the grabber.
</theme_item>
- <theme_item name="grabber_area_highlight" type="StyleBox">
+ <theme_item name="grabber_area_highlight" data_type="style" type="StyleBox">
</theme_item>
- <theme_item name="grabber_disabled" type="Texture2D">
+ <theme_item name="grabber_disabled" data_type="icon" type="Texture2D">
The texture for the grabber when it's disabled.
</theme_item>
- <theme_item name="grabber_highlight" type="Texture2D">
+ <theme_item name="grabber_highlight" data_type="icon" type="Texture2D">
The texture for the grabber when it's focused.
</theme_item>
- <theme_item name="slider" type="StyleBox">
+ <theme_item name="slider" data_type="style" type="StyleBox">
The background for the whole slider. Determines the height of the [code]grabber_area[/code].
</theme_item>
- <theme_item name="tick" type="Texture2D">
+ <theme_item name="tick" data_type="icon" type="Texture2D">
The texture for the ticks, visible when [member Slider.tick_count] is greater than 0.
</theme_item>
</theme_items>
diff --git a/doc/classes/HSplitContainer.xml b/doc/classes/HSplitContainer.xml
index f6e9f33c20..6bc9913344 100644
--- a/doc/classes/HSplitContainer.xml
+++ b/doc/classes/HSplitContainer.xml
@@ -13,15 +13,15 @@
<constants>
</constants>
<theme_items>
- <theme_item name="autohide" type="int" default="1">
+ <theme_item name="autohide" data_type="constant" type="int" default="1">
Boolean value. If 1 ([code]true[/code]), the grabber will hide automatically when it isn't under the cursor. If 0 ([code]false[/code]), it's always visible.
</theme_item>
- <theme_item name="bg" type="StyleBox">
+ <theme_item name="bg" data_type="style" type="StyleBox">
</theme_item>
- <theme_item name="grabber" type="Texture2D">
+ <theme_item name="grabber" data_type="icon" type="Texture2D">
The icon used for the grabber drawn in the middle area.
</theme_item>
- <theme_item name="separation" type="int" default="12">
+ <theme_item name="separation" data_type="constant" type="int" default="12">
The space between sides of the container.
</theme_item>
</theme_items>
diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml
index c60864886e..06e98f7e57 100644
--- a/doc/classes/ItemList.xml
+++ b/doc/classes/ItemList.xml
@@ -462,55 +462,55 @@
</constant>
</constants>
<theme_items>
- <theme_item name="bg" type="StyleBox">
+ <theme_item name="bg" data_type="style" type="StyleBox">
Default [StyleBox] for the [ItemList], i.e. used when the control is not being focused.
</theme_item>
- <theme_item name="bg_focus" type="StyleBox">
+ <theme_item name="bg_focus" data_type="style" type="StyleBox">
[StyleBox] used when the [ItemList] is being focused.
</theme_item>
- <theme_item name="cursor" type="StyleBox">
+ <theme_item name="cursor" data_type="style" type="StyleBox">
[StyleBox] used for the cursor, when the [ItemList] is being focused.
</theme_item>
- <theme_item name="cursor_unfocused" type="StyleBox">
+ <theme_item name="cursor_unfocused" data_type="style" type="StyleBox">
[StyleBox] used for the cursor, when the [ItemList] is not being focused.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] of the item's text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.63, 0.63, 0.63, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.63, 0.63, 0.63, 1)">
Default text [Color] of the item.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the item.
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the item is selected.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the item's text.
</theme_item>
- <theme_item name="guide_color" type="Color" default="Color(0, 0, 0, 0.1)">
+ <theme_item name="guide_color" data_type="color" type="Color" default="Color(0, 0, 0, 0.1)">
[Color] of the guideline. The guideline is a line drawn between each row of items.
</theme_item>
- <theme_item name="hseparation" type="int" default="4">
+ <theme_item name="hseparation" data_type="constant" type="int" default="4">
The horizontal spacing between items.
</theme_item>
- <theme_item name="icon_margin" type="int" default="4">
+ <theme_item name="icon_margin" data_type="constant" type="int" default="4">
The spacing between item's icon and text.
</theme_item>
- <theme_item name="line_separation" type="int" default="2">
+ <theme_item name="line_separation" data_type="constant" type="int" default="2">
The vertical spacing between each line of text.
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the item text outline.
</theme_item>
- <theme_item name="selected" type="StyleBox">
+ <theme_item name="selected" data_type="style" type="StyleBox">
[StyleBox] for the selected items, used when the [ItemList] is not being focused.
</theme_item>
- <theme_item name="selected_focus" type="StyleBox">
+ <theme_item name="selected_focus" data_type="style" type="StyleBox">
[StyleBox] for the selected items, used when the [ItemList] is being focused.
</theme_item>
- <theme_item name="vseparation" type="int" default="2">
+ <theme_item name="vseparation" data_type="constant" type="int" default="2">
The vertical spacing between items.
</theme_item>
</theme_items>
diff --git a/doc/classes/Label.xml b/doc/classes/Label.xml
index 42ee246730..3c349e052f 100644
--- a/doc/classes/Label.xml
+++ b/doc/classes/Label.xml
@@ -163,37 +163,37 @@
</constant>
</constants>
<theme_items>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] used for the [Label]'s text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Default text [Color] of the [Label].
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of [Font]'s outline.
</theme_item>
- <theme_item name="font_shadow_color" type="Color" default="Color(0, 0, 0, 0)">
+ <theme_item name="font_shadow_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
[Color] of the text's shadow effect.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [Label]'s text.
</theme_item>
- <theme_item name="line_spacing" type="int" default="3">
+ <theme_item name="line_spacing" data_type="constant" type="int" default="3">
Vertical space between lines in multiline [Label].
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Background [StyleBox] for the [Label].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
Text outline size.
</theme_item>
- <theme_item name="shadow_offset_x" type="int" default="1">
+ <theme_item name="shadow_offset_x" data_type="constant" type="int" default="1">
The horizontal offset of the text's shadow.
</theme_item>
- <theme_item name="shadow_offset_y" type="int" default="1">
+ <theme_item name="shadow_offset_y" data_type="constant" type="int" default="1">
The vertical offset of the text's shadow.
</theme_item>
- <theme_item name="shadow_outline_size" type="int" default="1">
+ <theme_item name="shadow_outline_size" data_type="constant" type="int" default="1">
Shadow outline size. If set to 1 or greater, the shadow will be displayed around the whole text as an outline.
</theme_item>
</theme_items>
diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml
index 45bb553c9c..834b5a41db 100644
--- a/doc/classes/LineEdit.xml
+++ b/doc/classes/LineEdit.xml
@@ -365,52 +365,52 @@
</constant>
</constants>
<theme_items>
- <theme_item name="caret_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="caret_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Color of the [LineEdit]'s caret (text cursor).
</theme_item>
- <theme_item name="clear" type="Texture2D">
+ <theme_item name="clear" data_type="icon" type="Texture2D">
Texture for the clear button. See [member clear_button_enabled].
</theme_item>
- <theme_item name="clear_button_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="clear_button_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Color used as default tint for the clear button.
</theme_item>
- <theme_item name="clear_button_color_pressed" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="clear_button_color_pressed" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Color used for the clear button when it's pressed.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
Background used when [LineEdit] has GUI focus.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
Font used for the text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Default font color.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [LineEdit].
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
Font color for selected text (inside the selection rectangle).
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [LineEdit]'s text.
</theme_item>
- <theme_item name="font_uneditable_color" type="Color" default="Color(0.88, 0.88, 0.88, 0.5)">
+ <theme_item name="font_uneditable_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 0.5)">
Font color when editing is disabled.
</theme_item>
- <theme_item name="minimum_character_width" type="int" default="4">
+ <theme_item name="minimum_character_width" data_type="constant" type="int" default="4">
Minimum horizontal space for the text (not counting the clear button and content margins). This value is measured in count of 'M' characters (i.e. this amount of 'M' characters can be displayed without scrolling).
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Default background for the [LineEdit].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="read_only" type="StyleBox">
+ <theme_item name="read_only" data_type="style" type="StyleBox">
Background used when [LineEdit] is in read-only mode ([member editable] is set to [code]false[/code]).
</theme_item>
- <theme_item name="selection_color" type="Color" default="Color(0.49, 0.49, 0.49, 1)">
+ <theme_item name="selection_color" data_type="color" type="Color" default="Color(0.49, 0.49, 0.49, 1)">
Color of the selection rectangle.
</theme_item>
</theme_items>
diff --git a/doc/classes/LinkButton.xml b/doc/classes/LinkButton.xml
index dbf13fd842..e4445e9076 100644
--- a/doc/classes/LinkButton.xml
+++ b/doc/classes/LinkButton.xml
@@ -66,31 +66,31 @@
</constant>
</constants>
<theme_items>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
[StyleBox] used when the [LinkButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] of the [LinkButton]'s text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Default text [Color] of the [LinkButton].
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Text [Color] used when the [LinkButton] is being hovered.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [LinkButton].
</theme_item>
- <theme_item name="font_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [LinkButton] is being pressed.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [LinkButton]'s text.
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="underline_spacing" type="int" default="2">
+ <theme_item name="underline_spacing" data_type="constant" type="int" default="2">
The vertical space between the baseline of text and the underline.
</theme_item>
</theme_items>
diff --git a/doc/classes/MarginContainer.xml b/doc/classes/MarginContainer.xml
index a51632d5f1..419857c13f 100644
--- a/doc/classes/MarginContainer.xml
+++ b/doc/classes/MarginContainer.xml
@@ -32,16 +32,16 @@
<constants>
</constants>
<theme_items>
- <theme_item name="margin_bottom" type="int" default="0">
+ <theme_item name="margin_bottom" data_type="constant" type="int" default="0">
All direct children of [MarginContainer] will have a bottom margin of [code]margin_bottom[/code] pixels.
</theme_item>
- <theme_item name="margin_left" type="int" default="0">
+ <theme_item name="margin_left" data_type="constant" type="int" default="0">
All direct children of [MarginContainer] will have a left margin of [code]margin_left[/code] pixels.
</theme_item>
- <theme_item name="margin_right" type="int" default="0">
+ <theme_item name="margin_right" data_type="constant" type="int" default="0">
All direct children of [MarginContainer] will have a right margin of [code]margin_right[/code] pixels.
</theme_item>
- <theme_item name="margin_top" type="int" default="0">
+ <theme_item name="margin_top" data_type="constant" type="int" default="0">
All direct children of [MarginContainer] will have a top margin of [code]margin_top[/code] pixels.
</theme_item>
</theme_items>
diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml
index 2d4df97895..1c7e6f1f19 100644
--- a/doc/classes/MenuButton.xml
+++ b/doc/classes/MenuButton.xml
@@ -44,46 +44,46 @@
<constants>
</constants>
<theme_items>
- <theme_item name="disabled" type="StyleBox">
+ <theme_item name="disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [MenuButton] is disabled.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
[StyleBox] used when the [MenuButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] of the [MenuButton]'s text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Default text [Color] of the [MenuButton].
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(1, 1, 1, 0.3)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(1, 1, 1, 0.3)">
Text [Color] used when the [MenuButton] is disabled.
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Text [Color] used when the [MenuButton] is being hovered.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [MenuButton].
</theme_item>
- <theme_item name="font_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [MenuButton] is being pressed.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [MenuButton]'s text.
</theme_item>
- <theme_item name="hover" type="StyleBox">
+ <theme_item name="hover" data_type="style" type="StyleBox">
[StyleBox] used when the [MenuButton] is being hovered.
</theme_item>
- <theme_item name="hseparation" type="int" default="3">
+ <theme_item name="hseparation" data_type="constant" type="int" default="3">
The horizontal space between [MenuButton]'s icon and text.
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Default [StyleBox] for the [MenuButton].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="pressed" type="StyleBox">
+ <theme_item name="pressed" data_type="style" type="StyleBox">
[StyleBox] used when the [MenuButton] is being pressed.
</theme_item>
</theme_items>
diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml
index 104f649921..552e0fce4c 100644
--- a/doc/classes/MultiplayerAPI.xml
+++ b/doc/classes/MultiplayerAPI.xml
@@ -61,6 +61,7 @@
<argument index="0" name="bytes" type="PackedByteArray" />
<argument index="1" name="id" type="int" default="0" />
<argument index="2" name="mode" type="int" enum="MultiplayerPeer.TransferMode" default="2" />
+ <argument index="3" name="channel" type="int" default="0" />
<description>
Sends the given raw [code]bytes[/code] to a specific peer identified by [code]id[/code] (see [method MultiplayerPeer.set_target_peer]). Default ID is [code]0[/code], i.e. broadcast to all peers.
</description>
diff --git a/doc/classes/MultiplayerPeer.xml b/doc/classes/MultiplayerPeer.xml
index 88cd058c51..adaa359168 100644
--- a/doc/classes/MultiplayerPeer.xml
+++ b/doc/classes/MultiplayerPeer.xml
@@ -55,6 +55,10 @@
<member name="refuse_new_connections" type="bool" setter="set_refuse_new_connections" getter="is_refusing_new_connections" default="true">
If [code]true[/code], this [MultiplayerPeer] refuses new connections.
</member>
+ <member name="transfer_channel" type="int" setter="set_transfer_channel" getter="get_transfer_channel" default="0">
+ The channel to use to send packets. Many network APIs such as ENet and WebRTC allow the creation of multiple independent channels which behaves, in a way, like separate connections. This means that reliable data will only block delivery of other packets on that channel, and ordering will only be in respect to the channel the packet is being sent on. Using different channels to send [b]different and independent[/b] state updates is a common way to optimize network usage and decrease latency in fast-paced games.
+ [b]Note:[/b] The default channel ([code]0[/code]) actually works as 3 separate channels (one for each [enum TransferMode]) so that [constant TRANSFER_MODE_RELIABLE] and [constant TRANSFER_MODE_UNRELIABLE_ORDERED] does not interact with each other by default. Refer to the specific network API documentation (e.g. ENet or WebRTC) to learn how to set up channels correctly.
+ </member>
<member name="transfer_mode" type="int" setter="set_transfer_mode" getter="get_transfer_mode" enum="MultiplayerPeer.TransferMode" default="0">
The manner in which to send packets to the [code]target_peer[/code]. See [enum TransferMode].
</member>
diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml
index ae268203ad..8aa0ad073d 100644
--- a/doc/classes/OptionButton.xml
+++ b/doc/classes/OptionButton.xml
@@ -186,64 +186,64 @@
<constants>
</constants>
<theme_items>
- <theme_item name="arrow" type="Texture2D">
+ <theme_item name="arrow" data_type="icon" type="Texture2D">
The arrow icon to be drawn on the right end of the button.
</theme_item>
- <theme_item name="arrow_margin" type="int" default="2">
+ <theme_item name="arrow_margin" data_type="constant" type="int" default="2">
The horizontal space between the arrow icon and the right edge of the button.
</theme_item>
- <theme_item name="disabled" type="StyleBox">
+ <theme_item name="disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [OptionButton] is disabled (for left-to-right layouts).
</theme_item>
- <theme_item name="disabled_mirrored" type="StyleBox">
+ <theme_item name="disabled_mirrored" data_type="style" type="StyleBox">
[StyleBox] used when the [OptionButton] is disabled (for right-to-left layouts).
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
[StyleBox] used when the [OptionButton] is focused. It is displayed over the current [StyleBox], so using [StyleBoxEmpty] will just disable the focus visual effect.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] of the [OptionButton]'s text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Default text [Color] of the [OptionButton].
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
Text [Color] used when the [OptionButton] is disabled.
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Text [Color] used when the [OptionButton] is being hovered.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [OptionButton].
</theme_item>
- <theme_item name="font_pressed_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_pressed_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the [OptionButton] is being pressed.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the [OptionButton]'s text.
</theme_item>
- <theme_item name="hover" type="StyleBox">
+ <theme_item name="hover" data_type="style" type="StyleBox">
[StyleBox] used when the [OptionButton] is being hovered (for left-to-right layouts).
</theme_item>
- <theme_item name="hover_mirrored" type="StyleBox">
+ <theme_item name="hover_mirrored" data_type="style" type="StyleBox">
[StyleBox] used when the [OptionButton] is being hovered (for right-to-left layouts).
</theme_item>
- <theme_item name="hseparation" type="int" default="2">
+ <theme_item name="hseparation" data_type="constant" type="int" default="2">
The horizontal space between [OptionButton]'s icon and text.
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Default [StyleBox] for the [OptionButton] (for left-to-right layouts).
</theme_item>
- <theme_item name="normal_mirrored" type="StyleBox">
+ <theme_item name="normal_mirrored" data_type="style" type="StyleBox">
Default [StyleBox] for the [OptionButton] (for right-to-left layouts).
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="pressed" type="StyleBox">
+ <theme_item name="pressed" data_type="style" type="StyleBox">
[StyleBox] used when the [OptionButton] is being pressed (for left-to-right layouts).
</theme_item>
- <theme_item name="pressed_mirrored" type="StyleBox">
+ <theme_item name="pressed_mirrored" data_type="style" type="StyleBox">
[StyleBox] used when the [OptionButton] is being pressed (for right-to-left layouts).
</theme_item>
</theme_items>
diff --git a/doc/classes/Panel.xml b/doc/classes/Panel.xml
index b65c2c956d..9906abf895 100644
--- a/doc/classes/Panel.xml
+++ b/doc/classes/Panel.xml
@@ -24,10 +24,10 @@
</constant>
</constants>
<theme_items>
- <theme_item name="panel" type="StyleBox">
+ <theme_item name="panel" data_type="style" type="StyleBox">
The style of this [Panel].
</theme_item>
- <theme_item name="panel_fg" type="StyleBox">
+ <theme_item name="panel_fg" data_type="style" type="StyleBox">
</theme_item>
</theme_items>
</class>
diff --git a/doc/classes/PanelContainer.xml b/doc/classes/PanelContainer.xml
index ad6080c780..f3f2f6839a 100644
--- a/doc/classes/PanelContainer.xml
+++ b/doc/classes/PanelContainer.xml
@@ -17,7 +17,7 @@
<constants>
</constants>
<theme_items>
- <theme_item name="panel" type="StyleBox">
+ <theme_item name="panel" data_type="style" type="StyleBox">
The style of [PanelContainer]'s background.
</theme_item>
</theme_items>
diff --git a/doc/classes/PopupMenu.xml b/doc/classes/PopupMenu.xml
index a2c8a581cf..61b5aa89a6 100644
--- a/doc/classes/PopupMenu.xml
+++ b/doc/classes/PopupMenu.xml
@@ -538,77 +538,77 @@
<constants>
</constants>
<theme_items>
- <theme_item name="checked" type="Texture2D">
+ <theme_item name="checked" data_type="icon" type="Texture2D">
[Texture2D] icon for the checked checkbox items.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] used for the menu items.
</theme_item>
- <theme_item name="font_accelerator_color" type="Color" default="Color(0.7, 0.7, 0.7, 0.8)">
+ <theme_item name="font_accelerator_color" data_type="color" type="Color" default="Color(0.7, 0.7, 0.7, 0.8)">
The text [Color] used for shortcuts and accelerators that show next to the menu item name when defined. See [method get_item_accelerator] for more info on accelerators.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
The default text [Color] for menu items' names.
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.4, 0.4, 0.4, 0.8)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.4, 0.4, 0.4, 0.8)">
[Color] used for disabled menu items' text.
</theme_item>
- <theme_item name="font_hover_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_hover_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
[Color] used for the hovered text.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the menu item.
</theme_item>
- <theme_item name="font_separator_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_separator_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
[Color] used for labeled separators' text. See [method add_separator].
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the menu items.
</theme_item>
- <theme_item name="hover" type="StyleBox">
+ <theme_item name="hover" data_type="style" type="StyleBox">
[StyleBox] displayed when the [PopupMenu] item is hovered.
</theme_item>
- <theme_item name="hseparation" type="int" default="4">
+ <theme_item name="hseparation" data_type="constant" type="int" default="4">
The horizontal space between the item's name and the shortcut text/submenu arrow.
</theme_item>
- <theme_item name="item_end_padding" type="int" default="2">
+ <theme_item name="item_end_padding" data_type="constant" type="int" default="2">
</theme_item>
- <theme_item name="item_start_padding" type="int" default="2">
+ <theme_item name="item_start_padding" data_type="constant" type="int" default="2">
</theme_item>
- <theme_item name="labeled_separator_left" type="StyleBox">
+ <theme_item name="labeled_separator_left" data_type="style" type="StyleBox">
[StyleBox] for the left side of labeled separator. See [method add_separator].
</theme_item>
- <theme_item name="labeled_separator_right" type="StyleBox">
+ <theme_item name="labeled_separator_right" data_type="style" type="StyleBox">
[StyleBox] for the right side of labeled separator. See [method add_separator].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the item text outline.
</theme_item>
- <theme_item name="panel" type="StyleBox">
+ <theme_item name="panel" data_type="style" type="StyleBox">
Default [StyleBox] of the [PopupMenu] items.
</theme_item>
- <theme_item name="panel_disabled" type="StyleBox">
+ <theme_item name="panel_disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [PopupMenu] item is disabled.
</theme_item>
- <theme_item name="radio_checked" type="Texture2D">
+ <theme_item name="radio_checked" data_type="icon" type="Texture2D">
[Texture2D] icon for the checked radio button items.
</theme_item>
- <theme_item name="radio_unchecked" type="Texture2D">
+ <theme_item name="radio_unchecked" data_type="icon" type="Texture2D">
[Texture2D] icon for the unchecked radio button items.
</theme_item>
- <theme_item name="separator" type="StyleBox">
+ <theme_item name="separator" data_type="style" type="StyleBox">
[StyleBox] used for the separators. See [method add_separator].
</theme_item>
- <theme_item name="submenu" type="Texture2D">
+ <theme_item name="submenu" data_type="icon" type="Texture2D">
[Texture2D] icon for the submenu arrow (for left-to-right layouts).
</theme_item>
- <theme_item name="submenu_mirrored" type="Texture2D">
+ <theme_item name="submenu_mirrored" data_type="icon" type="Texture2D">
[Texture2D] icon for the submenu arrow (for right-to-left layouts).
</theme_item>
- <theme_item name="unchecked" type="Texture2D">
+ <theme_item name="unchecked" data_type="icon" type="Texture2D">
[Texture2D] icon for the unchecked checkbox items.
</theme_item>
- <theme_item name="vseparation" type="int" default="4">
+ <theme_item name="vseparation" data_type="constant" type="int" default="4">
The vertical space between each menu item.
</theme_item>
</theme_items>
diff --git a/doc/classes/PopupPanel.xml b/doc/classes/PopupPanel.xml
index 72045c5559..56833f3f79 100644
--- a/doc/classes/PopupPanel.xml
+++ b/doc/classes/PopupPanel.xml
@@ -13,7 +13,7 @@
<constants>
</constants>
<theme_items>
- <theme_item name="panel" type="StyleBox">
+ <theme_item name="panel" data_type="style" type="StyleBox">
The background panel style of this [PopupPanel].
</theme_item>
</theme_items>
diff --git a/doc/classes/ProgressBar.xml b/doc/classes/ProgressBar.xml
index c33f6f636d..8bd013c86c 100644
--- a/doc/classes/ProgressBar.xml
+++ b/doc/classes/ProgressBar.xml
@@ -20,28 +20,28 @@
<constants>
</constants>
<theme_items>
- <theme_item name="bg" type="StyleBox">
+ <theme_item name="bg" data_type="style" type="StyleBox">
The style of the background.
</theme_item>
- <theme_item name="fg" type="StyleBox">
+ <theme_item name="fg" data_type="style" type="StyleBox">
The style of the progress (i.e. the part that fills the bar).
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
Font used to draw the fill percentage if [member percent_visible] is [code]true[/code].
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
The color of the text.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [ProgressBar].
</theme_item>
- <theme_item name="font_shadow_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="font_shadow_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
The color of the text's shadow.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size used to draw the fill percentage if [member percent_visible] is [code]true[/code].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
</theme_items>
diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml
index e1362917b0..538e93d505 100644
--- a/doc/classes/RichTextLabel.xml
+++ b/doc/classes/RichTextLabel.xml
@@ -522,85 +522,85 @@
</constant>
</constants>
<theme_items>
- <theme_item name="bold_font" type="Font">
+ <theme_item name="bold_font" data_type="font" type="Font">
The font used for bold text.
</theme_item>
- <theme_item name="bold_font_size" type="int">
+ <theme_item name="bold_font_size" data_type="font_size" type="int">
The font size used for bold text.
</theme_item>
- <theme_item name="bold_italics_font" type="Font">
+ <theme_item name="bold_italics_font" data_type="font" type="Font">
The font used for bold italics text.
</theme_item>
- <theme_item name="bold_italics_font_size" type="int">
+ <theme_item name="bold_italics_font_size" data_type="font_size" type="int">
The font size used for bold italics text.
</theme_item>
- <theme_item name="default_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="default_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The default text color.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
The background The background used when the [RichTextLabel] is focused.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The default tint of text outline.
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
The color of selected text, used when [member selection_enabled] is [code]true[/code].
</theme_item>
- <theme_item name="font_shadow_color" type="Color" default="Color(0, 0, 0, 0)">
+ <theme_item name="font_shadow_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
The color of the font's shadow.
</theme_item>
- <theme_item name="italics_font" type="Font">
+ <theme_item name="italics_font" data_type="font" type="Font">
The font used for italics text.
</theme_item>
- <theme_item name="italics_font_size" type="int">
+ <theme_item name="italics_font_size" data_type="font_size" type="int">
The font size used for italics text.
</theme_item>
- <theme_item name="line_separation" type="int" default="1">
+ <theme_item name="line_separation" data_type="constant" type="int" default="1">
The vertical space between lines.
</theme_item>
- <theme_item name="mono_font" type="Font">
+ <theme_item name="mono_font" data_type="font" type="Font">
The font used for monospace text.
</theme_item>
- <theme_item name="mono_font_size" type="int">
+ <theme_item name="mono_font_size" data_type="font_size" type="int">
The font size used for monospace text.
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
The normal background for the [RichTextLabel].
</theme_item>
- <theme_item name="normal_font" type="Font">
+ <theme_item name="normal_font" data_type="font" type="Font">
The default text font.
</theme_item>
- <theme_item name="normal_font_size" type="int">
+ <theme_item name="normal_font_size" data_type="font_size" type="int">
The default text font size.
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="selection_color" type="Color" default="Color(0.1, 0.1, 1, 0.8)">
+ <theme_item name="selection_color" data_type="color" type="Color" default="Color(0.1, 0.1, 1, 0.8)">
The color of the selection box.
</theme_item>
- <theme_item name="shadow_as_outline" type="int" default="0">
+ <theme_item name="shadow_as_outline" data_type="constant" type="int" default="0">
Boolean value. If 1 ([code]true[/code]), the shadow will be displayed around the whole text as an outline.
</theme_item>
- <theme_item name="shadow_offset_x" type="int" default="1">
+ <theme_item name="shadow_offset_x" data_type="constant" type="int" default="1">
The horizontal offset of the font's shadow.
</theme_item>
- <theme_item name="shadow_offset_y" type="int" default="1">
+ <theme_item name="shadow_offset_y" data_type="constant" type="int" default="1">
The vertical offset of the font's shadow.
</theme_item>
- <theme_item name="table_border" type="Color" default="Color(0, 0, 0, 0)">
+ <theme_item name="table_border" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
The default cell border color.
</theme_item>
- <theme_item name="table_even_row_bg" type="Color" default="Color(0, 0, 0, 0)">
+ <theme_item name="table_even_row_bg" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
The default background color for even rows.
</theme_item>
- <theme_item name="table_hseparation" type="int" default="3">
+ <theme_item name="table_hseparation" data_type="constant" type="int" default="3">
The horizontal separation of elements in a table.
</theme_item>
- <theme_item name="table_odd_row_bg" type="Color" default="Color(0, 0, 0, 0)">
+ <theme_item name="table_odd_row_bg" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
The default background color for odd rows.
</theme_item>
- <theme_item name="table_vseparation" type="int" default="3">
+ <theme_item name="table_vseparation" data_type="constant" type="int" default="3">
The vertical separation of elements in a table.
</theme_item>
</theme_items>
diff --git a/doc/classes/ScrollContainer.xml b/doc/classes/ScrollContainer.xml
index 600e2ee245..953ab24748 100644
--- a/doc/classes/ScrollContainer.xml
+++ b/doc/classes/ScrollContainer.xml
@@ -72,7 +72,7 @@
<constants>
</constants>
<theme_items>
- <theme_item name="bg" type="StyleBox">
+ <theme_item name="bg" data_type="style" type="StyleBox">
The background [StyleBox] of the [ScrollContainer].
</theme_item>
</theme_items>
diff --git a/doc/classes/Shortcut.xml b/doc/classes/Shortcut.xml
index 04955103dc..d9f7f98888 100644
--- a/doc/classes/Shortcut.xml
+++ b/doc/classes/Shortcut.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
A shortcut for binding input.
- Shortcuts are commonly used for interacting with a [Control] element from a [InputEvent].
+ Shortcuts are commonly used for interacting with a [Control] element from an [InputEvent] (also known as hotkeys).
</description>
<tutorials>
</tutorials>
@@ -16,24 +16,24 @@
Returns the shortcut's [InputEvent] as a [String].
</description>
</method>
- <method name="is_shortcut" qualifiers="const">
+ <method name="has_valid_event" qualifiers="const">
<return type="bool" />
- <argument index="0" name="event" type="InputEvent" />
<description>
- Returns [code]true[/code] if the shortcut's [InputEvent] equals [code]event[/code].
+ Returns whether the shortcut has a valid [member event] assigned to it.
</description>
</method>
- <method name="is_valid" qualifiers="const">
+ <method name="matches_event" qualifiers="const">
<return type="bool" />
+ <argument index="0" name="event" type="InputEvent" />
<description>
- If [code]true[/code], this shortcut is valid.
+ Returns whether the shortcut's [member event] matches [code]event[/code].
</description>
</method>
</methods>
<members>
- <member name="shortcut" type="InputEvent" setter="set_shortcut" getter="get_shortcut">
+ <member name="event" type="InputEvent" setter="set_event" getter="get_event">
The shortcut's [InputEvent].
- Generally the [InputEvent] is a keyboard key, though it can be any [InputEvent].
+ Generally the [InputEvent] is a keyboard key, though it can be any [InputEvent], including an [InputEventAction].
</member>
</members>
<constants>
diff --git a/doc/classes/SpinBox.xml b/doc/classes/SpinBox.xml
index 1c1e6e5a15..4303fa52f1 100644
--- a/doc/classes/SpinBox.xml
+++ b/doc/classes/SpinBox.xml
@@ -59,7 +59,7 @@
<constants>
</constants>
<theme_items>
- <theme_item name="updown" type="Texture2D">
+ <theme_item name="updown" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] for up and down arrows of the [SpinBox].
</theme_item>
</theme_items>
diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml
index 2abe4dc90f..fbda005865 100644
--- a/doc/classes/TabContainer.xml
+++ b/doc/classes/TabContainer.xml
@@ -161,61 +161,61 @@
</constant>
</constants>
<theme_items>
- <theme_item name="decrement" type="Texture2D">
+ <theme_item name="decrement" data_type="icon" type="Texture2D">
Icon for the left arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the first tab is visible), it appears semi-transparent.
</theme_item>
- <theme_item name="decrement_highlight" type="Texture2D">
+ <theme_item name="decrement_highlight" data_type="icon" type="Texture2D">
Icon for the left arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
The font used to draw tab names.
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
Font color of disabled tabs.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the tab name.
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Font color of the currently selected tab.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the tab names.
</theme_item>
- <theme_item name="font_unselected_color" type="Color" default="Color(0.69, 0.69, 0.69, 1)">
+ <theme_item name="font_unselected_color" data_type="color" type="Color" default="Color(0.69, 0.69, 0.69, 1)">
Font color of the other, unselected tabs.
</theme_item>
- <theme_item name="icon_separation" type="int" default="4">
+ <theme_item name="icon_separation" data_type="constant" type="int" default="4">
Space between tab's name and its icon.
</theme_item>
- <theme_item name="increment" type="Texture2D">
+ <theme_item name="increment" data_type="icon" type="Texture2D">
Icon for the right arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the last tab is visible) it appears semi-transparent.
</theme_item>
- <theme_item name="increment_highlight" type="Texture2D">
+ <theme_item name="increment_highlight" data_type="icon" type="Texture2D">
Icon for the right arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
</theme_item>
- <theme_item name="menu" type="Texture2D">
+ <theme_item name="menu" data_type="icon" type="Texture2D">
The icon for the menu button (see [method set_popup]).
</theme_item>
- <theme_item name="menu_highlight" type="Texture2D">
+ <theme_item name="menu_highlight" data_type="icon" type="Texture2D">
The icon for the menu button (see [method set_popup]) when it's being hovered with the cursor.
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the tab text outline.
</theme_item>
- <theme_item name="panel" type="StyleBox">
+ <theme_item name="panel" data_type="style" type="StyleBox">
The style for the background fill.
</theme_item>
- <theme_item name="side_margin" type="int" default="8">
+ <theme_item name="side_margin" data_type="constant" type="int" default="8">
The space at the left and right edges of the tab bar.
</theme_item>
- <theme_item name="tab_disabled" type="StyleBox">
+ <theme_item name="tab_disabled" data_type="style" type="StyleBox">
The style of disabled tabs.
</theme_item>
- <theme_item name="tab_selected" type="StyleBox">
+ <theme_item name="tab_selected" data_type="style" type="StyleBox">
The style of the currently selected tab.
</theme_item>
- <theme_item name="tab_unselected" type="StyleBox">
+ <theme_item name="tab_unselected" data_type="style" type="StyleBox">
The style of the other, unselected tabs.
</theme_item>
</theme_items>
diff --git a/doc/classes/Tabs.xml b/doc/classes/Tabs.xml
index 537bb9c403..f4c89a8b16 100644
--- a/doc/classes/Tabs.xml
+++ b/doc/classes/Tabs.xml
@@ -282,58 +282,58 @@
</constant>
</constants>
<theme_items>
- <theme_item name="button" type="StyleBox">
+ <theme_item name="button" data_type="style" type="StyleBox">
Background of the close button when it's being hovered with the cursor.
</theme_item>
- <theme_item name="button_pressed" type="StyleBox">
+ <theme_item name="button_pressed" data_type="style" type="StyleBox">
Background of the close button when it's being pressed.
</theme_item>
- <theme_item name="close" type="Texture2D">
+ <theme_item name="close" data_type="icon" type="Texture2D">
The icon for the close button (see [member tab_close_display_policy]).
</theme_item>
- <theme_item name="decrement" type="Texture2D">
+ <theme_item name="decrement" data_type="icon" type="Texture2D">
Icon for the left arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the first tab is visible), it appears semi-transparent.
</theme_item>
- <theme_item name="decrement_highlight" type="Texture2D">
+ <theme_item name="decrement_highlight" data_type="icon" type="Texture2D">
Icon for the left arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
The font used to draw tab names.
</theme_item>
- <theme_item name="font_disabled_color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
+ <theme_item name="font_disabled_color" data_type="color" type="Color" default="Color(0.9, 0.9, 0.9, 0.2)">
Font color of disabled tabs.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the tab name.
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Font color of the currently selected tab.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the tab names.
</theme_item>
- <theme_item name="font_unselected_color" type="Color" default="Color(0.69, 0.69, 0.69, 1)">
+ <theme_item name="font_unselected_color" data_type="color" type="Color" default="Color(0.69, 0.69, 0.69, 1)">
Font color of the other, unselected tabs.
</theme_item>
- <theme_item name="hseparation" type="int" default="4">
+ <theme_item name="hseparation" data_type="constant" type="int" default="4">
The horizontal separation between the tabs.
</theme_item>
- <theme_item name="increment" type="Texture2D">
+ <theme_item name="increment" data_type="icon" type="Texture2D">
Icon for the right arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the last tab is visible) it appears semi-transparent.
</theme_item>
- <theme_item name="increment_highlight" type="Texture2D">
+ <theme_item name="increment_highlight" data_type="icon" type="Texture2D">
Icon for the right arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the tab text outline.
</theme_item>
- <theme_item name="tab_disabled" type="StyleBox">
+ <theme_item name="tab_disabled" data_type="style" type="StyleBox">
The style of disabled tabs.
</theme_item>
- <theme_item name="tab_selected" type="StyleBox">
+ <theme_item name="tab_selected" data_type="style" type="StyleBox">
The style of the currently selected tab.
</theme_item>
- <theme_item name="tab_unselected" type="StyleBox">
+ <theme_item name="tab_unselected" data_type="style" type="StyleBox">
The style of the other, unselected tabs.
</theme_item>
</theme_items>
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index 5d62050a94..7b34b3c461 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -791,57 +791,61 @@
</constant>
</constants>
<theme_items>
- <theme_item name="background_color" type="Color" default="Color(0, 0, 0, 0)">
+ <theme_item name="background_color" data_type="color" type="Color" default="Color(0, 0, 0, 0)">
Sets the background [Color] of this [TextEdit].
</theme_item>
- <theme_item name="caret_background_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="caret_background_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
+ [Color] of the text behind the caret when block caret is enabled.
</theme_item>
- <theme_item name="caret_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="caret_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ [Color] of the caret.
</theme_item>
- <theme_item name="current_line_color" type="Color" default="Color(0.25, 0.25, 0.26, 0.8)">
- Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled.
+ <theme_item name="current_line_color" data_type="color" type="Color" default="Color(0.25, 0.25, 0.26, 0.8)">
+ Background [Color] of the line containing the caret.
</theme_item>
- <theme_item name="focus" type="StyleBox">
+ <theme_item name="focus" data_type="style" type="StyleBox">
+ Sets the [StyleBox] when in focus.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
Sets the default [Font].
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Sets the font [Color].
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the [TextEdit].
</theme_item>
- <theme_item name="font_readonly_color" type="Color" default="Color(0.88, 0.88, 0.88, 0.5)">
+ <theme_item name="font_readonly_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 0.5)">
+ Sets the font [Color] when [member readonly] is enabled.
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
Sets the [Color] of the selected text. [member override_selected_font_color] has to be enabled.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Sets default font size.
</theme_item>
- <theme_item name="line_spacing" type="int" default="4">
+ <theme_item name="line_spacing" data_type="constant" type="int" default="4">
Sets the spacing between the lines.
</theme_item>
- <theme_item name="normal" type="StyleBox">
+ <theme_item name="normal" data_type="style" type="StyleBox">
Sets the [StyleBox] of this [TextEdit].
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="read_only" type="StyleBox">
+ <theme_item name="read_only" data_type="style" type="StyleBox">
Sets the [StyleBox] of this [TextEdit] when [member readonly] is enabled.
</theme_item>
- <theme_item name="selection_color" type="Color" default="Color(0.49, 0.49, 0.49, 1)">
+ <theme_item name="selection_color" data_type="color" type="Color" default="Color(0.49, 0.49, 0.49, 1)">
Sets the highlight [Color] of text selections.
</theme_item>
- <theme_item name="space" type="Texture2D">
+ <theme_item name="space" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] for space text characters.
</theme_item>
- <theme_item name="tab" type="Texture2D">
+ <theme_item name="tab" data_type="icon" type="Texture2D">
Sets a custom [Texture2D] for tab text characters.
</theme_item>
- <theme_item name="word_highlighted_color" type="Color" default="Color(0.8, 0.9, 0.9, 0.15)">
+ <theme_item name="word_highlighted_color" data_type="color" type="Color" default="Color(0.8, 0.9, 0.9, 0.15)">
Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled.
</theme_item>
</theme_items>
diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml
index c7c2c04256..50a573d30f 100644
--- a/doc/classes/Tree.xml
+++ b/doc/classes/Tree.xml
@@ -474,142 +474,142 @@
</constant>
</constants>
<theme_items>
- <theme_item name="arrow" type="Texture2D">
+ <theme_item name="arrow" data_type="icon" type="Texture2D">
The arrow icon used when a foldable item is not collapsed.
</theme_item>
- <theme_item name="arrow_collapsed" type="Texture2D">
+ <theme_item name="arrow_collapsed" data_type="icon" type="Texture2D">
The arrow icon used when a foldable item is collapsed (for left-to-right layouts).
</theme_item>
- <theme_item name="arrow_collapsed_mirrored" type="Texture2D">
+ <theme_item name="arrow_collapsed_mirrored" data_type="icon" type="Texture2D">
The arrow icon used when a foldable item is collapsed (for right-to-left layouts).
</theme_item>
- <theme_item name="bg" type="StyleBox">
+ <theme_item name="bg" data_type="style" type="StyleBox">
Default [StyleBox] for the [Tree], i.e. used when the control is not being focused.
</theme_item>
- <theme_item name="bg_focus" type="StyleBox">
+ <theme_item name="bg_focus" data_type="style" type="StyleBox">
[StyleBox] used when the [Tree] is being focused.
</theme_item>
- <theme_item name="button_margin" type="int" default="4">
+ <theme_item name="button_margin" data_type="constant" type="int" default="4">
The horizontal space between each button in a cell.
</theme_item>
- <theme_item name="button_pressed" type="StyleBox">
+ <theme_item name="button_pressed" data_type="style" type="StyleBox">
[StyleBox] used when a button in the tree is pressed.
</theme_item>
- <theme_item name="checked" type="Texture2D">
+ <theme_item name="checked" data_type="icon" type="Texture2D">
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is checked.
</theme_item>
- <theme_item name="children_hl_line_color" type="Color" default="Color(0.27, 0.27, 0.27, 1)">
+ <theme_item name="children_hl_line_color" data_type="color" type="Color" default="Color(0.27, 0.27, 0.27, 1)">
The [Color] of the relationship lines between the selected [TreeItem] and its children.
</theme_item>
- <theme_item name="children_hl_line_width" type="int" default="1">
+ <theme_item name="children_hl_line_width" data_type="constant" type="int" default="1">
The width of the relationship lines between the selected [TreeItem] and its children.
</theme_item>
- <theme_item name="cursor" type="StyleBox">
+ <theme_item name="cursor" data_type="style" type="StyleBox">
[StyleBox] used for the cursor, when the [Tree] is being focused.
</theme_item>
- <theme_item name="cursor_unfocused" type="StyleBox">
+ <theme_item name="cursor_unfocused" data_type="style" type="StyleBox">
[StyleBox] used for the cursor, when the [Tree] is not being focused.
</theme_item>
- <theme_item name="custom_button" type="StyleBox">
+ <theme_item name="custom_button" data_type="style" type="StyleBox">
Default [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell.
</theme_item>
- <theme_item name="custom_button_font_highlight" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
+ <theme_item name="custom_button_font_highlight" data_type="color" type="Color" default="Color(0.94, 0.94, 0.94, 1)">
Text [Color] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's hovered.
</theme_item>
- <theme_item name="custom_button_hover" type="StyleBox">
+ <theme_item name="custom_button_hover" data_type="style" type="StyleBox">
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's hovered.
</theme_item>
- <theme_item name="custom_button_pressed" type="StyleBox">
+ <theme_item name="custom_button_pressed" data_type="style" type="StyleBox">
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's pressed.
</theme_item>
- <theme_item name="draw_guides" type="int" default="1">
+ <theme_item name="draw_guides" data_type="constant" type="int" default="1">
Draws the guidelines if not zero, this acts as a boolean. The guideline is a horizontal line drawn at the bottom of each item.
</theme_item>
- <theme_item name="draw_relationship_lines" type="int" default="0">
+ <theme_item name="draw_relationship_lines" data_type="constant" type="int" default="0">
Draws the relationship lines if not zero, this acts as a boolean. Relationship lines are drawn at the start of child items to show hierarchy.
</theme_item>
- <theme_item name="drop_position_color" type="Color" default="Color(1, 0.3, 0.2, 1)">
+ <theme_item name="drop_position_color" data_type="color" type="Color" default="Color(1, 0.3, 0.2, 1)">
[Color] used to draw possible drop locations. See [enum DropModeFlags] constants for further description of drop locations.
</theme_item>
- <theme_item name="font" type="Font">
+ <theme_item name="font" data_type="font" type="Font">
[Font] of the item's text.
</theme_item>
- <theme_item name="font_color" type="Color" default="Color(0.69, 0.69, 0.69, 1)">
+ <theme_item name="font_color" data_type="color" type="Color" default="Color(0.69, 0.69, 0.69, 1)">
Default text [Color] of the item.
</theme_item>
- <theme_item name="font_outline_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_outline_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The tint of text outline of the item.
</theme_item>
- <theme_item name="font_selected_color" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="font_selected_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Text [Color] used when the item is selected.
</theme_item>
- <theme_item name="font_size" type="int">
+ <theme_item name="font_size" data_type="font_size" type="int">
Font size of the item's text.
</theme_item>
- <theme_item name="guide_color" type="Color" default="Color(0, 0, 0, 0.1)">
+ <theme_item name="guide_color" data_type="color" type="Color" default="Color(0, 0, 0, 0.1)">
[Color] of the guideline.
</theme_item>
- <theme_item name="hseparation" type="int" default="4">
+ <theme_item name="hseparation" data_type="constant" type="int" default="4">
The horizontal space between item cells. This is also used as the margin at the start of an item when folding is disabled.
</theme_item>
- <theme_item name="item_margin" type="int" default="12">
+ <theme_item name="item_margin" data_type="constant" type="int" default="12">
The horizontal margin at the start of an item. This is used when folding is enabled for the item.
</theme_item>
- <theme_item name="outline_size" type="int" default="0">
+ <theme_item name="outline_size" data_type="constant" type="int" default="0">
The size of the text outline.
</theme_item>
- <theme_item name="parent_hl_line_color" type="Color" default="Color(0.27, 0.27, 0.27, 1)">
+ <theme_item name="parent_hl_line_color" data_type="color" type="Color" default="Color(0.27, 0.27, 0.27, 1)">
The [Color] of the relationship lines between the selected [TreeItem] and its parents.
</theme_item>
- <theme_item name="parent_hl_line_margin" type="int" default="0">
+ <theme_item name="parent_hl_line_margin" data_type="constant" type="int" default="0">
The space between the parent relationship lines for the selected [TreeItem] and the relationship lines to its siblings that are not selected.
</theme_item>
- <theme_item name="parent_hl_line_width" type="int" default="1">
+ <theme_item name="parent_hl_line_width" data_type="constant" type="int" default="1">
The width of the relationship lines between the selected [TreeItem] and its parents.
</theme_item>
- <theme_item name="relationship_line_color" type="Color" default="Color(0.27, 0.27, 0.27, 1)">
+ <theme_item name="relationship_line_color" data_type="color" type="Color" default="Color(0.27, 0.27, 0.27, 1)">
The default [Color] of the relationship lines.
</theme_item>
- <theme_item name="relationship_line_width" type="int" default="1">
+ <theme_item name="relationship_line_width" data_type="constant" type="int" default="1">
The default width of the relationship lines.
</theme_item>
- <theme_item name="scroll_border" type="int" default="4">
+ <theme_item name="scroll_border" data_type="constant" type="int" default="4">
The maximum distance between the mouse cursor and the control's border to trigger border scrolling when dragging.
</theme_item>
- <theme_item name="scroll_speed" type="int" default="12">
+ <theme_item name="scroll_speed" data_type="constant" type="int" default="12">
The speed of border scrolling.
</theme_item>
- <theme_item name="select_arrow" type="Texture2D">
+ <theme_item name="select_arrow" data_type="icon" type="Texture2D">
The arrow icon to display for the [constant TreeItem.CELL_MODE_RANGE] mode cell.
</theme_item>
- <theme_item name="selected" type="StyleBox">
+ <theme_item name="selected" data_type="style" type="StyleBox">
[StyleBox] for the selected items, used when the [Tree] is not being focused.
</theme_item>
- <theme_item name="selected_focus" type="StyleBox">
+ <theme_item name="selected_focus" data_type="style" type="StyleBox">
[StyleBox] for the selected items, used when the [Tree] is being focused.
</theme_item>
- <theme_item name="title_button_color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
+ <theme_item name="title_button_color" data_type="color" type="Color" default="Color(0.88, 0.88, 0.88, 1)">
Default text [Color] of the title button.
</theme_item>
- <theme_item name="title_button_font" type="Font">
+ <theme_item name="title_button_font" data_type="font" type="Font">
[Font] of the title button's text.
</theme_item>
- <theme_item name="title_button_hover" type="StyleBox">
+ <theme_item name="title_button_hover" data_type="style" type="StyleBox">
[StyleBox] used when the title button is being hovered.
</theme_item>
- <theme_item name="title_button_normal" type="StyleBox">
+ <theme_item name="title_button_normal" data_type="style" type="StyleBox">
Default [StyleBox] for the title button.
</theme_item>
- <theme_item name="title_button_pressed" type="StyleBox">
+ <theme_item name="title_button_pressed" data_type="style" type="StyleBox">
[StyleBox] used when the title button is being pressed.
</theme_item>
- <theme_item name="unchecked" type="Texture2D">
+ <theme_item name="unchecked" data_type="icon" type="Texture2D">
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is unchecked.
</theme_item>
- <theme_item name="updown" type="Texture2D">
+ <theme_item name="updown" data_type="icon" type="Texture2D">
The updown arrow icon to display for the [constant TreeItem.CELL_MODE_RANGE] mode cell.
</theme_item>
- <theme_item name="vseparation" type="int" default="4">
+ <theme_item name="vseparation" data_type="constant" type="int" default="4">
The vertical padding inside each item, i.e. the distance between the item's content and top/bottom border.
</theme_item>
</theme_items>
diff --git a/doc/classes/VBoxContainer.xml b/doc/classes/VBoxContainer.xml
index 213f8fd742..aa6c5fc8a4 100644
--- a/doc/classes/VBoxContainer.xml
+++ b/doc/classes/VBoxContainer.xml
@@ -14,7 +14,7 @@
<constants>
</constants>
<theme_items>
- <theme_item name="separation" type="int" default="4">
+ <theme_item name="separation" data_type="constant" type="int" default="4">
The vertical space between the [VBoxContainer]'s elements.
</theme_item>
</theme_items>
diff --git a/doc/classes/VScrollBar.xml b/doc/classes/VScrollBar.xml
index 727e32961c..98a0aea0c7 100644
--- a/doc/classes/VScrollBar.xml
+++ b/doc/classes/VScrollBar.xml
@@ -17,31 +17,31 @@
<constants>
</constants>
<theme_items>
- <theme_item name="decrement" type="Texture2D">
+ <theme_item name="decrement" data_type="icon" type="Texture2D">
Icon used as a button to scroll the [ScrollBar] up. Supports custom step using the [member ScrollBar.custom_step] property.
</theme_item>
- <theme_item name="decrement_highlight" type="Texture2D">
+ <theme_item name="decrement_highlight" data_type="icon" type="Texture2D">
Displayed when the mouse cursor hovers over the decrement button.
</theme_item>
- <theme_item name="grabber" type="StyleBox">
+ <theme_item name="grabber" data_type="style" type="StyleBox">
Used as texture for the grabber, the draggable element representing current scroll.
</theme_item>
- <theme_item name="grabber_highlight" type="StyleBox">
+ <theme_item name="grabber_highlight" data_type="style" type="StyleBox">
Used when the mouse hovers over the grabber.
</theme_item>
- <theme_item name="grabber_pressed" type="StyleBox">
+ <theme_item name="grabber_pressed" data_type="style" type="StyleBox">
Used when the grabber is being dragged.
</theme_item>
- <theme_item name="increment" type="Texture2D">
+ <theme_item name="increment" data_type="icon" type="Texture2D">
Icon used as a button to scroll the [ScrollBar] down. Supports custom step using the [member ScrollBar.custom_step] property.
</theme_item>
- <theme_item name="increment_highlight" type="Texture2D">
+ <theme_item name="increment_highlight" data_type="icon" type="Texture2D">
Displayed when the mouse cursor hovers over the increment button.
</theme_item>
- <theme_item name="scroll" type="StyleBox">
+ <theme_item name="scroll" data_type="style" type="StyleBox">
Used as background of this [ScrollBar].
</theme_item>
- <theme_item name="scroll_focus" type="StyleBox">
+ <theme_item name="scroll_focus" data_type="style" type="StyleBox">
Used as background when the [ScrollBar] has the GUI focus.
</theme_item>
</theme_items>
diff --git a/doc/classes/VSeparator.xml b/doc/classes/VSeparator.xml
index 52f31b1da7..d59c7229ac 100644
--- a/doc/classes/VSeparator.xml
+++ b/doc/classes/VSeparator.xml
@@ -13,10 +13,10 @@
<constants>
</constants>
<theme_items>
- <theme_item name="separation" type="int" default="4">
+ <theme_item name="separation" data_type="constant" type="int" default="4">
The width of the area covered by the separator. Effectively works like a minimum width.
</theme_item>
- <theme_item name="separator" type="StyleBox">
+ <theme_item name="separator" data_type="style" type="StyleBox">
The style for the separator line. Works best with [StyleBoxLine] (remember to enable [member StyleBoxLine.vertical]).
</theme_item>
</theme_items>
diff --git a/doc/classes/VSlider.xml b/doc/classes/VSlider.xml
index 5830c9eaf3..becf3d1052 100644
--- a/doc/classes/VSlider.xml
+++ b/doc/classes/VSlider.xml
@@ -18,24 +18,24 @@
<constants>
</constants>
<theme_items>
- <theme_item name="grabber" type="Texture2D">
+ <theme_item name="grabber" data_type="icon" type="Texture2D">
The texture for the grabber (the draggable element).
</theme_item>
- <theme_item name="grabber_area" type="StyleBox">
+ <theme_item name="grabber_area" data_type="style" type="StyleBox">
The background of the area below the grabber.
</theme_item>
- <theme_item name="grabber_area_highlight" type="StyleBox">
+ <theme_item name="grabber_area_highlight" data_type="style" type="StyleBox">
</theme_item>
- <theme_item name="grabber_disabled" type="Texture2D">
+ <theme_item name="grabber_disabled" data_type="icon" type="Texture2D">
The texture for the grabber when it's disabled.
</theme_item>
- <theme_item name="grabber_highlight" type="Texture2D">
+ <theme_item name="grabber_highlight" data_type="icon" type="Texture2D">
The texture for the grabber when it's focused.
</theme_item>
- <theme_item name="slider" type="StyleBox">
+ <theme_item name="slider" data_type="style" type="StyleBox">
The background for the whole slider. Determines the width of the [code]grabber_area[/code].
</theme_item>
- <theme_item name="tick" type="Texture2D">
+ <theme_item name="tick" data_type="icon" type="Texture2D">
The texture for the ticks, visible when [member Slider.tick_count] is greater than 0.
</theme_item>
</theme_items>
diff --git a/doc/classes/VSplitContainer.xml b/doc/classes/VSplitContainer.xml
index 18b515e7ce..143f5b6b0a 100644
--- a/doc/classes/VSplitContainer.xml
+++ b/doc/classes/VSplitContainer.xml
@@ -13,15 +13,15 @@
<constants>
</constants>
<theme_items>
- <theme_item name="autohide" type="int" default="1">
+ <theme_item name="autohide" data_type="constant" type="int" default="1">
Boolean value. If 1 ([code]true[/code]), the grabber will hide automatically when it isn't under the cursor. If 0 ([code]false[/code]), it's always visible.
</theme_item>
- <theme_item name="bg" type="StyleBox">
+ <theme_item name="bg" data_type="style" type="StyleBox">
</theme_item>
- <theme_item name="grabber" type="Texture2D">
+ <theme_item name="grabber" data_type="icon" type="Texture2D">
The icon used for the grabber drawn in the middle area.
</theme_item>
- <theme_item name="separation" type="int" default="12">
+ <theme_item name="separation" data_type="constant" type="int" default="12">
The space between sides of the container.
</theme_item>
</theme_items>
diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml
index bc76118a56..d7b156cc57 100644
--- a/doc/classes/Window.xml
+++ b/doc/classes/Window.xml
@@ -391,33 +391,33 @@
</constant>
</constants>
<theme_items>
- <theme_item name="close" type="Texture2D">
+ <theme_item name="close" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="close_h_ofs" type="int" default="18">
+ <theme_item name="close_h_ofs" data_type="constant" type="int" default="18">
</theme_item>
- <theme_item name="close_pressed" type="Texture2D">
+ <theme_item name="close_pressed" data_type="icon" type="Texture2D">
</theme_item>
- <theme_item name="close_v_ofs" type="int" default="18">
+ <theme_item name="close_v_ofs" data_type="constant" type="int" default="18">
</theme_item>
- <theme_item name="embedded_border" type="StyleBox">
+ <theme_item name="embedded_border" data_type="style" type="StyleBox">
</theme_item>
- <theme_item name="resize_margin" type="int" default="4">
+ <theme_item name="resize_margin" data_type="constant" type="int" default="4">
</theme_item>
- <theme_item name="scaleborder_size" type="int" default="4">
+ <theme_item name="scaleborder_size" data_type="constant" type="int" default="4">
</theme_item>
- <theme_item name="title_color" type="Color" default="Color(0, 0, 0, 1)">
+ <theme_item name="title_color" data_type="color" type="Color" default="Color(0, 0, 0, 1)">
</theme_item>
- <theme_item name="title_font" type="Font">
+ <theme_item name="title_font" data_type="font" type="Font">
</theme_item>
- <theme_item name="title_font_size" type="int">
+ <theme_item name="title_font_size" data_type="font_size" type="int">
The size of the title font.
</theme_item>
- <theme_item name="title_height" type="int" default="20">
+ <theme_item name="title_height" data_type="constant" type="int" default="20">
</theme_item>
- <theme_item name="title_outline_modulate" type="Color" default="Color(1, 1, 1, 1)">
+ <theme_item name="title_outline_modulate" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
The color of the title outline.
</theme_item>
- <theme_item name="title_outline_size" type="int" default="0">
+ <theme_item name="title_outline_size" data_type="constant" type="int" default="0">
The size of the title outline.
</theme_item>
</theme_items>
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 438b64ebbf..770419a37c 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -90,9 +90,13 @@ class EnumDef:
class ThemeItemDef:
- def __init__(self, name, type_name, default_value): # type: (str, TypeName, Optional[str]) -> None
+ def __init__(
+ self, name, type_name, data_name, text, default_value
+ ): # type: (str, TypeName, str, Optional[str], Optional[str]) -> None
self.name = name
self.type_name = type_name
+ self.data_name = data_name
+ self.text = text
self.default_value = default_value
@@ -104,10 +108,10 @@ class ClassDef:
self.properties = OrderedDict() # type: OrderedDict[str, PropertyDef]
self.methods = OrderedDict() # type: OrderedDict[str, List[MethodDef]]
self.signals = OrderedDict() # type: OrderedDict[str, SignalDef]
+ self.theme_items = OrderedDict() # type: OrderedDict[str, ThemeItemDef]
self.inherits = None # type: Optional[str]
self.brief_description = None # type: Optional[str]
self.description = None # type: Optional[str]
- self.theme_items = None # type: Optional[OrderedDict[str, List[ThemeItemDef]]]
self.tutorials = [] # type: List[Tuple[str, str]]
# Used to match the class with XML source for output filtering purposes.
@@ -240,16 +244,33 @@ class State:
theme_items = class_root.find("theme_items")
if theme_items is not None:
- class_def.theme_items = OrderedDict()
for theme_item in theme_items:
assert theme_item.tag == "theme_item"
theme_item_name = theme_item.attrib["name"]
+ theme_item_data_name = theme_item.attrib["data_type"]
+ theme_item_id = "{}_{}".format(theme_item_data_name, theme_item_name)
+ if theme_item_id in class_def.theme_items:
+ print_error(
+ "Duplicate theme property '{}' of type '{}', file: {}".format(
+ theme_item_name, theme_item_data_name, class_name
+ ),
+ self,
+ )
+ continue
+
default_value = theme_item.get("default") or None
- theme_item_def = ThemeItemDef(theme_item_name, TypeName.from_element(theme_item), default_value)
- if theme_item_name not in class_def.theme_items:
- class_def.theme_items[theme_item_name] = []
- class_def.theme_items[theme_item_name].append(theme_item_def)
+ if default_value is not None:
+ default_value = "``{}``".format(default_value)
+
+ theme_item_def = ThemeItemDef(
+ theme_item_name,
+ TypeName.from_element(theme_item),
+ theme_item_data_name,
+ theme_item.text,
+ default_value,
+ )
+ class_def.theme_items[theme_item_id] = theme_item_def
tutorials = class_root.find("tutorials")
if tutorials is not None:
@@ -461,9 +482,11 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
if class_def.theme_items is not None and len(class_def.theme_items) > 0:
f.write(make_heading("Theme Properties", "-"))
pl = []
- for theme_item_list in class_def.theme_items.values():
- for theme_item in theme_item_list:
- pl.append((theme_item.type_name.to_rst(state), theme_item.name, theme_item.default_value))
+ for theme_item_def in class_def.theme_items.values():
+ ref = ":ref:`{0}<class_{2}_theme_{1}_{0}>`".format(
+ theme_item_def.name, theme_item_def.data_name, class_name
+ )
+ pl.append((theme_item_def.type_name.to_rst(state), ref, theme_item_def.default_value))
format_table(f, pl, True)
# Signals
@@ -578,6 +601,29 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S
index += 1
+ if len(class_def.theme_items) > 0:
+ f.write(make_heading("Theme Property Descriptions", "-"))
+ index = 0
+
+ for theme_item_def in class_def.theme_items.values():
+ if index != 0:
+ f.write("----\n\n")
+
+ f.write(".. _class_{}_theme_{}_{}:\n\n".format(class_name, theme_item_def.data_name, theme_item_def.name))
+ f.write("- {} **{}**\n\n".format(theme_item_def.type_name.to_rst(state), theme_item_def.name))
+
+ info = []
+ if theme_item_def.default_value is not None:
+ info.append(("*Default*", theme_item_def.default_value))
+
+ if len(info) > 0:
+ format_table(f, info)
+
+ if theme_item_def.text is not None and theme_item_def.text.strip() != "":
+ f.write(rstize_text(theme_item_def.text.strip(), state) + "\n\n")
+
+ index += 1
+
f.write(make_footer())
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 1e3140e202..6ef36f16f5 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -605,12 +605,12 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_pressed()) {
- if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) {
+ if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->matches_event(p_event)) {
duplicate_selection();
accept_event();
}
- if (ED_GET_SHORTCUT("animation_editor/delete_selection")->is_shortcut(p_event)) {
+ if (ED_GET_SHORTCUT("animation_editor/delete_selection")->matches_event(p_event)) {
delete_selection();
accept_event();
}
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 91835c1866..c9d3df9ce2 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -2555,17 +2555,17 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
if (p_event->is_pressed()) {
- if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) {
+ if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->matches_event(p_event)) {
emit_signal(SNAME("duplicate_request"));
accept_event();
}
- if (ED_GET_SHORTCUT("animation_editor/duplicate_selection_transposed")->is_shortcut(p_event)) {
+ if (ED_GET_SHORTCUT("animation_editor/duplicate_selection_transposed")->matches_event(p_event)) {
emit_signal(SNAME("duplicate_transpose_request"));
accept_event();
}
- if (ED_GET_SHORTCUT("animation_editor/delete_selection")->is_shortcut(p_event)) {
+ if (ED_GET_SHORTCUT("animation_editor/delete_selection")->matches_event(p_event)) {
emit_signal(SNAME("delete_request"));
accept_event();
}
diff --git a/editor/debugger/SCsub b/editor/debugger/SCsub
index 359d04e5df..99f1c888f0 100644
--- a/editor/debugger/SCsub
+++ b/editor/debugger/SCsub
@@ -3,3 +3,5 @@
Import("env")
env.add_source_files(env.editor_sources, "*.cpp")
+
+SConscript("debug_adapter/SCsub")
diff --git a/editor/debugger/debug_adapter/SCsub b/editor/debugger/debug_adapter/SCsub
new file mode 100644
index 0000000000..359d04e5df
--- /dev/null
+++ b/editor/debugger/debug_adapter/SCsub
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+Import("env")
+
+env.add_source_files(env.editor_sources, "*.cpp")
diff --git a/editor/debugger/debug_adapter/debug_adapter_parser.cpp b/editor/debugger/debug_adapter/debug_adapter_parser.cpp
new file mode 100644
index 0000000000..945291b163
--- /dev/null
+++ b/editor/debugger/debug_adapter/debug_adapter_parser.cpp
@@ -0,0 +1,425 @@
+/*************************************************************************/
+/* debug_adapter_parser.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "debug_adapter_parser.h"
+
+#include "editor/debugger/editor_debugger_node.h"
+#include "editor/debugger/script_editor_debugger.h"
+#include "editor/editor_node.h"
+
+void DebugAdapterParser::_bind_methods() {
+ // Requests
+ ClassDB::bind_method(D_METHOD("req_initialize", "params"), &DebugAdapterParser::req_initialize);
+ ClassDB::bind_method(D_METHOD("req_disconnect", "params"), &DebugAdapterParser::prepare_success_response);
+ ClassDB::bind_method(D_METHOD("req_launch", "params"), &DebugAdapterParser::req_launch);
+ ClassDB::bind_method(D_METHOD("req_terminate", "params"), &DebugAdapterParser::req_terminate);
+ ClassDB::bind_method(D_METHOD("req_configurationDone", "params"), &DebugAdapterParser::prepare_success_response);
+ ClassDB::bind_method(D_METHOD("req_pause", "params"), &DebugAdapterParser::req_pause);
+ ClassDB::bind_method(D_METHOD("req_continue", "params"), &DebugAdapterParser::req_continue);
+ ClassDB::bind_method(D_METHOD("req_threads", "params"), &DebugAdapterParser::req_threads);
+ ClassDB::bind_method(D_METHOD("req_stackTrace", "params"), &DebugAdapterParser::req_stackTrace);
+ ClassDB::bind_method(D_METHOD("req_setBreakpoints", "params"), &DebugAdapterParser::req_setBreakpoints);
+ ClassDB::bind_method(D_METHOD("req_scopes", "params"), &DebugAdapterParser::req_scopes);
+ ClassDB::bind_method(D_METHOD("req_variables", "params"), &DebugAdapterParser::req_variables);
+ ClassDB::bind_method(D_METHOD("req_next", "params"), &DebugAdapterParser::req_next);
+ ClassDB::bind_method(D_METHOD("req_stepIn", "params"), &DebugAdapterParser::req_stepIn);
+}
+
+Dictionary DebugAdapterParser::prepare_base_event() const {
+ Dictionary event;
+ event["type"] = "event";
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::prepare_success_response(const Dictionary &p_params) const {
+ Dictionary response;
+ response["type"] = "response";
+ response["request_seq"] = p_params["seq"];
+ response["command"] = p_params["command"];
+ response["success"] = true;
+
+ return response;
+}
+
+Dictionary DebugAdapterParser::prepare_error_response(const Dictionary &p_params, DAP::ErrorType err_type, const Dictionary &variables) const {
+ Dictionary response, body;
+ response["type"] = "response";
+ response["request_seq"] = p_params["seq"];
+ response["command"] = p_params["command"];
+ response["success"] = false;
+ response["body"] = body;
+
+ DAP::Message message;
+ String error, error_desc;
+ switch (err_type) {
+ case DAP::ErrorType::UNKNOWN:
+ error = "unknown";
+ error_desc = "An unknown error has ocurred when processing the request.";
+ break;
+ case DAP::ErrorType::WRONG_PATH:
+ error = "wrong_path";
+ error_desc = "The editor and client are working on different paths; the client is on \"{clientPath}\", but the editor is on \"{editorPath}\"";
+ }
+
+ message.id = err_type;
+ message.format = error_desc;
+ message.variables = variables;
+ response["message"] = error;
+ body["error"] = message.to_json();
+
+ return response;
+}
+
+Dictionary DebugAdapterParser::req_initialize(const Dictionary &p_params) const {
+ Dictionary response = prepare_success_response(p_params);
+ Dictionary args = p_params["arguments"];
+
+ Ref<DAPeer> peer = DebugAdapterProtocol::get_singleton()->get_current_peer();
+
+ peer->linesStartAt1 = args.get("linesStartAt1", false);
+ peer->columnsStartAt1 = args.get("columnsStartAt1", false);
+ peer->supportsVariableType = args.get("supportsVariableType", false);
+ peer->supportsInvalidatedEvent = args.get("supportsInvalidatedEvent", false);
+
+ DAP::Capabilities caps;
+ response["body"] = caps.to_json();
+
+ DebugAdapterProtocol::get_singleton()->notify_initialized();
+
+ return response;
+}
+
+Dictionary DebugAdapterParser::req_launch(const Dictionary &p_params) {
+ Dictionary args = p_params["arguments"];
+ if (args.has("project") && !is_valid_path(args["project"])) {
+ Dictionary variables;
+ variables["clientPath"] = args["project"];
+ variables["editorPath"] = ProjectSettings::get_singleton()->get_resource_path();
+ return prepare_error_response(p_params, DAP::ErrorType::WRONG_PATH, variables);
+ }
+
+ ScriptEditorDebugger *dbg = EditorDebuggerNode::get_singleton()->get_default_debugger();
+ if ((bool)args["noDebug"] != dbg->is_skip_breakpoints()) {
+ dbg->debug_skip_breakpoints();
+ }
+
+ EditorNode::get_singleton()->run_play();
+ DebugAdapterProtocol::get_singleton()->notify_process();
+
+ return prepare_success_response(p_params);
+}
+
+Dictionary DebugAdapterParser::req_terminate(const Dictionary &p_params) const {
+ EditorNode::get_singleton()->run_stop();
+
+ return prepare_success_response(p_params);
+}
+
+Dictionary DebugAdapterParser::req_pause(const Dictionary &p_params) const {
+ EditorNode::get_singleton()->get_pause_button()->set_pressed(true);
+ EditorDebuggerNode::get_singleton()->_paused();
+
+ DebugAdapterProtocol::get_singleton()->notify_stopped_paused();
+
+ return prepare_success_response(p_params);
+}
+
+Dictionary DebugAdapterParser::req_continue(const Dictionary &p_params) const {
+ EditorNode::get_singleton()->get_pause_button()->set_pressed(false);
+ EditorDebuggerNode::get_singleton()->_paused();
+
+ DebugAdapterProtocol::get_singleton()->notify_continued();
+
+ return prepare_success_response(p_params);
+}
+
+Dictionary DebugAdapterParser::req_threads(const Dictionary &p_params) const {
+ Dictionary response = prepare_success_response(p_params), body;
+ response["body"] = body;
+
+ Array arr;
+ DAP::Thread thread;
+
+ thread.id = 1; // Hardcoded because Godot only supports debugging one thread at the moment
+ thread.name = "Main";
+ arr.push_back(thread.to_json());
+ body["threads"] = arr;
+
+ return response;
+}
+
+Dictionary DebugAdapterParser::req_stackTrace(const Dictionary &p_params) const {
+ if (DebugAdapterProtocol::get_singleton()->_processing_stackdump) {
+ return Dictionary();
+ }
+
+ Dictionary response = prepare_success_response(p_params), body;
+ response["body"] = body;
+
+ bool lines_at_one = DebugAdapterProtocol::get_singleton()->get_current_peer()->linesStartAt1;
+ bool columns_at_one = DebugAdapterProtocol::get_singleton()->get_current_peer()->columnsStartAt1;
+
+ Array arr;
+ DebugAdapterProtocol *dap = DebugAdapterProtocol::get_singleton();
+ for (Map<DAP::StackFrame, List<int>>::Element *E = dap->stackframe_list.front(); E; E = E->next()) {
+ DAP::StackFrame sf = E->key();
+ if (!lines_at_one) {
+ sf.line--;
+ }
+ if (!columns_at_one) {
+ sf.column--;
+ }
+
+ arr.push_back(sf.to_json());
+ }
+
+ body["stackFrames"] = arr;
+ return response;
+}
+
+Dictionary DebugAdapterParser::req_setBreakpoints(const Dictionary &p_params) {
+ Dictionary response = prepare_success_response(p_params), body;
+ response["body"] = body;
+
+ Dictionary args = p_params["arguments"];
+ DAP::Source source;
+ source.from_json(args["source"]);
+
+ bool lines_at_one = DebugAdapterProtocol::get_singleton()->get_current_peer()->linesStartAt1;
+
+ if (!is_valid_path(source.path)) {
+ Dictionary variables;
+ variables["clientPath"] = source.path;
+ variables["editorPath"] = ProjectSettings::get_singleton()->get_resource_path();
+ return prepare_error_response(p_params, DAP::ErrorType::WRONG_PATH, variables);
+ }
+
+ Array breakpoints = args["breakpoints"], lines;
+ for (int i = 0; i < breakpoints.size(); i++) {
+ DAP::SourceBreakpoint breakpoint;
+ breakpoint.from_json(breakpoints[i]);
+
+ lines.push_back(breakpoint.line + !lines_at_one);
+ }
+
+ EditorDebuggerNode::get_singleton()->set_breakpoints(ProjectSettings::get_singleton()->localize_path(source.path), lines);
+ Array updated_breakpoints = DebugAdapterProtocol::get_singleton()->update_breakpoints(source.path, lines);
+ body["breakpoints"] = updated_breakpoints;
+
+ return response;
+}
+
+Dictionary DebugAdapterParser::req_scopes(const Dictionary &p_params) {
+ Dictionary response = prepare_success_response(p_params), body;
+ response["body"] = body;
+
+ Dictionary args = p_params["arguments"];
+ int frame_id = args["frameId"];
+ Array scope_list;
+
+ DAP::StackFrame frame;
+ frame.id = frame_id;
+ Map<DAP::StackFrame, List<int>>::Element *E = DebugAdapterProtocol::get_singleton()->stackframe_list.find(frame);
+ if (E) {
+ ERR_FAIL_COND_V(E->value().size() != 3, prepare_error_response(p_params, DAP::ErrorType::UNKNOWN));
+ for (int i = 0; i < 3; i++) {
+ DAP::Scope scope;
+ scope.variablesReference = E->value()[i];
+ switch (i) {
+ case 0:
+ scope.name = "Locals";
+ scope.presentationHint = "locals";
+ break;
+ case 1:
+ scope.name = "Members";
+ scope.presentationHint = "members";
+ break;
+ case 2:
+ scope.name = "Globals";
+ scope.presentationHint = "globals";
+ }
+
+ scope_list.push_back(scope.to_json());
+ }
+ }
+
+ EditorDebuggerNode::get_singleton()->get_default_debugger()->request_stack_dump(frame_id);
+ DebugAdapterProtocol::get_singleton()->_current_frame = frame_id;
+
+ body["scopes"] = scope_list;
+ return response;
+}
+
+Dictionary DebugAdapterParser::req_variables(const Dictionary &p_params) const {
+ // If _remaining_vars > 0, the debugee is still sending a stack dump to the editor.
+ if (DebugAdapterProtocol::get_singleton()->_remaining_vars > 0) {
+ return Dictionary();
+ }
+
+ Dictionary response = prepare_success_response(p_params), body;
+ response["body"] = body;
+
+ Dictionary args = p_params["arguments"];
+ int variable_id = args["variablesReference"];
+
+ Map<int, Array>::Element *E = DebugAdapterProtocol::get_singleton()->variable_list.find(variable_id);
+ if (E) {
+ body["variables"] = E ? E->value() : Array();
+ return response;
+ } else {
+ return Dictionary();
+ }
+}
+
+Dictionary DebugAdapterParser::req_next(const Dictionary &p_params) const {
+ EditorDebuggerNode::get_singleton()->get_default_debugger()->debug_next();
+ DebugAdapterProtocol::get_singleton()->_stepping = true;
+
+ return prepare_success_response(p_params);
+}
+
+Dictionary DebugAdapterParser::req_stepIn(const Dictionary &p_params) const {
+ EditorDebuggerNode::get_singleton()->get_default_debugger()->debug_step();
+ DebugAdapterProtocol::get_singleton()->_stepping = true;
+
+ return prepare_success_response(p_params);
+}
+
+Dictionary DebugAdapterParser::ev_initialized() const {
+ Dictionary event = prepare_base_event();
+ event["event"] = "initialized";
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_process(const String &p_command) const {
+ Dictionary event = prepare_base_event(), body;
+ event["event"] = "process";
+ event["body"] = body;
+
+ body["name"] = OS::get_singleton()->get_executable_path();
+ body["startMethod"] = p_command;
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_terminated() const {
+ Dictionary event = prepare_base_event();
+ event["event"] = "terminated";
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_exited(const int &p_exitcode) const {
+ Dictionary event = prepare_base_event(), body;
+ event["event"] = "exited";
+ event["body"] = body;
+
+ body["exitCode"] = p_exitcode;
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_stopped() const {
+ Dictionary event = prepare_base_event(), body;
+ event["event"] = "stopped";
+ event["body"] = body;
+
+ body["threadId"] = 1;
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_stopped_paused() const {
+ Dictionary event = ev_stopped();
+ Dictionary body = event["body"];
+
+ body["reason"] = "paused";
+ body["description"] = "Paused";
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_stopped_exception(const String &p_error) const {
+ Dictionary event = ev_stopped();
+ Dictionary body = event["body"];
+
+ body["reason"] = "exception";
+ body["description"] = "Exception";
+ body["text"] = p_error;
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_stopped_breakpoint(const int &p_id) const {
+ Dictionary event = ev_stopped();
+ Dictionary body = event["body"];
+
+ body["reason"] = "breakpoint";
+ body["description"] = "Breakpoint";
+
+ Array breakpoints;
+ breakpoints.push_back(p_id);
+ body["hitBreakpointIds"] = breakpoints;
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_stopped_step() const {
+ Dictionary event = ev_stopped();
+ Dictionary body = event["body"];
+
+ body["reason"] = "step";
+ body["description"] = "Breakpoint";
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_continued() const {
+ Dictionary event = prepare_base_event(), body;
+ event["event"] = "continued";
+ event["body"] = body;
+
+ body["threadId"] = 1;
+
+ return event;
+}
+
+Dictionary DebugAdapterParser::ev_output(const String &p_message) const {
+ Dictionary event = prepare_base_event(), body;
+ event["event"] = "output";
+ event["body"] = body;
+
+ body["category"] = "stdout";
+ body["output"] = p_message + "\r\n";
+
+ return event;
+}
diff --git a/editor/debugger/debug_adapter/debug_adapter_parser.h b/editor/debugger/debug_adapter/debug_adapter_parser.h
new file mode 100644
index 0000000000..b86b37d067
--- /dev/null
+++ b/editor/debugger/debug_adapter/debug_adapter_parser.h
@@ -0,0 +1,88 @@
+/*************************************************************************/
+/* debug_adapter_parser.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef DEBUG_ADAPTER_PARSER_H
+#define DEBUG_ADAPTER_PARSER_H
+
+#include "core/config/project_settings.h"
+#include "debug_adapter_protocol.h"
+#include "debug_adapter_types.h"
+
+struct DAPeer;
+class DebugAdapterProtocol;
+
+class DebugAdapterParser : public Object {
+ GDCLASS(DebugAdapterParser, Object);
+
+private:
+ friend DebugAdapterProtocol;
+
+ _FORCE_INLINE_ bool is_valid_path(const String &p_path) {
+ return p_path.begins_with(ProjectSettings::get_singleton()->get_resource_path());
+ }
+
+protected:
+ static void _bind_methods();
+
+ Dictionary prepare_base_event() const;
+ Dictionary prepare_success_response(const Dictionary &p_params) const;
+ Dictionary prepare_error_response(const Dictionary &p_params, DAP::ErrorType err_type, const Dictionary &variables = Dictionary()) const;
+
+ Dictionary ev_stopped() const;
+
+public:
+ // Requests
+ Dictionary req_initialize(const Dictionary &p_params) const;
+ Dictionary req_launch(const Dictionary &p_params);
+ Dictionary req_terminate(const Dictionary &p_params) const;
+ Dictionary req_pause(const Dictionary &p_params) const;
+ Dictionary req_continue(const Dictionary &p_params) const;
+ Dictionary req_threads(const Dictionary &p_params) const;
+ Dictionary req_stackTrace(const Dictionary &p_params) const;
+ Dictionary req_setBreakpoints(const Dictionary &p_params);
+ Dictionary req_scopes(const Dictionary &p_params);
+ Dictionary req_variables(const Dictionary &p_params) const;
+ Dictionary req_next(const Dictionary &p_params) const;
+ Dictionary req_stepIn(const Dictionary &p_params) const;
+
+ // Events
+ Dictionary ev_initialized() const;
+ Dictionary ev_process(const String &p_command) const;
+ Dictionary ev_terminated() const;
+ Dictionary ev_exited(const int &p_exitcode) const;
+ Dictionary ev_stopped_paused() const;
+ Dictionary ev_stopped_exception(const String &p_error) const;
+ Dictionary ev_stopped_breakpoint(const int &p_id) const;
+ Dictionary ev_stopped_step() const;
+ Dictionary ev_continued() const;
+ Dictionary ev_output(const String &p_message) const;
+};
+
+#endif
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
new file mode 100644
index 0000000000..0482271432
--- /dev/null
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
@@ -0,0 +1,497 @@
+/*************************************************************************/
+/* debug_adapter_protocol.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "debug_adapter_protocol.h"
+
+#include "core/config/project_settings.h"
+#include "core/debugger/debugger_marshalls.h"
+#include "core/io/json.h"
+#include "editor/debugger/script_editor_debugger.h"
+#include "editor/doc_tools.h"
+#include "editor/editor_log.h"
+#include "editor/editor_node.h"
+
+DebugAdapterProtocol *DebugAdapterProtocol::singleton = nullptr;
+
+Error DAPeer::handle_data() {
+ int read = 0;
+ // Read headers
+ if (!has_header) {
+ if (!connection->get_available_bytes()) {
+ return OK;
+ }
+ while (true) {
+ if (req_pos >= DAP_MAX_BUFFER_SIZE) {
+ req_pos = 0;
+ ERR_FAIL_COND_V_MSG(true, ERR_OUT_OF_MEMORY, "Response header too big");
+ }
+ Error err = connection->get_partial_data(&req_buf[req_pos], 1, read);
+ if (err != OK) {
+ return FAILED;
+ } else if (read != 1) { // Busy, wait until next poll
+ return ERR_BUSY;
+ }
+ char *r = (char *)req_buf;
+ int l = req_pos;
+
+ // End of headers
+ if (l > 3 && r[l] == '\n' && r[l - 1] == '\r' && r[l - 2] == '\n' && r[l - 3] == '\r') {
+ r[l - 3] = '\0'; // Null terminate to read string
+ String header;
+ header.parse_utf8(r);
+ content_length = header.substr(16).to_int();
+ has_header = true;
+ req_pos = 0;
+ break;
+ }
+ req_pos++;
+ }
+ }
+ if (has_header) {
+ while (req_pos < content_length) {
+ if (content_length >= DAP_MAX_BUFFER_SIZE) {
+ req_pos = 0;
+ has_header = false;
+ ERR_FAIL_COND_V_MSG(req_pos >= DAP_MAX_BUFFER_SIZE, ERR_OUT_OF_MEMORY, "Response content too big");
+ }
+ Error err = connection->get_partial_data(&req_buf[req_pos], content_length - req_pos, read);
+ if (err != OK) {
+ return FAILED;
+ } else if (read < content_length - req_pos) {
+ return ERR_BUSY;
+ }
+ req_pos += read;
+ }
+
+ // Parse data
+ String msg;
+ msg.parse_utf8((const char *)req_buf, req_pos);
+
+ // Response
+ if (DebugAdapterProtocol::get_singleton()->process_message(msg)) {
+ // Reset to read again
+ req_pos = 0;
+ has_header = false;
+ }
+ }
+ return OK;
+}
+
+Error DAPeer::send_data() {
+ while (res_queue.size()) {
+ Dictionary data = res_queue.front()->get();
+ if (!data.has("seq")) {
+ data["seq"] = ++seq;
+ }
+ String formatted_data = format_output(data);
+
+ int data_sent = 0;
+ while (data_sent < formatted_data.length()) {
+ int curr_sent = 0;
+ Error err = connection->put_partial_data((const uint8_t *)formatted_data.utf8().get_data(), formatted_data.size() - data_sent - 1, curr_sent);
+ if (err != OK) {
+ return err;
+ }
+ data_sent += curr_sent;
+ }
+ res_queue.pop_front();
+ }
+ return OK;
+}
+
+String DAPeer::format_output(const Dictionary &p_params) const {
+ String response = Variant(p_params).to_json_string();
+ String header = "Content-Length: ";
+ CharString charstr = response.utf8();
+ size_t len = charstr.length();
+ header += itos(len);
+ header += "\r\n\r\n";
+
+ return header + response;
+}
+
+Error DebugAdapterProtocol::on_client_connected() {
+ ERR_FAIL_COND_V_MSG(clients.size() >= DAP_MAX_CLIENTS, FAILED, "Max client limits reached");
+
+ Ref<StreamPeerTCP> tcp_peer = server->take_connection();
+ tcp_peer->set_no_delay(true);
+ Ref<DAPeer> peer = memnew(DAPeer);
+ peer->connection = tcp_peer;
+ clients.push_back(peer);
+
+ EditorDebuggerNode::get_singleton()->get_default_debugger()->set_move_to_foreground(false);
+ EditorNode::get_log()->add_message("[DAP] Connection Taken", EditorLog::MSG_TYPE_EDITOR);
+ return OK;
+}
+
+void DebugAdapterProtocol::on_client_disconnected(const Ref<DAPeer> &p_peer) {
+ clients.erase(p_peer);
+ if (!clients.size()) {
+ reset_ids();
+ EditorDebuggerNode::get_singleton()->get_default_debugger()->set_move_to_foreground(true);
+ }
+ EditorNode::get_log()->add_message("[DAP] Disconnected", EditorLog::MSG_TYPE_EDITOR);
+}
+
+void DebugAdapterProtocol::reset_current_info() {
+ _current_request = "";
+ _current_peer.unref();
+}
+
+void DebugAdapterProtocol::reset_ids() {
+ breakpoint_id = 0;
+ breakpoint_list.clear();
+
+ reset_stack_info();
+}
+
+void DebugAdapterProtocol::reset_stack_info() {
+ stackframe_id = 0;
+ variable_id = 1;
+
+ stackframe_list.clear();
+ variable_list.clear();
+}
+
+bool DebugAdapterProtocol::process_message(const String &p_text) {
+ JSON json;
+ ERR_FAIL_COND_V_MSG(json.parse(p_text) != OK, true, "Mal-formed message!");
+ Dictionary params = json.get_data();
+ bool completed = true;
+
+ // Append "req_" to any command received; prevents name clash with existing functions, and possibly exploiting
+ String command = "req_" + (String)params["command"];
+ if (parser->has_method(command)) {
+ _current_request = params["command"];
+
+ Array args;
+ args.push_back(params);
+ Dictionary response = parser->callv(command, args);
+ if (!response.is_empty()) {
+ _current_peer->res_queue.push_front(response);
+ } else {
+ completed = false;
+ }
+ }
+
+ reset_current_info();
+ return completed;
+}
+
+void DebugAdapterProtocol::notify_initialized() {
+ Dictionary event = parser->ev_initialized();
+ _current_peer->res_queue.push_back(event);
+}
+
+void DebugAdapterProtocol::notify_process() {
+ String launch_mode = _current_request.is_empty() ? "launch" : _current_request;
+
+ Dictionary event = parser->ev_process(launch_mode);
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+void DebugAdapterProtocol::notify_terminated() {
+ Dictionary event = parser->ev_terminated();
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ if (_current_request == "launch" && _current_peer == E->get()) {
+ continue;
+ }
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+void DebugAdapterProtocol::notify_exited(const int &p_exitcode) {
+ Dictionary event = parser->ev_exited(p_exitcode);
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ if (_current_request == "launch" && _current_peer == E->get()) {
+ continue;
+ }
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+void DebugAdapterProtocol::notify_stopped_paused() {
+ Dictionary event = parser->ev_stopped_paused();
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+void DebugAdapterProtocol::notify_stopped_exception(const String &p_error) {
+ Dictionary event = parser->ev_stopped_exception(p_error);
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+void DebugAdapterProtocol::notify_stopped_breakpoint(const int &p_id) {
+ Dictionary event = parser->ev_stopped_breakpoint(p_id);
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+void DebugAdapterProtocol::notify_stopped_step() {
+ Dictionary event = parser->ev_stopped_step();
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+void DebugAdapterProtocol::notify_continued() {
+ Dictionary event = parser->ev_continued();
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ if (_current_request == "continue" && E->get() == _current_peer) {
+ continue;
+ }
+ E->get()->res_queue.push_back(event);
+ }
+
+ reset_stack_info();
+}
+
+void DebugAdapterProtocol::notify_output(const String &p_message) {
+ Dictionary event = parser->ev_output(p_message);
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ E->get()->res_queue.push_back(event);
+ }
+}
+
+Array DebugAdapterProtocol::update_breakpoints(const String &p_path, const Array &p_lines) {
+ Array updated_breakpoints;
+
+ for (int i = 0; i < p_lines.size(); i++) {
+ DAP::Breakpoint breakpoint;
+ breakpoint.verified = true;
+ breakpoint.source.path = p_path;
+ breakpoint.source.compute_checksums();
+ breakpoint.line = p_lines[i];
+
+ List<DAP::Breakpoint>::Element *E = breakpoint_list.find(breakpoint);
+ if (E) {
+ breakpoint.id = E->get().id;
+ } else {
+ breakpoint.id = breakpoint_id++;
+ breakpoint_list.push_back(breakpoint);
+ }
+
+ updated_breakpoints.push_back(breakpoint.to_json());
+ }
+
+ return updated_breakpoints;
+}
+
+void DebugAdapterProtocol::on_debug_paused() {
+ if (EditorNode::get_singleton()->get_pause_button()->is_pressed()) {
+ notify_stopped_paused();
+ } else {
+ notify_continued();
+ }
+}
+
+void DebugAdapterProtocol::on_debug_stopped() {
+ notify_exited();
+ notify_terminated();
+}
+
+void DebugAdapterProtocol::on_debug_output(const String &p_message) {
+ notify_output(p_message);
+}
+
+void DebugAdapterProtocol::on_debug_breaked(const bool &p_reallydid, const bool &p_can_debug, const String &p_reason, const bool &p_has_stackdump) {
+ if (!p_reallydid) {
+ notify_continued();
+ return;
+ }
+
+ if (p_reason == "Breakpoint") {
+ if (_stepping) {
+ notify_stopped_step();
+ _stepping = false;
+ } else {
+ _processing_breakpoint = true; // Wait for stack_dump to find where the breakpoint happened
+ }
+ } else {
+ notify_stopped_exception(p_reason);
+ }
+
+ _processing_stackdump = p_has_stackdump;
+}
+
+void DebugAdapterProtocol::on_debug_stack_dump(const Array &p_stack_dump) {
+ if (_processing_breakpoint && !p_stack_dump.is_empty()) {
+ // Find existing breakpoint
+ Dictionary d = p_stack_dump[0];
+ DAP::Breakpoint breakpoint;
+ breakpoint.source.path = ProjectSettings::get_singleton()->globalize_path(d["file"]);
+ breakpoint.line = d["line"];
+
+ List<DAP::Breakpoint>::Element *E = breakpoint_list.find(breakpoint);
+ if (E) {
+ notify_stopped_breakpoint(E->get().id);
+ }
+
+ _processing_breakpoint = false;
+ }
+
+ stackframe_id = 0;
+ stackframe_list.clear();
+
+ // Fill in stacktrace information
+ for (int i = 0; i < p_stack_dump.size(); i++) {
+ Dictionary stack_info = p_stack_dump[i];
+ DAP::StackFrame stackframe;
+ stackframe.id = stackframe_id++;
+ stackframe.name = stack_info["function"];
+ stackframe.line = stack_info["line"];
+ stackframe.column = 0;
+ stackframe.source.path = ProjectSettings::get_singleton()->globalize_path(stack_info["file"]);
+ stackframe.source.compute_checksums();
+
+ // Information for "Locals", "Members" and "Globals" variables respectively
+ List<int> scope_ids;
+ for (int j = 0; j < 3; j++) {
+ scope_ids.push_back(variable_id++);
+ }
+
+ stackframe_list.insert(stackframe, scope_ids);
+ }
+
+ _current_frame = 0;
+ _processing_stackdump = false;
+}
+
+void DebugAdapterProtocol::on_debug_stack_frame_vars(const int &p_size) {
+ _remaining_vars = p_size;
+ DAP::StackFrame frame;
+ frame.id = _current_frame;
+ ERR_FAIL_COND(!stackframe_list.has(frame));
+ List<int> scope_ids = stackframe_list.find(frame)->value();
+ for (List<int>::Element *E = scope_ids.front(); E; E = E->next()) {
+ int variable_id = E->get();
+ if (variable_list.has(variable_id)) {
+ variable_list.find(variable_id)->value().clear();
+ } else {
+ variable_list.insert(variable_id, Array());
+ }
+ }
+}
+
+void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) {
+ DebuggerMarshalls::ScriptStackVariable stack_var;
+ stack_var.deserialize(p_data);
+
+ ERR_FAIL_COND(stackframe_list.is_empty());
+ DAP::StackFrame frame;
+ frame.id = _current_frame;
+
+ List<int> scope_ids = stackframe_list.find(frame)->value();
+ ERR_FAIL_COND(scope_ids.size() != 3);
+ ERR_FAIL_INDEX(stack_var.type, 3);
+ int variable_id = scope_ids[stack_var.type];
+
+ DAP::Variable variable;
+
+ variable.name = stack_var.name;
+ variable.value = stack_var.value;
+ variable.type = Variant::get_type_name(stack_var.value.get_type());
+
+ variable_list.find(variable_id)->value().push_back(variable.to_json());
+ _remaining_vars--;
+}
+
+void DebugAdapterProtocol::poll() {
+ if (server->is_connection_available()) {
+ on_client_connected();
+ }
+ List<Ref<DAPeer>> to_delete;
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ Ref<DAPeer> peer = E->get();
+ StreamPeerTCP::Status status = peer->connection->get_status();
+ if (status == StreamPeerTCP::STATUS_NONE || status == StreamPeerTCP::STATUS_ERROR) {
+ to_delete.push_back(peer);
+ } else {
+ _current_peer = peer;
+ Error err = peer->handle_data();
+ if (err != OK && err != ERR_BUSY) {
+ to_delete.push_back(peer);
+ }
+ err = peer->send_data();
+ if (err != OK && err != ERR_BUSY) {
+ to_delete.push_back(peer);
+ }
+ }
+ }
+
+ for (List<Ref<DAPeer>>::Element *E = to_delete.front(); E; E = E->next()) {
+ on_client_disconnected(E->get());
+ }
+ to_delete.clear();
+}
+
+Error DebugAdapterProtocol::start(int p_port, const IPAddress &p_bind_ip) {
+ _initialized = true;
+ return server->listen(p_port, p_bind_ip);
+}
+
+void DebugAdapterProtocol::stop() {
+ for (List<Ref<DAPeer>>::Element *E = clients.front(); E; E = E->next()) {
+ E->get()->connection->disconnect_from_host();
+ }
+
+ clients.clear();
+ server->stop();
+ _initialized = false;
+}
+
+DebugAdapterProtocol::DebugAdapterProtocol() {
+ server.instantiate();
+ singleton = this;
+ parser = memnew(DebugAdapterParser);
+
+ reset_ids();
+
+ EditorNode *node = EditorNode::get_singleton();
+ node->get_pause_button()->connect("pressed", callable_mp(this, &DebugAdapterProtocol::on_debug_paused));
+
+ EditorDebuggerNode *debugger_node = EditorDebuggerNode::get_singleton();
+ debugger_node->get_default_debugger()->connect("stopped", callable_mp(this, &DebugAdapterProtocol::on_debug_stopped));
+ debugger_node->get_default_debugger()->connect("output", callable_mp(this, &DebugAdapterProtocol::on_debug_output));
+ debugger_node->get_default_debugger()->connect("breaked", callable_mp(this, &DebugAdapterProtocol::on_debug_breaked));
+ debugger_node->get_default_debugger()->connect("stack_dump", callable_mp(this, &DebugAdapterProtocol::on_debug_stack_dump));
+ debugger_node->get_default_debugger()->connect("stack_frame_vars", callable_mp(this, &DebugAdapterProtocol::on_debug_stack_frame_vars));
+ debugger_node->get_default_debugger()->connect("stack_frame_var", callable_mp(this, &DebugAdapterProtocol::on_debug_stack_frame_var));
+}
+
+DebugAdapterProtocol::~DebugAdapterProtocol() {
+ memdelete(parser);
+}
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.h b/editor/debugger/debug_adapter/debug_adapter_protocol.h
new file mode 100644
index 0000000000..6b542033ed
--- /dev/null
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.h
@@ -0,0 +1,140 @@
+/*************************************************************************/
+/* debug_adapter_protocol.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef DEBUG_ADAPTER_PROTOCOL_H
+#define DEBUG_ADAPTER_PROTOCOL_H
+
+#include "core/io/stream_peer.h"
+#include "core/io/stream_peer_tcp.h"
+#include "core/io/tcp_server.h"
+
+#include "debug_adapter_parser.h"
+#include "debug_adapter_types.h"
+
+#define DAP_MAX_BUFFER_SIZE 4194304 // 4MB
+#define DAP_MAX_CLIENTS 8
+
+class DebugAdapterParser;
+
+struct DAPeer : RefCounted {
+ Ref<StreamPeerTCP> connection;
+
+ uint8_t req_buf[DAP_MAX_BUFFER_SIZE];
+ int req_pos = 0;
+ bool has_header = false;
+ int content_length = 0;
+ List<Dictionary> res_queue;
+ int seq = 0;
+
+ // Client specific info
+ bool linesStartAt1 = false;
+ bool columnsStartAt1 = false;
+ bool supportsVariableType = false;
+ bool supportsInvalidatedEvent = false;
+
+ Error handle_data();
+ Error send_data();
+ String format_output(const Dictionary &p_params) const;
+};
+
+class DebugAdapterProtocol : public Object {
+ GDCLASS(DebugAdapterProtocol, Object)
+
+ friend class DebugAdapterParser;
+
+private:
+ static DebugAdapterProtocol *singleton;
+ DebugAdapterParser *parser;
+
+ List<Ref<DAPeer>> clients;
+ Ref<TCPServer> server;
+
+ Error on_client_connected();
+ void on_client_disconnected(const Ref<DAPeer> &p_peer);
+ void on_debug_paused();
+ void on_debug_stopped();
+ void on_debug_output(const String &p_message);
+ void on_debug_breaked(const bool &p_reallydid, const bool &p_can_debug, const String &p_reason, const bool &p_has_stackdump);
+ void on_debug_stack_dump(const Array &p_stack_dump);
+ void on_debug_stack_frame_vars(const int &p_size);
+ void on_debug_stack_frame_var(const Array &p_data);
+
+ void reset_current_info();
+ void reset_ids();
+ void reset_stack_info();
+
+ bool _initialized = false;
+ bool _processing_breakpoint = false;
+ bool _stepping = false;
+ bool _processing_stackdump = false;
+ int _remaining_vars = 0;
+ int _current_frame = 0;
+
+ String _current_request;
+ Ref<DAPeer> _current_peer;
+
+ int breakpoint_id;
+ int stackframe_id;
+ int variable_id;
+ List<DAP::Breakpoint> breakpoint_list;
+ Map<DAP::StackFrame, List<int>> stackframe_list;
+ Map<int, Array> variable_list;
+
+public:
+ _FORCE_INLINE_ static DebugAdapterProtocol *get_singleton() { return singleton; }
+ _FORCE_INLINE_ bool is_active() const { return _initialized && clients.size() > 0; }
+
+ bool process_message(const String &p_text);
+
+ String get_current_request() const { return _current_request; }
+ Ref<DAPeer> get_current_peer() const { return _current_peer; }
+
+ void notify_initialized();
+ void notify_process();
+ void notify_terminated();
+ void notify_exited(const int &p_exitcode = 0);
+ void notify_stopped_paused();
+ void notify_stopped_exception(const String &p_error);
+ void notify_stopped_breakpoint(const int &p_id);
+ void notify_stopped_step();
+ void notify_continued();
+ void notify_output(const String &p_message);
+
+ Array update_breakpoints(const String &p_path, const Array &p_breakpoints);
+
+ void poll();
+ Error start(int p_port, const IPAddress &p_bind_ip);
+ void stop();
+
+ DebugAdapterProtocol();
+ ~DebugAdapterProtocol();
+};
+
+#endif
diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp
new file mode 100644
index 0000000000..f9092a1791
--- /dev/null
+++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp
@@ -0,0 +1,102 @@
+/*************************************************************************/
+/* debug_adapter_server.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "debug_adapter_server.h"
+
+#include "core/os/os.h"
+#include "editor/editor_log.h"
+#include "editor/editor_node.h"
+
+DebugAdapterServer::DebugAdapterServer() {
+ _EDITOR_DEF("network/debug_adapter/remote_port", remote_port);
+ _EDITOR_DEF("network/debug_adapter/use_thread", use_thread);
+}
+
+void DebugAdapterServer::_notification(int p_what) {
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ start();
+ break;
+ case NOTIFICATION_EXIT_TREE:
+ stop();
+ break;
+ case NOTIFICATION_INTERNAL_PROCESS: {
+ // The main loop can be run again during request processing, which modifies internal state of the protocol.
+ // Thus, "polling" is needed to prevent it from parsing other requests while the current one isn't finished.
+ if (started && !use_thread && !polling) {
+ polling = true;
+ protocol.poll();
+ polling = false;
+ }
+ } break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ int remote_port = (int)_EDITOR_GET("network/debug_adapter/remote_port");
+ bool use_thread = (bool)_EDITOR_GET("network/debug_adapter/use_thread");
+ if (remote_port != this->remote_port || use_thread != this->use_thread) {
+ this->stop();
+ this->start();
+ }
+ } break;
+ }
+}
+
+void DebugAdapterServer::thread_func(void *p_userdata) {
+ DebugAdapterServer *self = static_cast<DebugAdapterServer *>(p_userdata);
+ while (self->thread_running) {
+ // Poll 20 times per second
+ self->protocol.poll();
+ OS::get_singleton()->delay_usec(50000);
+ }
+}
+
+void DebugAdapterServer::start() {
+ remote_port = (int)_EDITOR_GET("network/debug_adapter/remote_port");
+ use_thread = (bool)_EDITOR_GET("network/debug_adapter/use_thread");
+ if (protocol.start(remote_port, IPAddress("127.0.0.1")) == OK) {
+ EditorNode::get_log()->add_message("--- Debug adapter server started ---", EditorLog::MSG_TYPE_EDITOR);
+ if (use_thread) {
+ thread_running = true;
+ thread.start(DebugAdapterServer::thread_func, this);
+ }
+ set_process_internal(!use_thread);
+ started = true;
+ }
+}
+
+void DebugAdapterServer::stop() {
+ if (use_thread) {
+ ERR_FAIL_COND(!thread.is_started());
+ thread_running = false;
+ thread.wait_to_finish();
+ }
+ protocol.stop();
+ started = false;
+ EditorNode::get_log()->add_message("--- Debug adapter server stopped ---", EditorLog::MSG_TYPE_EDITOR);
+}
diff --git a/editor/debugger/debug_adapter/debug_adapter_server.h b/editor/debugger/debug_adapter/debug_adapter_server.h
new file mode 100644
index 0000000000..f8a38965cc
--- /dev/null
+++ b/editor/debugger/debug_adapter/debug_adapter_server.h
@@ -0,0 +1,59 @@
+/*************************************************************************/
+/* debug_adapter_server.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef DEBUG_ADAPTER_SERVER_H
+#define DEBUG_ADAPTER_SERVER_H
+
+#include "debug_adapter_protocol.h"
+#include "editor/editor_plugin.h"
+
+class DebugAdapterServer : public EditorPlugin {
+ GDCLASS(DebugAdapterServer, EditorPlugin);
+
+ DebugAdapterProtocol protocol;
+
+ Thread thread;
+ int remote_port = 6006;
+ bool thread_running = false;
+ bool started = false;
+ bool use_thread = false;
+ bool polling = false;
+ static void thread_func(void *p_userdata);
+
+private:
+ void _notification(int p_what);
+
+public:
+ DebugAdapterServer();
+ void start();
+ void stop();
+};
+
+#endif
diff --git a/editor/debugger/debug_adapter/debug_adapter_types.h b/editor/debugger/debug_adapter/debug_adapter_types.h
new file mode 100644
index 0000000000..aa9ab1adcd
--- /dev/null
+++ b/editor/debugger/debug_adapter/debug_adapter_types.h
@@ -0,0 +1,270 @@
+/*************************************************************************/
+/* debug_adapter_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef DEBUG_ADAPTER_TYPES_H
+#define DEBUG_ADAPTER_TYPES_H
+
+#include "core/io/json.h"
+#include "core/variant/dictionary.h"
+
+namespace DAP {
+
+enum ErrorType {
+ UNKNOWN,
+ WRONG_PATH
+};
+
+struct Checksum {
+ String algorithm;
+ String checksum;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["algorithm"] = algorithm;
+ dict["checksum"] = checksum;
+
+ return dict;
+ }
+};
+
+struct Source {
+private:
+ Array _checksums;
+
+public:
+ String name;
+ String path;
+
+ void compute_checksums() {
+ ERR_FAIL_COND(path.is_empty());
+
+ // MD5
+ Checksum md5;
+ md5.algorithm = "MD5";
+ md5.checksum = FileAccess::get_md5(path);
+
+ // SHA-256
+ Checksum sha256;
+ sha256.algorithm = "SHA256";
+ sha256.checksum = FileAccess::get_sha256(path);
+
+ _checksums.push_back(md5.to_json());
+ _checksums.push_back(sha256.to_json());
+ }
+
+ _FORCE_INLINE_ void from_json(const Dictionary &p_params) {
+ name = p_params["name"];
+ path = p_params["path"];
+ _checksums = p_params["checksums"];
+ }
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["name"] = name;
+ dict["path"] = path;
+ dict["checksums"] = _checksums;
+
+ return dict;
+ }
+};
+
+struct Breakpoint {
+ int id;
+ bool verified;
+ Source source;
+ int line;
+
+ bool operator==(const Breakpoint &p_other) const {
+ return source.path == p_other.source.path && line == p_other.line;
+ }
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["id"] = id;
+ dict["verified"] = verified;
+ dict["source"] = source.to_json();
+ dict["line"] = line;
+
+ return dict;
+ }
+};
+
+struct BreakpointLocation {
+ int line;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["line"] = line;
+
+ return dict;
+ }
+};
+
+struct Capabilities {
+ bool supportsConfigurationDoneRequest = true;
+ bool supportsEvaluateForHovers = true;
+ bool supportsSetVariable = true;
+ String supportedChecksumAlgorithms[2] = { "MD5", "SHA256" };
+ bool supportsRestartRequest = true;
+ bool supportsValueFormattingOptions = true;
+ bool supportTerminateDebuggee = true;
+ bool supportSuspendDebuggee = true;
+ bool supportsTerminateRequest = true;
+ bool supportsBreakpointLocationsRequest = true;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["supportsConfigurationDoneRequest"] = supportsConfigurationDoneRequest;
+ dict["supportsEvaluateForHovers"] = supportsEvaluateForHovers;
+ dict["supportsSetVariable"] = supportsSetVariable;
+ dict["supportsRestartRequest"] = supportsRestartRequest;
+ dict["supportsValueFormattingOptions"] = supportsValueFormattingOptions;
+ dict["supportTerminateDebuggee"] = supportTerminateDebuggee;
+ dict["supportSuspendDebuggee"] = supportSuspendDebuggee;
+ dict["supportsTerminateRequest"] = supportsTerminateRequest;
+ dict["supportsBreakpointLocationsRequest"] = supportsBreakpointLocationsRequest;
+
+ Array arr;
+ arr.push_back(supportedChecksumAlgorithms[0]);
+ arr.push_back(supportedChecksumAlgorithms[1]);
+ dict["supportedChecksumAlgorithms"] = arr;
+
+ return dict;
+ }
+};
+
+struct Message {
+ int id;
+ String format;
+ bool sendTelemetry = false; // Just in case :)
+ bool showUser;
+ Dictionary variables;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["id"] = id;
+ dict["format"] = format;
+ dict["sendTelemetry"] = sendTelemetry;
+ dict["showUser"] = showUser;
+ dict["variables"] = variables;
+
+ return dict;
+ }
+};
+
+struct Scope {
+ String name;
+ String presentationHint;
+ int variablesReference;
+ bool expensive;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["name"] = name;
+ dict["presentationHint"] = presentationHint;
+ dict["variablesReference"] = variablesReference;
+ dict["expensive"] = expensive;
+
+ return dict;
+ }
+};
+
+struct SourceBreakpoint {
+ int line;
+
+ _FORCE_INLINE_ void from_json(const Dictionary &p_params) {
+ line = p_params["line"];
+ }
+};
+
+struct StackFrame {
+ int id;
+ String name;
+ Source source;
+ int line;
+ int column;
+
+ bool operator<(const StackFrame &p_other) const {
+ return id < p_other.id;
+ }
+
+ _FORCE_INLINE_ void from_json(const Dictionary &p_params) {
+ id = p_params["id"];
+ name = p_params["name"];
+ source.from_json(p_params["source"]);
+ line = p_params["line"];
+ column = p_params["column"];
+ }
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["id"] = id;
+ dict["name"] = name;
+ dict["source"] = source.to_json();
+ dict["line"] = line;
+ dict["column"] = column;
+
+ return dict;
+ }
+};
+
+struct Thread {
+ int id;
+ String name;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["id"] = id;
+ dict["name"] = name;
+
+ return dict;
+ }
+};
+
+struct Variable {
+ String name;
+ String value;
+ String type;
+ int variablesReference = 0;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+ dict["name"] = name;
+ dict["value"] = value;
+ dict["type"] = type;
+ dict["variablesReference"] = variablesReference;
+
+ return dict;
+ }
+};
+
+} // namespace DAP
+
+#endif
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 690ce98cb9..5d654ca756 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -466,7 +466,7 @@ void EditorDebuggerNode::_paused() {
});
}
-void EditorDebuggerNode::_breaked(bool p_breaked, bool p_can_debug, int p_debugger) {
+void EditorDebuggerNode::_breaked(bool p_breaked, bool p_can_debug, String p_message, bool p_has_stackdump, int p_debugger) {
if (get_current_debugger() != get_debugger(p_debugger)) {
if (!p_breaked) {
return;
@@ -489,6 +489,19 @@ void EditorDebuggerNode::set_breakpoint(const String &p_path, int p_line, bool p
});
}
+void EditorDebuggerNode::set_breakpoints(const String &p_path, Array p_lines) {
+ for (int i = 0; i < p_lines.size(); i++) {
+ set_breakpoint(p_path, p_lines[i], true);
+ }
+
+ for (Map<Breakpoint, bool>::Element *E = breakpoints.front(); E; E = E->next()) {
+ Breakpoint b = E->key();
+ if (b.source == p_path && !p_lines.has(b.line)) {
+ set_breakpoint(p_path, b.line, false);
+ }
+ }
+}
+
void EditorDebuggerNode::reload_scripts() {
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
dbg->reload_scripts();
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 9a40383c17..0849ecf1c9 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -35,6 +35,7 @@
#include "scene/gui/margin_container.h"
class Button;
+class DebugAdapterParser;
class EditorDebuggerTree;
class EditorDebuggerRemoteObject;
class MenuButton;
@@ -109,6 +110,7 @@ private:
EditorDebuggerRemoteObject *get_inspected_remote_object();
friend class DebuggerEditorPlugin;
+ friend class DebugAdapterParser;
static EditorDebuggerNode *singleton;
EditorDebuggerNode();
@@ -129,7 +131,7 @@ protected:
void _text_editor_stack_goto(const ScriptEditorDebugger *p_debugger);
void _stack_frame_selected(int p_debugger);
void _error_selected(const String &p_file, int p_line, int p_debugger);
- void _breaked(bool p_breaked, bool p_can_debug, int p_debugger);
+ void _breaked(bool p_breaked, bool p_can_debug, String p_message, bool p_has_stackdump, int p_debugger);
void _paused();
void _break_state_changed();
void _menu_option(int p_id);
@@ -164,6 +166,7 @@ public:
bool is_skip_breakpoints() const;
void set_breakpoint(const String &p_path, int p_line, bool p_enabled);
+ void set_breakpoints(const String &p_path, Array p_lines);
void reload_scripts();
// Remote inspector/edit.
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 9856fbec74..2a5013893f 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -37,6 +37,7 @@
#include "core/string/ustring.h"
#include "core/version.h"
#include "core/version_hash.gen.h"
+#include "editor/debugger/debug_adapter/debug_adapter_protocol.h"
#include "editor/debugger/editor_network_profiler.h"
#include "editor/debugger/editor_performance_profiler.h"
#include "editor/debugger/editor_profiler.h"
@@ -298,15 +299,18 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
if (p_msg == "debug_enter") {
_put_msg("get_stack_dump", Array());
- ERR_FAIL_COND(p_data.size() != 2);
+ ERR_FAIL_COND(p_data.size() != 3);
bool can_continue = p_data[0];
String error = p_data[1];
+ bool has_stackdump = p_data[2];
breaked = true;
can_debug = can_continue;
_update_buttons_state();
_set_reason_text(error, MESSAGE_ERROR);
- emit_signal(SNAME("breaked"), true, can_continue);
- DisplayServer::get_singleton()->window_move_to_foreground();
+ emit_signal(SNAME("breaked"), true, can_continue, error, has_stackdump);
+ if (is_move_to_foreground()) {
+ DisplayServer::get_singleton()->window_move_to_foreground();
+ }
if (error != "") {
tabs->set_current_tab(0);
}
@@ -319,7 +323,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
_clear_execution();
_update_buttons_state();
_set_reason_text(TTR("Execution resumed."), MESSAGE_SUCCESS);
- emit_signal(SNAME("breaked"), false, false);
+ emit_signal(SNAME("breaked"), false, false, "", false);
profiler->set_enabled(true);
profiler->disable_seeking();
} else if (p_msg == "set_pid") {
@@ -373,6 +377,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
inspector->clear_stack_variables();
TreeItem *r = stack_dump->create_item();
+ Array stack_dump_info;
+
for (int i = 0; i < stack.frames.size(); i++) {
TreeItem *s = stack_dump->create_item(r);
Dictionary d;
@@ -380,6 +386,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
d["file"] = stack.frames[i].file;
d["function"] = stack.frames[i].func;
d["line"] = stack.frames[i].line;
+ stack_dump_info.push_back(d);
s->set_metadata(0, d);
String line = itos(i) + " - " + String(d["file"]) + ":" + itos(d["line"]) + " - at function: " + d["function"];
@@ -389,11 +396,15 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
s->select(0);
}
}
+ emit_signal("stack_dump", stack_dump_info);
} else if (p_msg == "stack_frame_vars") {
inspector->clear_stack_variables();
+ ERR_FAIL_COND(p_data.size() != 1);
+ emit_signal("stack_frame_vars", p_data[0]);
} else if (p_msg == "stack_frame_var") {
inspector->add_stack_variable(p_data);
+ emit_signal("stack_frame_var", p_data);
} else if (p_msg == "output") {
ERR_FAIL_COND(p_data.size() != 2);
@@ -422,6 +433,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
} break;
}
EditorNode::get_log()->add_message(output_strings[i], msg_type);
+ emit_signal("output", output_strings[i]);
}
} else if (p_msg == "performance:profile_frame") {
Vector<float> frame_data;
@@ -963,11 +975,7 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() {
int frame = get_stack_script_frame();
- if (is_session_active() && frame >= 0) {
- Array msg;
- msg.push_back(frame);
- _put_msg("get_stack_frame_vars", msg);
- } else {
+ if (!request_stack_dump(frame)) {
inspector->edit(nullptr);
}
}
@@ -1130,6 +1138,14 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p
}
}
+bool ScriptEditorDebugger::is_move_to_foreground() const {
+ return move_to_foreground;
+}
+
+void ScriptEditorDebugger::set_move_to_foreground(const bool &p_move_to_foreground) {
+ move_to_foreground = p_move_to_foreground;
+}
+
String ScriptEditorDebugger::get_stack_script_file() const {
TreeItem *ti = stack_dump->get_selected();
if (!ti) {
@@ -1157,6 +1173,15 @@ int ScriptEditorDebugger::get_stack_script_frame() const {
return d["frame"];
}
+bool ScriptEditorDebugger::request_stack_dump(const int &p_frame) {
+ ERR_FAIL_COND_V(!is_session_active() || p_frame < 0, false);
+
+ Array msg;
+ msg.push_back(p_frame);
+ _put_msg("get_stack_frame_vars", msg);
+ return true;
+}
+
void ScriptEditorDebugger::set_live_debugging(bool p_enable) {
live_debug = p_enable;
}
@@ -1469,11 +1494,15 @@ void ScriptEditorDebugger::_bind_methods() {
ADD_SIGNAL(MethodInfo("error_selected", PropertyInfo(Variant::INT, "error")));
ADD_SIGNAL(MethodInfo("set_execution", PropertyInfo("script"), PropertyInfo(Variant::INT, "line")));
ADD_SIGNAL(MethodInfo("clear_execution", PropertyInfo("script")));
- ADD_SIGNAL(MethodInfo("breaked", PropertyInfo(Variant::BOOL, "reallydid"), PropertyInfo(Variant::BOOL, "can_debug")));
+ ADD_SIGNAL(MethodInfo("breaked", PropertyInfo(Variant::BOOL, "reallydid"), PropertyInfo(Variant::BOOL, "can_debug"), PropertyInfo(Variant::STRING, "reason"), PropertyInfo(Variant::BOOL, "has_stackdump")));
ADD_SIGNAL(MethodInfo("remote_object_requested", PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("remote_object_updated", PropertyInfo(Variant::INT, "id")));
ADD_SIGNAL(MethodInfo("remote_object_property_updated", PropertyInfo(Variant::INT, "id"), PropertyInfo(Variant::STRING, "property")));
ADD_SIGNAL(MethodInfo("remote_tree_updated"));
+ ADD_SIGNAL(MethodInfo("output"));
+ ADD_SIGNAL(MethodInfo("stack_dump", PropertyInfo(Variant::ARRAY, "stack_dump")));
+ ADD_SIGNAL(MethodInfo("stack_frame_vars", PropertyInfo(Variant::INT, "num_vars")));
+ ADD_SIGNAL(MethodInfo("stack_frame_var", PropertyInfo(Variant::ARRAY, "data")));
}
void ScriptEditorDebugger::add_debugger_plugin(const Ref<Script> &p_script) {
diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h
index a5731c9f9c..499dda86da 100644
--- a/editor/debugger/script_editor_debugger.h
+++ b/editor/debugger/script_editor_debugger.h
@@ -55,11 +55,15 @@ class EditorNetworkProfiler;
class EditorPerformanceProfiler;
class SceneDebuggerTree;
class EditorDebuggerPlugin;
+class DebugAdapterProtocol;
+class DebugAdapterParser;
class ScriptEditorDebugger : public MarginContainer {
GDCLASS(ScriptEditorDebugger, MarginContainer);
friend class EditorDebuggerNode;
+ friend class DebugAdapterProtocol;
+ friend class DebugAdapterParser;
private:
enum MessageType {
@@ -147,6 +151,7 @@ private:
OS::ProcessID remote_pid = 0;
bool breaked = false;
bool can_debug = false;
+ bool move_to_foreground = true;
bool live_debug;
@@ -230,12 +235,17 @@ public:
bool is_session_active() { return peer.is_valid() && peer->is_peer_connected(); };
int get_remote_pid() const { return remote_pid; }
+ bool is_move_to_foreground() const;
+ void set_move_to_foreground(const bool &p_move_to_foreground);
+
int get_error_count() const { return error_count; }
int get_warning_count() const { return warning_count; }
String get_stack_script_file() const;
int get_stack_script_line() const;
int get_stack_script_frame() const;
+ bool request_stack_dump(const int &p_frame);
+
void update_tabs();
void clear_style();
String get_var_value(const String &p_var) const;
diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp
index c752d0d4fd..56a9d2c258 100644
--- a/editor/doc_tools.cpp
+++ b/editor/doc_tools.cpp
@@ -145,15 +145,15 @@ void DocTools::merge_from(const DocTools &p_data) {
}
for (int i = 0; i < c.theme_properties.size(); i++) {
- DocData::PropertyDoc &p = c.theme_properties.write[i];
+ DocData::ThemeItemDoc &ti = c.theme_properties.write[i];
for (int j = 0; j < cf.theme_properties.size(); j++) {
- if (cf.theme_properties[j].name != p.name) {
+ if (cf.theme_properties[j].name != ti.name || cf.theme_properties[j].data_type != ti.data_type) {
continue;
}
- const DocData::PropertyDoc &pf = cf.theme_properties[j];
+ const DocData::ThemeItemDoc &pf = cf.theme_properties[j];
- p.description = pf.description;
+ ti.description = pf.description;
break;
}
}
@@ -464,60 +464,69 @@ void DocTools::generate(bool p_basic_types) {
c.constants.push_back(constant);
}
- //theme stuff
-
+ // Theme items.
{
List<StringName> l;
- Theme::get_default()->get_constant_list(cname, &l);
- for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "int";
- pd.default_value = itos(Theme::get_default()->get_constant(E, cname));
- c.theme_properties.push_back(pd);
- }
- l.clear();
Theme::get_default()->get_color_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "Color";
- pd.default_value = Variant(Theme::get_default()->get_color(E, cname)).get_construct_string();
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Color";
+ tid.data_type = "color";
+ tid.default_value = Variant(Theme::get_default()->get_color(E, cname)).get_construct_string();
+ c.theme_properties.push_back(tid);
}
l.clear();
- Theme::get_default()->get_icon_list(cname, &l);
+ Theme::get_default()->get_constant_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "Texture2D";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "int";
+ tid.data_type = "constant";
+ tid.default_value = itos(Theme::get_default()->get_constant(E, cname));
+ c.theme_properties.push_back(tid);
}
+
l.clear();
Theme::get_default()->get_font_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "Font";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Font";
+ tid.data_type = "font";
+ c.theme_properties.push_back(tid);
}
+
l.clear();
Theme::get_default()->get_font_size_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "int";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "int";
+ tid.data_type = "font_size";
+ c.theme_properties.push_back(tid);
+ }
+
+ l.clear();
+ Theme::get_default()->get_icon_list(cname, &l);
+ for (const StringName &E : l) {
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "Texture2D";
+ tid.data_type = "icon";
+ c.theme_properties.push_back(tid);
}
+
l.clear();
Theme::get_default()->get_stylebox_list(cname, &l);
for (const StringName &E : l) {
- DocData::PropertyDoc pd;
- pd.name = E;
- pd.type = "StyleBox";
- c.theme_properties.push_back(pd);
+ DocData::ThemeItemDoc tid;
+ tid.name = E;
+ tid.type = "StyleBox";
+ tid.data_type = "style";
+ c.theme_properties.push_back(tid);
}
}
@@ -1069,12 +1078,14 @@ Error DocTools::_load(Ref<XMLParser> parser) {
String name3 = parser->get_node_name();
if (name3 == "theme_item") {
- DocData::PropertyDoc prop2;
+ DocData::ThemeItemDoc prop2;
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
prop2.name = parser->get_attribute_value("name");
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
prop2.type = parser->get_attribute_value("type");
+ ERR_FAIL_COND_V(!parser->has_attribute("data_type"), ERR_FILE_CORRUPT);
+ prop2.data_type = parser->get_attribute_value("data_type");
if (!parser->is_empty()) {
parser->read();
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
@@ -1312,15 +1323,15 @@ Error DocTools::save_classes(const String &p_default_path, const Map<String, Str
_write_string(f, 1, "<theme_items>");
for (int i = 0; i < c.theme_properties.size(); i++) {
- const DocData::PropertyDoc &p = c.theme_properties[i];
+ const DocData::ThemeItemDoc &ti = c.theme_properties[i];
- if (p.default_value != "") {
- _write_string(f, 2, "<theme_item name=\"" + p.name + "\" type=\"" + p.type + "\" default=\"" + p.default_value.xml_escape(true) + "\">");
+ if (ti.default_value != "") {
+ _write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\" default=\"" + ti.default_value.xml_escape(true) + "\">");
} else {
- _write_string(f, 2, "<theme_item name=\"" + p.name + "\" type=\"" + p.type + "\">");
+ _write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\">");
}
- _write_string(f, 3, p.description.strip_edges().xml_escape());
+ _write_string(f, 3, ti.description.strip_edges().xml_escape());
_write_string(f, 2, "</theme_item>");
}
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 569a28215c..f92b9ac8ba 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -758,8 +758,8 @@ void EditorHelp::_update_doc() {
if (cd.theme_properties[i].description != "") {
class_desc->push_font(doc_font);
- class_desc->add_text(" ");
class_desc->push_color(comment_color);
+ class_desc->add_text(U" – ");
_add_text(DTR(cd.theme_properties[i].description));
class_desc->pop();
class_desc->pop();
@@ -941,8 +941,7 @@ void EditorHelp::_update_doc() {
if (enum_list[i].description != "") {
class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- static const char32_t dash[6] = { ' ', ' ', 0x2013 /* en dash */, ' ', ' ', 0 };
- class_desc->add_text(String(dash));
+ class_desc->add_text(U" – ");
_add_text(DTR(enum_list[i].description));
class_desc->pop();
class_desc->pop();
@@ -1011,8 +1010,7 @@ void EditorHelp::_update_doc() {
if (constants[i].description != "") {
class_desc->push_font(doc_font);
class_desc->push_color(comment_color);
- static const char32_t dash[6] = { ' ', ' ', 0x2013 /* en dash */, ' ', ' ', 0 };
- class_desc->add_text(String(dash));
+ class_desc->add_text(U" – ");
_add_text(DTR(constants[i].description));
class_desc->pop();
class_desc->pop();
diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp
index fabbf97f49..57f0345dad 100644
--- a/editor/editor_help_search.cpp
+++ b/editor/editor_help_search.cpp
@@ -367,7 +367,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() {
if (search_flags & SEARCH_THEME_ITEMS) {
for (int i = 0; i < class_doc.theme_properties.size(); i++) {
if (_match_string(term, class_doc.theme_properties[i].name)) {
- match.theme_properties.push_back(const_cast<DocData::PropertyDoc *>(&class_doc.theme_properties[i]));
+ match.theme_properties.push_back(const_cast<DocData::ThemeItemDoc *>(&class_doc.theme_properties[i]));
}
}
}
@@ -571,7 +571,7 @@ TreeItem *EditorHelpSearch::Runner::_create_property_item(TreeItem *p_parent, co
return _create_member_item(p_parent, p_class_doc->name, "MemberProperty", p_doc->name, p_doc->name, TTRC("Property"), "property", tooltip);
}
-TreeItem *EditorHelpSearch::Runner::_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc) {
+TreeItem *EditorHelpSearch::Runner::_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ThemeItemDoc *p_doc) {
String tooltip = p_doc->type + " " + p_class_doc->name + "." + p_doc->name;
return _create_member_item(p_parent, p_class_doc->name, "MemberTheme", p_doc->name, p_doc->name, TTRC("Theme Property"), "theme_item", tooltip);
}
diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h
index 75da2d5aba..bc57c0e3c6 100644
--- a/editor/editor_help_search.h
+++ b/editor/editor_help_search.h
@@ -103,7 +103,7 @@ class EditorHelpSearch::Runner : public RefCounted {
Vector<DocData::MethodDoc *> signals;
Vector<DocData::ConstantDoc *> constants;
Vector<DocData::PropertyDoc *> properties;
- Vector<DocData::PropertyDoc *> theme_properties;
+ Vector<DocData::ThemeItemDoc *> theme_properties;
bool required() {
return name || methods.size() || signals.size() || constants.size() || properties.size() || theme_properties.size();
@@ -145,7 +145,7 @@ class EditorHelpSearch::Runner : public RefCounted {
TreeItem *_create_signal_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::MethodDoc *p_doc);
TreeItem *_create_constant_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ConstantDoc *p_doc);
TreeItem *_create_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc);
- TreeItem *_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::PropertyDoc *p_doc);
+ TreeItem *_create_theme_property_item(TreeItem *p_parent, const DocData::ClassDoc *p_class_doc, const DocData::ThemeItemDoc *p_doc);
TreeItem *_create_member_item(TreeItem *p_parent, const String &p_class_name, const String &p_icon, const String &p_name, const String &p_text, const String &p_type, const String &p_metatype, const String &p_tooltip);
public:
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index ef014ea159..78500ab16c 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -70,6 +70,7 @@
#include "servers/rendering/rendering_device.h"
#include "editor/audio_stream_preview.h"
+#include "editor/debugger/debug_adapter/debug_adapter_server.h"
#include "editor/debugger/editor_debugger_node.h"
#include "editor/dependency_editor.h"
#include "editor/editor_about.h"
@@ -6755,6 +6756,7 @@ EditorNode::EditorNode() {
//plugin stuff
add_editor_plugin(memnew(DebuggerEditorPlugin(this, debug_menu)));
+ add_editor_plugin(memnew(DebugAdapterServer()));
disk_changed = memnew(ConfirmationDialog);
{
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index df4469b6fe..29ac836834 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -80,7 +80,7 @@ bool EditorSettings::_set_only(const StringName &p_name, const Variant &p_value)
Ref<Shortcut> sc;
sc.instantiate();
- sc->set_shortcut(shortcut);
+ sc->set_event(shortcut);
add_shortcut(name, sc);
}
@@ -153,13 +153,13 @@ bool EditorSettings::_get(const StringName &p_name, Variant &r_ret) const {
}
Ref<InputEvent> original = sc->get_meta("original");
- if (sc->is_shortcut(original) || (original.is_null() && sc->get_shortcut().is_null())) {
+ if (sc->matches_event(original) || (original.is_null() && sc->get_event().is_null())) {
continue; //not changed from default, don't save
}
}
arr.push_back(E->key());
- arr.push_back(sc->get_shortcut());
+ arr.push_back(sc->get_event());
}
r_ret = arr;
return true;
@@ -1457,7 +1457,7 @@ bool EditorSettings::is_shortcut(const String &p_name, const Ref<InputEvent> &p_
const Map<String, Ref<Shortcut>>::Element *E = shortcuts.find(p_name);
ERR_FAIL_COND_V_MSG(!E, false, "Unknown Shortcut: " + p_name + ".");
- return E->get()->is_shortcut(p_event);
+ return E->get()->matches_event(p_event);
}
Ref<Shortcut> EditorSettings::get_shortcut(const String &p_name) const {
@@ -1473,7 +1473,7 @@ Ref<Shortcut> EditorSettings::get_shortcut(const String &p_name) const {
const Map<String, List<Ref<InputEvent>>>::Element *builtin_override = builtin_action_overrides.find(p_name);
if (builtin_override) {
sc.instantiate();
- sc->set_shortcut(builtin_override->get().front()->get());
+ sc->set_event(builtin_override->get().front()->get());
sc->set_name(InputMap::get_singleton()->get_builtin_display_name(p_name));
}
@@ -1482,7 +1482,7 @@ Ref<Shortcut> EditorSettings::get_shortcut(const String &p_name) const {
const OrderedHashMap<String, List<Ref<InputEvent>>>::ConstElement builtin_default = InputMap::get_singleton()->get_builtins().find(p_name);
if (builtin_default) {
sc.instantiate();
- sc->set_shortcut(builtin_default.get().front()->get());
+ sc->set_event(builtin_default.get().front()->get());
sc->set_name(InputMap::get_singleton()->get_builtin_display_name(p_name));
}
}
@@ -1538,7 +1538,7 @@ Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p
Ref<Shortcut> sc;
sc.instantiate();
sc->set_name(p_name);
- sc->set_shortcut(ie);
+ sc->set_event(ie);
sc->set_meta("original", ie);
return sc;
}
@@ -1552,7 +1552,7 @@ Ref<Shortcut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p
sc.instantiate();
sc->set_name(p_name);
- sc->set_shortcut(ie);
+ sc->set_event(ie);
sc->set_meta("original", ie); //to compare against changes
EditorSettings::get_singleton()->add_shortcut(p_path, sc);
@@ -1600,7 +1600,7 @@ void EditorSettings::set_builtin_action_override(const String &p_name, const Arr
// Update the shortcut (if it is used somewhere in the editor) to be the first event of the new list.
if (shortcuts.has(p_name)) {
- shortcuts[p_name]->set_shortcut(event_list.front()->get());
+ shortcuts[p_name]->set_event(event_list.front()->get());
}
}
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index f0cc1530ab..0d714065e3 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -155,6 +155,7 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#8da5f3", "#3d64dd"); // 2D
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#4b70ea", "#1a3eac"); // 2D Dark
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#8eef97", "#2fa139"); // Control
+ ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ffdd65", "#ca8a04"); // Node warning
// Rainbow
ADD_CONVERT_COLOR(dark_icon_color_dictionary, "#ff4545", "#ff2929"); // Red
@@ -229,7 +230,6 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
exceptions.insert("StatusError");
exceptions.insert("StatusSuccess");
exceptions.insert("StatusWarning");
- exceptions.insert("NodeWarning");
exceptions.insert("OverbrightIndicator");
}
@@ -1045,6 +1045,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons"));
theme->set_icon("space", "TextEdit", theme->get_icon("GuiSpace", "EditorIcons"));
theme->set_color("font_color", "TextEdit", font_color);
+ theme->set_color("font_readonly_color", "LineEdit", font_readonly_color);
theme->set_color("caret_color", "TextEdit", font_color);
theme->set_color("selection_color", "TextEdit", selection_color);
diff --git a/editor/import/editor_importer_bake_reset.cpp b/editor/import/editor_importer_bake_reset.cpp
index 939c47faa4..00dce6850e 100644
--- a/editor/import/editor_importer_bake_reset.cpp
+++ b/editor/import/editor_importer_bake_reset.cpp
@@ -30,6 +30,7 @@
#include "editor/import/editor_importer_bake_reset.h"
+#include "core/error/error_list.h"
#include "core/error/error_macros.h"
#include "core/math/transform_3d.h"
#include "editor/import/scene_importer_mesh_node_3d.h"
@@ -151,13 +152,20 @@ void BakeReset::_align_animations(AnimationPlayer *p_ap, const Map<StringName, B
}
void BakeReset::_fetch_reset_animation(AnimationPlayer *p_ap, Map<StringName, BakeResetRestBone> &r_rest_bones, const String &p_bake_anim) {
- ERR_FAIL_NULL(p_ap);
+ if (!p_ap) {
+ return;
+ }
List<StringName> anim_names;
p_ap->get_animation_list(&anim_names);
Node *root = p_ap->get_owner();
ERR_FAIL_NULL(root);
+ if (!p_ap->has_animation(p_bake_anim)) {
+ return;
+ }
Ref<Animation> a = p_ap->get_animation(p_bake_anim);
- ERR_FAIL_NULL(a);
+ if (a.is_null()) {
+ return;
+ }
for (int32_t track = 0; track < a->get_track_count(); track++) {
NodePath path = a->track_get_path(track);
String string_path = path;
@@ -171,7 +179,10 @@ void BakeReset::_fetch_reset_animation(AnimationPlayer *p_ap, Map<StringName, Ba
Quaternion rot;
Vector3 scale;
Error err = a->transform_track_get_key(track, key_i, &loc, &rot, &scale);
- ERR_CONTINUE(err);
+ if (err != OK) {
+ ERR_PRINT_ONCE("Reset animation baker can't get key.");
+ continue;
+ }
rot.normalize();
Basis rot_basis = Basis(rot, scale);
BakeResetRestBone rest_bone;
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 1e642462dc..50aae6c434 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -234,21 +234,6 @@ static String _fixstr(const String &p_what, const String &p_str) {
return what;
}
-static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape3D>> &r_shape_list, bool p_convex) {
- ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value");
- if (!p_convex) {
- Ref<Shape3D> shape = mesh->create_trimesh_shape();
- r_shape_list.push_back(shape);
- } else {
- Vector<Ref<Shape3D>> cd = mesh->convex_decompose();
- if (cd.size()) {
- for (int i = 0; i < cd.size(); i++) {
- r_shape_list.push_back(cd[i]);
- }
- }
- }
-}
-
static void _pre_gen_shape_list(const Ref<EditorSceneImporterMesh> &mesh, List<Ref<Shape3D>> &r_shape_list, bool p_convex) {
ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value");
if (!p_convex) {
@@ -426,7 +411,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
if (collision_map.has(mesh)) {
shapes = collision_map[mesh];
} else {
- _gen_shape_list(mesh, shapes, true);
+ _pre_gen_shape_list(mesh, shapes, true);
}
RigidBody3D *rigid_body = memnew(RigidBody3D);
@@ -452,10 +437,10 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
if (collision_map.has(mesh)) {
shapes = collision_map[mesh];
} else if (_teststr(name, "col")) {
- _gen_shape_list(mesh, shapes, false);
+ _pre_gen_shape_list(mesh, shapes, false);
collision_map[mesh] = shapes;
} else if (_teststr(name, "convcol")) {
- _gen_shape_list(mesh, shapes, true);
+ _pre_gen_shape_list(mesh, shapes, true);
collision_map[mesh] = shapes;
}
@@ -510,11 +495,11 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
if (collision_map.has(mesh)) {
shapes = collision_map[mesh];
} else if (_teststr(mesh->get_name(), "col")) {
- _gen_shape_list(mesh, shapes, false);
+ _pre_gen_shape_list(mesh, shapes, false);
collision_map[mesh] = shapes;
mesh->set_name(_fixstr(mesh->get_name(), "col"));
} else if (_teststr(mesh->get_name(), "convcol")) {
- _gen_shape_list(mesh, shapes, true);
+ _pre_gen_shape_list(mesh, shapes, true);
collision_map[mesh] = shapes;
mesh->set_name(_fixstr(mesh->get_name(), "convcol"));
}
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index a566afb597..952bec4d87 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -408,22 +408,12 @@ void InspectorDock::update(Object *p_object) {
current = p_object;
- if (!p_object) {
- open_docs_button->set_disabled(true);
- object_menu->set_disabled(true);
- warning->hide();
- search->set_editable(false);
- editor_path->clear_path();
- return;
- }
-
- bool is_resource = p_object->is_class("Resource");
- bool is_node = p_object->is_class("Node");
-
- object_menu->set_disabled(false);
- search->set_editable(true);
- editor_path->enable_path();
+ const bool is_object = p_object != nullptr;
+ const bool is_resource = is_object && p_object->is_class("Resource");
+ const bool is_node = is_object && p_object->is_class("Node");
+ object_menu->set_disabled(!is_object);
+ search->set_editable(is_object);
resource_save_button->set_disabled(!is_resource);
open_docs_button->set_disabled(!is_resource && !is_node);
@@ -431,6 +421,14 @@ void InspectorDock::update(Object *p_object) {
resource_extra_popup->set_item_disabled(resource_extra_popup->get_item_index(RESOURCE_COPY), !is_resource);
resource_extra_popup->set_item_disabled(resource_extra_popup->get_item_index(RESOURCE_MAKE_BUILT_IN), !is_resource);
+ if (!is_object) {
+ warning->hide();
+ editor_path->clear_path();
+ return;
+ }
+
+ editor_path->enable_path();
+
PopupMenu *p = object_menu->get_popup();
p->clear();
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 16e224b105..c440064898 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -486,11 +486,11 @@ void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
}
if (k->is_pressed() && !k->is_ctrl_pressed() && !k->is_echo()) {
- if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->is_shortcut(p_ev)) {
+ if ((grid_snap_active || show_grid) && multiply_grid_step_shortcut.is_valid() && multiply_grid_step_shortcut->matches_event(p_ev)) {
// Multiply the grid size
grid_step_multiplier = MIN(grid_step_multiplier + 1, 12);
viewport->update();
- } else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->is_shortcut(p_ev)) {
+ } else if ((grid_snap_active || show_grid) && divide_grid_step_shortcut.is_valid() && divide_grid_step_shortcut->matches_event(p_ev)) {
// Divide the grid size
Point2 new_grid_step = grid_step * Math::pow(2.0, grid_step_multiplier - 1);
if (new_grid_step.x >= 1.0 && new_grid_step.y >= 1.0) {
@@ -1192,30 +1192,30 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
Ref<InputEventKey> k = p_event;
if (k.is_valid()) {
if (k->is_pressed()) {
- if (ED_GET_SHORTCUT("canvas_item_editor/zoom_3.125_percent")->is_shortcut(p_event)) {
+ if (ED_GET_SHORTCUT("canvas_item_editor/zoom_3.125_percent")->matches_event(p_event)) {
_update_zoom((1.0 / 32.0) * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_6.25_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_6.25_percent")->matches_event(p_event)) {
_update_zoom((1.0 / 16.0) * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_12.5_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_12.5_percent")->matches_event(p_event)) {
_update_zoom((1.0 / 8.0) * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_25_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_25_percent")->matches_event(p_event)) {
_update_zoom((1.0 / 4.0) * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_50_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_50_percent")->matches_event(p_event)) {
_update_zoom((1.0 / 2.0) * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_100_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_100_percent")->matches_event(p_event)) {
_update_zoom(1.0 * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_200_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_200_percent")->matches_event(p_event)) {
_update_zoom(2.0 * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_400_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_400_percent")->matches_event(p_event)) {
_update_zoom(4.0 * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_800_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_800_percent")->matches_event(p_event)) {
_update_zoom(8.0 * MAX(1, EDSCALE));
- } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_1600_percent")->is_shortcut(p_event)) {
+ } else if (ED_GET_SHORTCUT("canvas_item_editor/zoom_1600_percent")->matches_event(p_event)) {
_update_zoom(16.0 * MAX(1, EDSCALE));
}
}
- bool is_pan_key = pan_view_shortcut.is_valid() && pan_view_shortcut->is_shortcut(p_event);
+ bool is_pan_key = pan_view_shortcut.is_valid() && pan_view_shortcut->matches_event(p_event);
if (is_pan_key && (EditorSettings::get_singleton()->get("editors/2d/simple_panning") || drag_type != DRAG_NONE)) {
if (!panning) {
diff --git a/editor/plugins/editor_debugger_plugin.cpp b/editor/plugins/editor_debugger_plugin.cpp
index 89073b7189..5f3b11ac42 100644
--- a/editor/plugins/editor_debugger_plugin.cpp
+++ b/editor/plugins/editor_debugger_plugin.cpp
@@ -32,7 +32,7 @@
#include "editor/debugger/script_editor_debugger.h"
-void EditorDebuggerPlugin::_breaked(bool p_really_did, bool p_can_debug) {
+void EditorDebuggerPlugin::_breaked(bool p_really_did, bool p_can_debug, String p_message, bool p_has_stackdump) {
if (p_really_did) {
emit_signal(SNAME("breaked"), p_can_debug);
} else {
diff --git a/editor/plugins/editor_debugger_plugin.h b/editor/plugins/editor_debugger_plugin.h
index b33a8ed925..5995d790c5 100644
--- a/editor/plugins/editor_debugger_plugin.h
+++ b/editor/plugins/editor_debugger_plugin.h
@@ -41,7 +41,7 @@ class EditorDebuggerPlugin : public Control {
private:
ScriptEditorDebugger *debugger = nullptr;
- void _breaked(bool p_really_did, bool p_can_debug);
+ void _breaked(bool p_really_did, bool p_can_debug, String p_message, bool p_has_stackdump);
void _started();
void _stopped();
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp
index 5f12294e22..5ed8205475 100644
--- a/editor/plugins/node_3d_editor_plugin.cpp
+++ b/editor/plugins/node_3d_editor_plugin.cpp
@@ -140,9 +140,11 @@ void ViewportRotationControl::_draw_axis(const Axis2D &p_axis) {
}
if (front) {
- String axis_name = direction == 0 ? "X" : (direction == 1 ? "Y" : "Z");
draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS, c);
- draw_char(get_theme_font(SNAME("rotation_control"), SNAME("EditorFonts")), p_axis.screen_point + Vector2i(-4, 5) * EDSCALE, axis_name, "", get_theme_font_size(SNAME("rotation_control_size"), SNAME("EditorFonts")), Color(0.3, 0.3, 0.3));
+ if (positive) {
+ String axis_name = direction == 0 ? "X" : (direction == 1 ? "Y" : "Z");
+ draw_char(get_theme_font(SNAME("rotation_control"), SNAME("EditorFonts")), p_axis.screen_point + Vector2i(-4, 5) * EDSCALE, axis_name, "", get_theme_font_size(SNAME("rotation_control_size"), SNAME("EditorFonts")), Color(0.0, 0.0, 0.0));
+ }
} else {
draw_circle(p_axis.screen_point, AXIS_CIRCLE_RADIUS * (0.55 + (0.2 * (1.0 + p_axis.z_axis))), c);
}
@@ -1111,9 +1113,9 @@ Transform3D Node3DEditorViewport::_compute_transform(TransformMode p_mode, const
local_motion.snap(Vector3(p_extra, p_extra, p_extra));
}
- Vector3 local_scale = p_original_local.basis.get_scale() * (local_motion + Vector3(1, 1, 1));
- Transform3D local_t = p_original_local;
- local_t.basis.set_euler_scale(p_original_local.basis.get_rotation_euler(), local_scale);
+ Transform3D local_t;
+ local_t.basis = p_original_local.basis.scaled_local(local_motion + Vector3(1, 1, 1));
+ local_t.origin = p_original_local.origin;
return local_t;
} else {
Transform3D base = Transform3D(Basis(), _edit.center);
@@ -1121,9 +1123,9 @@ Transform3D Node3DEditorViewport::_compute_transform(TransformMode p_mode, const
p_motion.snap(Vector3(p_extra, p_extra, p_extra));
}
- Transform3D r;
- r.basis.scale(p_motion + Vector3(1, 1, 1));
- return base * (r * (base.inverse() * p_original));
+ Transform3D global_t;
+ global_t.basis.scale(p_motion + Vector3(1, 1, 1));
+ return base * (global_t * (base.inverse() * p_original));
}
}
case TRANSFORM_TRANSLATE: {
@@ -1149,19 +1151,18 @@ Transform3D Node3DEditorViewport::_compute_transform(TransformMode p_mode, const
}
case TRANSFORM_ROTATE: {
if (p_local) {
- Basis rot = Basis(p_motion, p_extra);
-
- Vector3 scale = p_original_local.basis.get_scale();
- Vector3 euler = (p_original_local.get_basis().orthonormalized() * rot).get_euler();
- Transform3D t;
- t.basis.set_euler_scale(euler, scale);
- t.origin = p_original_local.origin;
- return t;
+ Transform3D r;
+ Vector3 axis = p_original_local.basis.xform(p_motion);
+ r.basis = Basis(axis.normalized(), p_extra) * p_original_local.basis;
+ r.origin = p_original_local.origin;
+ return r;
} else {
Transform3D r;
- r.basis.rotate(p_motion, p_extra);
- Transform3D base = Transform3D(Basis(), _edit.center);
- return base * r * base.inverse() * p_original;
+ Basis local = p_original.basis * p_original_local.basis.inverse();
+ Vector3 axis = local.xform_inv(p_motion);
+ r.basis = local * Basis(axis.normalized(), p_extra) * p_original_local.basis;
+ r.origin = Basis(p_motion, p_extra).xform(p_original.origin - _edit.center) + _edit.center;
+ return r;
}
}
default: {
@@ -2454,7 +2455,7 @@ static bool is_shortcut_pressed(const String &p_path) {
if (shortcut.is_null()) {
return false;
}
- InputEventKey *k = Object::cast_to<InputEventKey>(shortcut->get_shortcut().ptr());
+ InputEventKey *k = Object::cast_to<InputEventKey>(shortcut->get_event().ptr());
if (k == nullptr) {
return false;
}
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 0929a629f8..7ea3deedb9 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -1278,6 +1278,9 @@ void ThemeItemEditorDialog::_update_edit_types() {
edit_items_remove_class->set_disabled(false);
edit_items_remove_custom->set_disabled(false);
edit_items_remove_all->set_disabled(false);
+
+ edit_items_message->set_text("");
+ edit_items_message->hide();
} else {
edit_items_add_color->set_disabled(true);
edit_items_add_constant->set_disabled(true);
@@ -1289,6 +1292,9 @@ void ThemeItemEditorDialog::_update_edit_types() {
edit_items_remove_class->set_disabled(true);
edit_items_remove_custom->set_disabled(true);
edit_items_remove_all->set_disabled(true);
+
+ edit_items_message->set_text(TTR("Select a theme type from the list to edit its items.\nYou can add a custom type or import a type with its items from another theme."));
+ edit_items_message->show();
}
_update_edit_item_tree(selected_type);
}
@@ -1305,6 +1311,7 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
TreeItem *root = edit_items_tree->create_item();
List<StringName> names;
+ bool has_any_items = false;
{ // Colors.
names.clear();
@@ -1324,6 +1331,8 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
+
+ has_any_items = true;
}
}
@@ -1345,6 +1354,8 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
+
+ has_any_items = true;
}
}
@@ -1366,6 +1377,8 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
+
+ has_any_items = true;
}
}
@@ -1387,6 +1400,8 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
+
+ has_any_items = true;
}
}
@@ -1408,6 +1423,8 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
+
+ has_any_items = true;
}
}
@@ -1429,6 +1446,20 @@ void ThemeItemEditorDialog::_update_edit_item_tree(String p_item_type) {
item->add_button(0, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), ITEMS_TREE_RENAME_ITEM, false, TTR("Rename Item"));
item->add_button(0, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), ITEMS_TREE_REMOVE_ITEM, false, TTR("Remove Item"));
}
+
+ has_any_items = true;
+ }
+ }
+
+ // If some type is selected, but it doesn't seem to have any items, show a guiding message.
+ Vector<int> selected_ids = edit_type_list->get_selected_items();
+ if (selected_ids.size() > 0) {
+ if (!has_any_items) {
+ edit_items_message->set_text(TTR("This theme type is empty.\nAdd more items to it manually or by importing from another theme."));
+ edit_items_message->show();
+ } else {
+ edit_items_message->set_text("");
+ edit_items_message->hide();
}
}
}
@@ -1873,6 +1904,14 @@ ThemeItemEditorDialog::ThemeItemEditorDialog() {
edit_items_vb->add_child(edit_items_tree);
edit_items_tree->connect("button_pressed", callable_mp(this, &ThemeItemEditorDialog::_item_tree_button_pressed));
+ edit_items_message = memnew(Label);
+ edit_items_message->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
+ edit_items_message->set_mouse_filter(Control::MOUSE_FILTER_STOP);
+ edit_items_message->set_align(Label::ALIGN_CENTER);
+ edit_items_message->set_valign(Label::VALIGN_CENTER);
+ edit_items_message->set_autowrap_mode(Label::AUTOWRAP_WORD);
+ edit_items_tree->add_child(edit_items_message);
+
edit_theme_item_dialog = memnew(ConfirmationDialog);
edit_theme_item_dialog->set_title(TTR("Add Theme Item"));
add_child(edit_theme_item_dialog);
@@ -2542,15 +2581,15 @@ void ThemeTypeEditor::_update_type_items() {
// Various type settings.
if (ClassDB::class_exists(edited_type)) {
type_variation_edit->set_editable(false);
- type_variation_edit->set_tooltip(TTR("A type associated with a built-in class cannot be marked as a variation of another type."));
type_variation_edit->set_text("");
type_variation_button->hide();
+ type_variation_locked->show();
} else {
type_variation_edit->set_editable(true);
- type_variation_edit->set_tooltip("");
type_variation_edit->set_text(edited_theme->get_type_variation_base(edited_type));
_add_focusable(type_variation_edit);
type_variation_button->show();
+ type_variation_locked->hide();
}
}
@@ -3067,8 +3106,11 @@ ThemeTypeEditor::ThemeTypeEditor() {
type_settings_list->set_h_size_flags(SIZE_EXPAND_FILL);
type_settings_sc->add_child(type_settings_list);
+ VBoxContainer *type_variation_vb = memnew(VBoxContainer);
+ type_settings_list->add_child(type_variation_vb);
+
HBoxContainer *type_variation_hb = memnew(HBoxContainer);
- type_settings_list->add_child(type_variation_hb);
+ type_variation_vb->add_child(type_variation_hb);
Label *type_variation_label = memnew(Label);
type_variation_hb->add_child(type_variation_label);
type_variation_label->set_text(TTR("Base Type"));
@@ -3083,6 +3125,13 @@ ThemeTypeEditor::ThemeTypeEditor() {
type_variation_button->set_tooltip(TTR("Select the variation base type from a list of available types."));
type_variation_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_type_variation_cbk));
+ type_variation_locked = memnew(Label);
+ type_variation_vb->add_child(type_variation_locked);
+ type_variation_locked->set_align(Label::ALIGN_CENTER);
+ type_variation_locked->set_autowrap_mode(Label::AUTOWRAP_WORD);
+ type_variation_locked->set_text(TTR("A type associated with a built-in class cannot be marked as a variation of another type."));
+ type_variation_locked->hide();
+
add_type_dialog = memnew(ThemeTypeDialog);
add_child(add_type_dialog);
add_type_dialog->connect("type_selected", callable_mp(this, &ThemeTypeEditor::_add_type_dialog_selected));
@@ -3130,7 +3179,7 @@ void ThemeEditor::_theme_save_button_cbk(bool p_save_as) {
}
void ThemeEditor::_theme_edit_button_cbk() {
- theme_edit_dialog->popup_centered(Size2(850, 760) * EDSCALE);
+ theme_edit_dialog->popup_centered(Size2(850, 700) * EDSCALE);
}
void ThemeEditor::_add_preview_button_cbk() {
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index e78b244a42..5b0357e3f8 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -197,6 +197,7 @@ class ThemeItemEditorDialog : public AcceptDialog {
Button *edit_items_remove_custom;
Button *edit_items_remove_all;
Tree *edit_items_tree;
+ Label *edit_items_message;
enum ItemsTreeAction {
ITEMS_TREE_RENAME_ITEM,
@@ -324,6 +325,7 @@ class ThemeTypeEditor : public MarginContainer {
LineEdit *type_variation_edit;
Button *type_variation_button;
+ Label *type_variation_locked;
enum TypeDialogMode {
ADD_THEME_TYPE,
diff --git a/editor/quick_open.cpp b/editor/quick_open.cpp
index bda7540a23..ed94f859e2 100644
--- a/editor/quick_open.cpp
+++ b/editor/quick_open.cpp
@@ -118,6 +118,11 @@ void EditorQuickOpen::_update_search() {
float EditorQuickOpen::_score_path(const String &p_search, const String &p_path) {
float score = 0.9f + .1f * (p_search.length() / (float)p_path.length());
+ // Exact match.
+ if (p_search == p_path) {
+ return 1.2f;
+ }
+
// Positive bias for matches close to the beginning of the file name.
String file = p_path.get_file();
int pos = file.findn(p_search);
@@ -128,11 +133,11 @@ float EditorQuickOpen::_score_path(const String &p_search, const String &p_path)
// Positive bias for matches close to the end of the path.
pos = p_path.rfindn(p_search);
if (pos != -1) {
- return score * (0.8f - 0.1f * (float(p_path.length() - pos) / p_path.length()));
+ return 1.1f + 0.09 / (p_path.length() - pos + 1);
}
- // Remaining results belong to the same class of results.
- return score * 0.69f;
+ // Similarity
+ return p_path.to_lower().similarity(p_search.to_lower());
}
void EditorQuickOpen::_confirmed() {
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index b3ec0c96c4..e7ba3daccd 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -209,7 +209,7 @@ void EditorSettingsDialog::_event_config_confirmed() {
undo_redo->create_action(TTR("Change Shortcut") + " '" + shortcut_being_edited + "'");
undo_redo->add_do_method(current_sc.ptr(), "set_shortcut", k);
- undo_redo->add_undo_method(current_sc.ptr(), "set_shortcut", current_sc->get_shortcut());
+ undo_redo->add_undo_method(current_sc.ptr(), "set_shortcut", current_sc->get_event());
undo_redo->add_do_method(this, "_update_shortcuts");
undo_redo->add_undo_method(this, "_update_shortcuts");
undo_redo->add_do_method(this, "_settings_changed");
@@ -361,7 +361,7 @@ void EditorSettingsDialog::_update_shortcuts() {
item->set_text(0, sc->get_name());
item->set_text(1, sc->get_as_text());
- if (!sc->is_shortcut(original) && !(sc->get_shortcut().is_null() && original.is_null())) {
+ if (!sc->matches_event(original) && !(sc->get_event().is_null() && original.is_null())) {
item->add_button(1, shortcuts->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")), 2);
}
@@ -444,7 +444,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
switch (button_idx) {
case EditorSettingsDialog::SHORTCUT_EDIT:
- shortcut_editor->popup_and_configure(sc->get_shortcut());
+ shortcut_editor->popup_and_configure(sc->get_event());
shortcut_being_edited = item;
break;
case EditorSettingsDialog::SHORTCUT_ERASE: {
@@ -454,7 +454,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
undo_redo->create_action(TTR("Erase Shortcut"));
undo_redo->add_do_method(sc.ptr(), "set_shortcut", Ref<InputEvent>());
- undo_redo->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut());
+ undo_redo->add_undo_method(sc.ptr(), "set_shortcut", sc->get_event());
undo_redo->add_do_method(this, "_update_shortcuts");
undo_redo->add_undo_method(this, "_update_shortcuts");
undo_redo->add_do_method(this, "_settings_changed");
@@ -470,7 +470,7 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
undo_redo->create_action(TTR("Restore Shortcut"));
undo_redo->add_do_method(sc.ptr(), "set_shortcut", original);
- undo_redo->add_undo_method(sc.ptr(), "set_shortcut", sc->get_shortcut());
+ undo_redo->add_undo_method(sc.ptr(), "set_shortcut", sc->get_event());
undo_redo->add_do_method(this, "_update_shortcuts");
undo_redo->add_undo_method(this, "_update_shortcuts");
undo_redo->add_do_method(this, "_settings_changed");
diff --git a/main/main.cpp b/main/main.cpp
index 92ab52eecd..d91cc5c9bf 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -326,9 +326,10 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --text-driver <driver> Text driver (Fonts, BiDi, shaping)\n");
+ OS::get_singleton()->print(" --headless Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script.\n");
+
OS::get_singleton()->print("\n");
-#ifndef SERVER_ENABLED
OS::get_singleton()->print("Display options:\n");
OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n");
OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n");
@@ -337,11 +338,9 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n");
OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n");
OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS and Windows only).\n");
- OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n");
OS::get_singleton()->print(" --single-window Use a single window (no separate subwindows).\n");
OS::get_singleton()->print(" --tablet-driver Pen tablet input driver.\n");
OS::get_singleton()->print("\n");
-#endif
OS::get_singleton()->print("Debug options:\n");
OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n");
@@ -352,7 +351,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --gpu-abort Abort on GPU errors (usually validation layer errors), may help see the problem if your system freezes.\n");
#endif
OS::get_singleton()->print(" --remote-debug <uri> Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n");
-#if defined(DEBUG_ENABLED) && !defined(SERVER_ENABLED)
+#if defined(DEBUG_ENABLED)
OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n");
OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
#endif
@@ -728,7 +727,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing video driver argument, aborting.\n");
goto error;
}
-#ifndef SERVER_ENABLED
} else if (I->get() == "-f" || I->get() == "--fullscreen") { // force fullscreen
init_fullscreen = true;
@@ -818,10 +816,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
force_lowdpi = true;
- } else if (I->get() == "--no-window") { // disable window creation (Windows only)
+ } else if (I->get() == "--headless") { // enable headless mode (no audio, no rendering).
+
+ audio_driver = "Dummy";
+ display_driver = "headless";
- OS::get_singleton()->set_no_window_mode(true);
-#endif
} else if (I->get() == "--profiling") { // enable profiling
use_debug_profiler = true;
diff --git a/methods.py b/methods.py
index 12f9db37e7..13851d8315 100644
--- a/methods.py
+++ b/methods.py
@@ -83,7 +83,7 @@ def update_version(module_version_string=""):
godot_status = str(version.status)
if os.getenv("GODOT_VERSION_STATUS") != None:
godot_status = str(os.getenv("GODOT_VERSION_STATUS"))
- print("Using version status '%s', overriding the original '%s'.".format(godot_status, str(version.status)))
+ print("Using version status '{}', overriding the original '{}'.".format(godot_status, str(version.status)))
f.write('#define VERSION_STATUS "' + godot_status + '"\n')
f.write('#define VERSION_BUILD "' + str(build_name) + '"\n')
f.write('#define VERSION_MODULE_CONFIG "' + str(version.module_config) + module_version_string + '"\n')
diff --git a/misc/dist/shell/_godot.zsh-completion b/misc/dist/shell/_godot.zsh-completion
index b29746bfc4..8f42c3a1a2 100644
--- a/misc/dist/shell/_godot.zsh-completion
+++ b/misc/dist/shell/_godot.zsh-completion
@@ -50,7 +50,7 @@ _arguments \
'--resolution[request window resolution]:resolution in WxH format' \
'--position[request window position]:position in X,Y format' \
'--low-dpi[force low-DPI mode (macOS and Windows only)]' \
- '--no-window[disable window creation (Windows only), useful together with --script]' \
+ '--headless[enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script]' \
'(-d --debug)'{-d,--debug}'[debug (local stdout debugger)]' \
'(-b --breakpoints)'{-b,--breakpoints}'[specify the breakpoint list as source::line comma-separated pairs, no spaces (use %20 instead)]:breakpoint list' \
'--profiling[enable profiling in the script debugger]' \
diff --git a/misc/dist/shell/godot.bash-completion b/misc/dist/shell/godot.bash-completion
index 03861e43f8..0a31c545e1 100644
--- a/misc/dist/shell/godot.bash-completion
+++ b/misc/dist/shell/godot.bash-completion
@@ -53,7 +53,7 @@ _complete_godot_options() {
--resolution
--position
--low-dpi
---no-window
+--headless
--debug
--breakpoints
--profiling
diff --git a/misc/dist/shell/godot.fish b/misc/dist/shell/godot.fish
index 1367665bbc..b44762c4ab 100644
--- a/misc/dist/shell/godot.fish
+++ b/misc/dist/shell/godot.fish
@@ -60,7 +60,7 @@ complete -c godot -s t -l always-on-top -d "Request an always-on-top window"
complete -c godot -l resolution -d "Request window resolution" -x
complete -c godot -l position -d "Request window position" -x
complete -c godot -l low-dpi -d "Force low-DPI mode (macOS and Windows only)"
-complete -c godot -l no-window -d "Disable window creation (Windows only), useful together with --script"
+complete -c godot -l headless -d "Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script"
# Debug options:
complete -c godot -s d -l debug -d "Debug (local stdout debugger)"
diff --git a/modules/enet/enet_multiplayer_peer.cpp b/modules/enet/enet_multiplayer_peer.cpp
index 28b6bb035a..38ca38385c 100644
--- a/modules/enet/enet_multiplayer_peer.cpp
+++ b/modules/enet/enet_multiplayer_peer.cpp
@@ -33,6 +33,14 @@
#include "core/io/marshalls.h"
#include "core/os/os.h"
+void ENetMultiplayerPeer::set_transfer_channel(int p_channel) {
+ transfer_channel = p_channel;
+}
+
+int ENetMultiplayerPeer::get_transfer_channel() const {
+ return transfer_channel;
+}
+
void ENetMultiplayerPeer::set_transfer_mode(TransferMode p_mode) {
transfer_mode = p_mode;
}
@@ -234,8 +242,8 @@ bool ENetMultiplayerPeer::_poll_client() {
}
switch (ret) {
case ENetConnection::EVENT_CONNECT: {
- emit_signal(SNAME("peer_connected"), 1);
connection_status = CONNECTION_CONNECTED;
+ emit_signal(SNAME("peer_connected"), 1);
emit_signal(SNAME("connection_succeeded"));
return false;
}
@@ -441,20 +449,23 @@ Error ENetMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size
int packet_flags = 0;
int channel = SYSCH_RELIABLE;
-
- switch (transfer_mode) {
- case TRANSFER_MODE_UNRELIABLE: {
- packet_flags = ENET_PACKET_FLAG_UNSEQUENCED;
- channel = SYSCH_UNRELIABLE;
- } break;
- case TRANSFER_MODE_UNRELIABLE_ORDERED: {
- packet_flags = 0;
- channel = SYSCH_UNRELIABLE;
- } break;
- case TRANSFER_MODE_RELIABLE: {
- packet_flags = ENET_PACKET_FLAG_RELIABLE;
- channel = SYSCH_RELIABLE;
- } break;
+ if (transfer_channel > 0) {
+ channel = SYSCH_MAX + transfer_channel - 1;
+ } else {
+ switch (transfer_mode) {
+ case TRANSFER_MODE_UNRELIABLE: {
+ packet_flags = ENET_PACKET_FLAG_UNSEQUENCED;
+ channel = SYSCH_UNRELIABLE;
+ } break;
+ case TRANSFER_MODE_UNRELIABLE_ORDERED: {
+ packet_flags = 0;
+ channel = SYSCH_UNRELIABLE;
+ } break;
+ case TRANSFER_MODE_RELIABLE: {
+ packet_flags = ENET_PACKET_FLAG_RELIABLE;
+ channel = SYSCH_RELIABLE;
+ } break;
+ }
}
ENetPacket *packet = enet_packet_create(nullptr, p_buffer_size + 8, packet_flags);
diff --git a/modules/enet/enet_multiplayer_peer.h b/modules/enet/enet_multiplayer_peer.h
index 703396d0cb..78e280db7c 100644
--- a/modules/enet/enet_multiplayer_peer.h
+++ b/modules/enet/enet_multiplayer_peer.h
@@ -47,10 +47,10 @@ private:
};
enum {
- SYSCH_CONFIG,
- SYSCH_RELIABLE,
- SYSCH_UNRELIABLE,
- SYSCH_MAX
+ SYSCH_CONFIG = 0,
+ SYSCH_RELIABLE = 1,
+ SYSCH_UNRELIABLE = 2,
+ SYSCH_MAX = 3
};
enum Mode {
@@ -65,6 +65,7 @@ private:
uint32_t unique_id = 0;
int target_peer = 0;
+ int transfer_channel = 0;
TransferMode transfer_mode = TRANSFER_MODE_RELIABLE;
bool refuse_connections = false;
@@ -100,6 +101,9 @@ protected:
static void _bind_methods();
public:
+ virtual void set_transfer_channel(int p_channel) override;
+ virtual int get_transfer_channel() const override;
+
virtual void set_transfer_mode(TransferMode p_mode) override;
virtual TransferMode get_transfer_mode() const override;
virtual void set_target_peer(int p_peer) override;
diff --git a/modules/gdnative/include/net/godot_net.h b/modules/gdnative/include/net/godot_net.h
index 94e7739ef9..3fb7b9e1cc 100644
--- a/modules/gdnative/include/net/godot_net.h
+++ b/modules/gdnative/include/net/godot_net.h
@@ -91,6 +91,8 @@ typedef struct {
godot_int (*get_max_packet_size)(const void *);
/* This is MultiplayerPeer */
+ void (*set_transfer_channel)(void *, godot_int);
+ godot_int (*get_transfer_channel)(void *);
void (*set_transfer_mode)(void *, godot_int);
godot_int (*get_transfer_mode)(const void *);
// 0 = broadcast, 1 = server, <0 = all but abs(value)
diff --git a/modules/gdnative/net/multiplayer_peer_gdnative.cpp b/modules/gdnative/net/multiplayer_peer_gdnative.cpp
index 8ceba0f339..9908ed4533 100644
--- a/modules/gdnative/net/multiplayer_peer_gdnative.cpp
+++ b/modules/gdnative/net/multiplayer_peer_gdnative.cpp
@@ -62,6 +62,16 @@ int MultiplayerPeerGDNative::get_available_packet_count() const {
}
/* MultiplayerPeer */
+void MultiplayerPeerGDNative::set_transfer_channel(int p_channel) {
+ ERR_FAIL_COND(interface == nullptr);
+ return interface->set_transfer_channel(interface->data, p_channel);
+}
+
+int MultiplayerPeerGDNative::get_transfer_channel() const {
+ ERR_FAIL_COND_V(interface == nullptr, 0);
+ return interface->get_transfer_channel(interface->data);
+}
+
void MultiplayerPeerGDNative::set_transfer_mode(TransferMode p_mode) {
ERR_FAIL_COND(interface == nullptr);
interface->set_transfer_mode(interface->data, (godot_int)p_mode);
@@ -113,6 +123,7 @@ MultiplayerPeer::ConnectionStatus MultiplayerPeerGDNative::get_connection_status
}
void MultiplayerPeerGDNative::_bind_methods() {
+ ADD_PROPERTY_DEFAULT("transfer_channel", 0);
ADD_PROPERTY_DEFAULT("transfer_mode", TRANSFER_MODE_UNRELIABLE);
ADD_PROPERTY_DEFAULT("refuse_new_connections", true);
}
diff --git a/modules/gdnative/net/multiplayer_peer_gdnative.h b/modules/gdnative/net/multiplayer_peer_gdnative.h
index 7c10ab77f7..ab084faae6 100644
--- a/modules/gdnative/net/multiplayer_peer_gdnative.h
+++ b/modules/gdnative/net/multiplayer_peer_gdnative.h
@@ -56,6 +56,8 @@ public:
virtual int get_available_packet_count() const override;
/* Specific to MultiplayerPeer */
+ virtual void set_transfer_channel(int p_channel) override;
+ virtual int get_transfer_channel() const override;
virtual void set_transfer_mode(TransferMode p_mode) override;
virtual TransferMode get_transfer_mode() const override;
virtual void set_target_peer(int p_peer_id) override;
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 2a93bb620b..2e570d5a5b 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -2795,6 +2795,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
if (base_type.class_type->has_member(p_symbol)) {
r_result.type = ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION;
r_result.location = base_type.class_type->get_member(p_symbol).get_line();
+ r_result.class_path = base_type.script_path;
return OK;
}
base_type = base_type.class_type->base_type;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 466ddb4b10..a500dfd51a 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -168,7 +168,7 @@ GDScriptParser::GDScriptParser() {
register_annotation(MethodInfo("@export_flags_3d_physics"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_LAYERS_3D_PHYSICS, Variant::INT>);
register_annotation(MethodInfo("@export_flags_3d_navigation"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_LAYERS_3D_NAVIGATION, Variant::INT>);
// Networking.
- register_annotation(MethodInfo("@rpc", { Variant::STRING, "mode" }, { Variant::STRING, "sync" }, { Variant::STRING, "transfer_mode" }, { Variant::INT, "transfer_channel" }), AnnotationInfo::FUNCTION, &GDScriptParser::network_annotations<MultiplayerAPI::RPC_MODE_MASTER>, 4, true);
+ register_annotation(MethodInfo("@rpc", { Variant::STRING, "mode" }, { Variant::STRING, "sync" }, { Variant::STRING, "transfer_mode" }, { Variant::INT, "transfer_channel" }), AnnotationInfo::FUNCTION, &GDScriptParser::network_annotations<MultiplayerAPI::RPC_MODE_PUPPET>, 4, true);
// TODO: Warning annotations.
}
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp
index 0d1f98778e..b6c48468f5 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.cpp
+++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp
@@ -128,13 +128,13 @@ Error GDScriptLanguageProtocol::on_client_connected() {
peer->connection = tcp_peer;
clients.set(next_client_id, peer);
next_client_id++;
- EditorNode::get_log()->add_message("Connection Taken", EditorLog::MSG_TYPE_EDITOR);
+ EditorNode::get_log()->add_message("[LSP] Connection Taken", EditorLog::MSG_TYPE_EDITOR);
return OK;
}
void GDScriptLanguageProtocol::on_client_disconnected(const int &p_client_id) {
clients.erase(p_client_id);
- EditorNode::get_log()->add_message("Disconnected", EditorLog::MSG_TYPE_EDITOR);
+ EditorNode::get_log()->add_message("[LSP] Disconnected", EditorLog::MSG_TYPE_EDITOR);
}
String GDScriptLanguageProtocol::process_message(const String &p_text) {
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index 69ddbe5d1e..c0013ac23a 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -42,10 +42,12 @@ void GDScriptTextDocument::_bind_methods() {
ClassDB::bind_method(D_METHOD("didOpen"), &GDScriptTextDocument::didOpen);
ClassDB::bind_method(D_METHOD("didClose"), &GDScriptTextDocument::didClose);
ClassDB::bind_method(D_METHOD("didChange"), &GDScriptTextDocument::didChange);
+ ClassDB::bind_method(D_METHOD("didSave"), &GDScriptTextDocument::didSave);
ClassDB::bind_method(D_METHOD("nativeSymbol"), &GDScriptTextDocument::nativeSymbol);
ClassDB::bind_method(D_METHOD("documentSymbol"), &GDScriptTextDocument::documentSymbol);
ClassDB::bind_method(D_METHOD("completion"), &GDScriptTextDocument::completion);
ClassDB::bind_method(D_METHOD("resolve"), &GDScriptTextDocument::resolve);
+ ClassDB::bind_method(D_METHOD("rename"), &GDScriptTextDocument::rename);
ClassDB::bind_method(D_METHOD("foldingRange"), &GDScriptTextDocument::foldingRange);
ClassDB::bind_method(D_METHOD("codeLens"), &GDScriptTextDocument::codeLens);
ClassDB::bind_method(D_METHOD("documentLink"), &GDScriptTextDocument::documentLink);
@@ -79,6 +81,20 @@ void GDScriptTextDocument::didChange(const Variant &p_param) {
sync_script_content(doc.uri, doc.text);
}
+void GDScriptTextDocument::didSave(const Variant &p_param) {
+ lsp::TextDocumentItem doc = load_document_item(p_param);
+ Dictionary dict = p_param;
+ String text = dict["text"];
+
+ sync_script_content(doc.uri, text);
+
+ /*String path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(doc.uri);
+
+ Ref<GDScript> script = ResourceLoader::load(path);
+ script->load_source_code(path);
+ script->reload(true);*/
+}
+
lsp::TextDocumentItem GDScriptTextDocument::load_document_item(const Variant &p_param) {
lsp::TextDocumentItem doc;
Dictionary params = p_param;
@@ -215,6 +231,14 @@ Array GDScriptTextDocument::completion(const Dictionary &p_params) {
return arr;
}
+Dictionary GDScriptTextDocument::rename(const Dictionary &p_params) {
+ lsp::TextDocumentPositionParams params;
+ params.load(p_params);
+ String new_name = p_params["newName"];
+
+ return GDScriptLanguageProtocol::get_singleton()->get_workspace()->rename(params, new_name);
+}
+
Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
lsp::CompletionItem item;
item.load(p_params);
@@ -405,7 +429,11 @@ GDScriptTextDocument::~GDScriptTextDocument() {
void GDScriptTextDocument::sync_script_content(const String &p_path, const String &p_content) {
String path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(p_path);
GDScriptLanguageProtocol::get_singleton()->get_workspace()->parse_script(path, p_content);
+
EditorFileSystem::get_singleton()->update_file(path);
+ Ref<GDScript> script = ResourceLoader::load(path);
+ script->load_source_code(path);
+ script->reload(true);
}
void GDScriptTextDocument::show_native_symbol_in_editor(const String &p_symbol_id) {
diff --git a/modules/gdscript/language_server/gdscript_text_document.h b/modules/gdscript/language_server/gdscript_text_document.h
index e2987f779c..9021c84a3f 100644
--- a/modules/gdscript/language_server/gdscript_text_document.h
+++ b/modules/gdscript/language_server/gdscript_text_document.h
@@ -45,6 +45,7 @@ protected:
void didOpen(const Variant &p_param);
void didClose(const Variant &p_param);
void didChange(const Variant &p_param);
+ void didSave(const Variant &p_param);
void sync_script_content(const String &p_path, const String &p_content);
void show_native_symbol_in_editor(const String &p_symbol_id);
@@ -61,6 +62,7 @@ public:
Array documentSymbol(const Dictionary &p_params);
Array completion(const Dictionary &p_params);
Dictionary resolve(const Dictionary &p_params);
+ Dictionary rename(const Dictionary &p_params);
Array foldingRange(const Dictionary &p_params);
Array codeLens(const Dictionary &p_params);
Array documentLink(const Dictionary &p_params);
diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp
index e6c819b22f..4fc229a0f8 100644
--- a/modules/gdscript/language_server/gdscript_workspace.cpp
+++ b/modules/gdscript/language_server/gdscript_workspace.cpp
@@ -116,6 +116,36 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_
return nullptr;
}
+const lsp::DocumentSymbol *GDScriptWorkspace::get_parameter_symbol(const lsp::DocumentSymbol *p_parent, const String &symbol_identifier) {
+ for (int i = 0; i < p_parent->children.size(); ++i) {
+ const lsp::DocumentSymbol *parameter_symbol = &p_parent->children[i];
+ if (!parameter_symbol->detail.is_empty() && parameter_symbol->name == symbol_identifier) {
+ return parameter_symbol;
+ }
+ }
+
+ return nullptr;
+}
+
+const lsp::DocumentSymbol *GDScriptWorkspace::get_local_symbol(const ExtendGDScriptParser *p_parser, const String &p_symbol_identifier) {
+ const lsp::DocumentSymbol *class_symbol = &p_parser->get_symbols();
+
+ for (int i = 0; i < class_symbol->children.size(); ++i) {
+ if (class_symbol->children[i].kind == lsp::SymbolKind::Function || class_symbol->children[i].kind == lsp::SymbolKind::Class) {
+ const lsp::DocumentSymbol *function_symbol = &class_symbol->children[i];
+
+ for (int l = 0; l < function_symbol->children.size(); ++l) {
+ const lsp::DocumentSymbol *local = &function_symbol->children[l];
+ if (!local->detail.is_empty() && local->name == p_symbol_identifier) {
+ return local;
+ }
+ }
+ }
+ }
+
+ return nullptr;
+}
+
void GDScriptWorkspace::reload_all_workspace_scripts() {
List<String> paths;
list_script_files("res://", paths);
@@ -231,18 +261,13 @@ Error GDScriptWorkspace::initialize() {
class_symbol.children.push_back(symbol);
}
- Vector<DocData::PropertyDoc> properties;
- properties.append_array(class_data.properties);
- const int theme_prop_start_idx = properties.size();
- properties.append_array(class_data.theme_properties);
-
for (int i = 0; i < class_data.properties.size(); i++) {
const DocData::PropertyDoc &data = class_data.properties[i];
lsp::DocumentSymbol symbol;
symbol.name = data.name;
symbol.native_class = class_name;
symbol.kind = lsp::SymbolKind::Property;
- symbol.detail = String(i >= theme_prop_start_idx ? "<Theme> var" : "var") + " " + class_name + "." + data.name;
+ symbol.detail = "var " + class_name + "." + data.name;
if (data.enumeration.length()) {
symbol.detail += ": " + data.enumeration;
} else {
@@ -252,6 +277,17 @@ Error GDScriptWorkspace::initialize() {
class_symbol.children.push_back(symbol);
}
+ for (int i = 0; i < class_data.theme_properties.size(); i++) {
+ const DocData::ThemeItemDoc &data = class_data.theme_properties[i];
+ lsp::DocumentSymbol symbol;
+ symbol.name = data.name;
+ symbol.native_class = class_name;
+ symbol.kind = lsp::SymbolKind::Property;
+ symbol.detail = "<Theme> var " + class_name + "." + data.name + ": " + data.type;
+ symbol.documentation = data.description;
+ class_symbol.children.push_back(symbol);
+ }
+
Vector<DocData::MethodDoc> methods_signals;
methods_signals.append_array(class_data.methods);
const int signal_start_idx = methods_signals.size();
@@ -350,6 +386,50 @@ Error GDScriptWorkspace::parse_script(const String &p_path, const String &p_cont
return err;
}
+Dictionary GDScriptWorkspace::rename(const lsp::TextDocumentPositionParams &p_doc_pos, const String &new_name) {
+ Error err;
+ String path = get_file_path(p_doc_pos.textDocument.uri);
+
+ lsp::WorkspaceEdit edit;
+
+ List<String> paths;
+ list_script_files("res://", paths);
+
+ const lsp::DocumentSymbol *reference_symbol = resolve_symbol(p_doc_pos);
+ if (reference_symbol) {
+ String identifier = reference_symbol->name;
+
+ for (List<String>::Element *PE = paths.front(); PE; PE = PE->next()) {
+ PackedStringArray content = FileAccess::get_file_as_string(PE->get(), &err).split("\n");
+ for (int i = 0; i < content.size(); ++i) {
+ String line = content[i];
+
+ int character = line.find(identifier);
+ while (character > -1) {
+ lsp::TextDocumentPositionParams params;
+
+ lsp::TextDocumentIdentifier text_doc;
+ text_doc.uri = get_file_uri(PE->get());
+
+ params.textDocument = text_doc;
+ params.position.line = i;
+ params.position.character = character;
+
+ const lsp::DocumentSymbol *other_symbol = resolve_symbol(params);
+
+ if (other_symbol == reference_symbol) {
+ edit.add_change(text_doc.uri, i, character, character + identifier.length(), new_name);
+ }
+
+ character = line.find(identifier, character + 1);
+ }
+ }
+ }
+ }
+
+ return edit.to_json();
+}
+
Error GDScriptWorkspace::parse_local_script(const String &p_path) {
Error err;
String content = FileAccess::get_file_as_string(p_path, &err);
@@ -440,8 +520,29 @@ void GDScriptWorkspace::completion(const lsp::CompletionParams &p_params, List<S
if (const ExtendGDScriptParser *parser = get_parse_result(path)) {
Node *owner_scene_node = _get_owner_scene_node(path);
+
+ Array stack;
+ Node *current = nullptr;
+ stack.push_back(owner_scene_node);
+
+ while (!stack.is_empty()) {
+ current = stack.pop_back();
+ Ref<GDScript> script = current->get_script();
+ if (script.is_valid() && script->get_path() == path) {
+ break;
+ }
+ for (int i = 0; i < current->get_child_count(); ++i) {
+ stack.push_back(current->get_child(i));
+ }
+ }
+
+ Ref<GDScript> script = current->get_script();
+ if (!script.is_valid() || script->get_path() != path) {
+ current = owner_scene_node;
+ }
+
String code = parser->get_text_for_completion(p_params.position);
- GDScriptLanguage::get_singleton()->complete_code(code, path, owner_scene_node, r_options, forced, call_hint);
+ GDScriptLanguage::get_singleton()->complete_code(code, path, current, r_options, forced, call_hint);
if (owner_scene_node) {
memdelete(owner_scene_node);
}
@@ -478,10 +579,16 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocu
String target_script_path = path;
if (!ret.script.is_null()) {
target_script_path = ret.script->get_path();
+ } else if (!ret.class_path.is_empty()) {
+ target_script_path = ret.class_path;
}
if (const ExtendGDScriptParser *target_parser = get_parse_result(target_script_path)) {
symbol = target_parser->get_symbol_defined_at_line(LINE_NUMBER_TO_INDEX(ret.location));
+
+ if (symbol && symbol->kind == lsp::SymbolKind::Function && symbol->name != symbol_identifier) {
+ symbol = get_parameter_symbol(symbol, symbol_identifier);
+ }
}
} else {
@@ -493,6 +600,10 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocu
}
} else {
symbol = parser->get_member_symbol(symbol_identifier);
+
+ if (!symbol) {
+ symbol = get_local_symbol(parser, symbol_identifier);
+ }
}
}
}
diff --git a/modules/gdscript/language_server/gdscript_workspace.h b/modules/gdscript/language_server/gdscript_workspace.h
index 8b166a873c..9496677449 100644
--- a/modules/gdscript/language_server/gdscript_workspace.h
+++ b/modules/gdscript/language_server/gdscript_workspace.h
@@ -52,6 +52,8 @@ protected:
const lsp::DocumentSymbol *get_native_symbol(const String &p_class, const String &p_member = "") const;
const lsp::DocumentSymbol *get_script_symbol(const String &p_path) const;
+ const lsp::DocumentSymbol *get_parameter_symbol(const lsp::DocumentSymbol *p_parent, const String &symbol_identifier);
+ const lsp::DocumentSymbol *get_local_symbol(const ExtendGDScriptParser *p_parser, const String &p_symbol_identifier);
void reload_all_workspace_scripts();
@@ -90,6 +92,7 @@ public:
Dictionary generate_script_api(const String &p_path);
Error resolve_signature(const lsp::TextDocumentPositionParams &p_doc_pos, lsp::SignatureHelp &r_signature);
void did_delete_files(const Dictionary &p_params);
+ Dictionary rename(const lsp::TextDocumentPositionParams &p_doc_pos, const String &new_name);
GDScriptWorkspace();
~GDScriptWorkspace();
diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp
index 0138f132ad..9ac6c6bd4e 100644
--- a/modules/gdscript/language_server/lsp.hpp
+++ b/modules/gdscript/language_server/lsp.hpp
@@ -255,6 +255,62 @@ struct TextEdit {
};
/**
+ * The edits to be applied.
+ */
+struct WorkspaceEdit {
+ /**
+ * Holds changes to existing resources.
+ */
+ Map<String, Vector<TextEdit>> changes;
+
+ _FORCE_INLINE_ Dictionary to_json() const {
+ Dictionary dict;
+
+ Dictionary out_changes;
+ for (Map<String, Vector<TextEdit>>::Element *E = changes.front(); E; E = E->next()) {
+ Array edits;
+ for (int i = 0; i < E->get().size(); ++i) {
+ Dictionary text_edit;
+ text_edit["range"] = E->get()[i].range.to_json();
+ text_edit["newText"] = E->get()[i].newText;
+ edits.push_back(text_edit);
+ }
+ out_changes[E->key()] = edits;
+ }
+ dict["changes"] = out_changes;
+
+ return dict;
+ }
+
+ _FORCE_INLINE_ void add_change(const String &uri, const int &line, const int &start_character, const int &end_character, const String &new_text) {
+ if (Map<String, Vector<TextEdit>>::Element *E = changes.find(uri)) {
+ Vector<TextEdit> edit_list = E->value();
+ for (int i = 0; i < edit_list.size(); ++i) {
+ TextEdit edit = edit_list[i];
+ if (edit.range.start.character == start_character) {
+ return;
+ }
+ }
+ }
+
+ TextEdit new_edit;
+ new_edit.newText = new_text;
+ new_edit.range.start.line = line;
+ new_edit.range.start.character = start_character;
+ new_edit.range.end.line = line;
+ new_edit.range.end.character = end_character;
+
+ if (Map<String, Vector<TextEdit>>::Element *E = changes.find(uri)) {
+ E->value().push_back(new_edit);
+ } else {
+ Vector<TextEdit> edit_list;
+ edit_list.push_back(new_edit);
+ changes.insert(uri, edit_list);
+ }
+ }
+};
+
+/**
* Represents a reference to a command.
* Provides a title which will be used to represent a command in the UI.
* Commands are identified by a string identifier.
@@ -486,7 +542,7 @@ struct TextDocumentSyncOptions {
* If present save notifications are sent to the server. If omitted the notification should not be
* sent.
*/
- bool save = false;
+ SaveOptions save;
Dictionary to_json() {
Dictionary dict;
@@ -494,7 +550,7 @@ struct TextDocumentSyncOptions {
dict["willSave"] = willSave;
dict["openClose"] = openClose;
dict["change"] = change;
- dict["save"] = save;
+ dict["save"] = save.to_json();
return dict;
}
};
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 15a5807370..520262c0eb 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -875,6 +875,13 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
// As scripts are going to be reloaded, must proceed without locking here
for (Ref<CSharpScript> &script : scripts) {
+ // If someone removes a script from a node, deletes the script, builds, adds a script to the
+ // same node, then builds again, the script might have no path and also no script_class. In
+ // that case, we can't (and don't need to) reload it.
+ if (script->get_path().is_empty() && !script->script_class) {
+ continue;
+ }
+
to_reload.push_back(script);
if (script->get_path().is_empty()) {
diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
index ed69c2b833..897f1b2822 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs
@@ -11,6 +11,7 @@ namespace GodotTools.Build
{
public BuildOutputView BuildOutputView { get; private set; }
+ private MenuButton buildMenuBtn;
private Button errorsBtn;
private Button warningsBtn;
private Button viewLogBtn;
@@ -131,7 +132,7 @@ namespace GodotTools.Build
var toolBarHBox = new HBoxContainer {SizeFlagsHorizontal = (int)SizeFlags.ExpandFill};
AddChild(toolBarHBox);
- var buildMenuBtn = new MenuButton {Text = "Build", Icon = GetThemeIcon("Play", "EditorIcons")};
+ buildMenuBtn = new MenuButton {Text = "Build", Icon = GetThemeIcon("Play", "EditorIcons")};
toolBarHBox.AddChild(buildMenuBtn);
var buildMenu = buildMenuBtn.GetPopup();
@@ -177,5 +178,16 @@ namespace GodotTools.Build
BuildOutputView = new BuildOutputView();
AddChild(BuildOutputView);
}
+
+ public override void _Notification(int what)
+ {
+ base._Notification(what);
+
+ if (what == NotificationThemeChanged) {
+ buildMenuBtn.Icon = GetThemeIcon("Play", "EditorIcons");
+ errorsBtn.Icon = GetThemeIcon("StatusError", "EditorIcons");
+ warningsBtn.Icon = GetThemeIcon("NodeWarning", "EditorIcons");
+ }
+ }
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index 8271b43b48..968f853c2d 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -207,7 +207,7 @@ namespace Godot
}
}
- public Quaternion RotationQuaternion()
+ public Quaternion GetRotationQuaternion()
{
Basis orthonormalizedBasis = Orthonormalized();
real_t det = orthonormalizedBasis.Determinant();
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
index 213fc181c1..61a34bfc87 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Diagnostics.CodeAnalysis;
namespace Godot.Collections
{
@@ -25,6 +26,11 @@ namespace Godot.Collections
}
}
+ /// <summary>
+ /// Wrapper around Godot's Dictionary class, a dictionary of Variant
+ /// typed elements allocated in the engine in C++. Useful when
+ /// interfacing with the engine.
+ /// </summary>
public class Dictionary :
IDictionary,
IDisposable
@@ -32,11 +38,19 @@ namespace Godot.Collections
DictionarySafeHandle safeHandle;
bool disposed = false;
+ /// <summary>
+ /// Constructs a new empty <see cref="Dictionary"/>.
+ /// </summary>
public Dictionary()
{
safeHandle = new DictionarySafeHandle(godot_icall_Dictionary_Ctor());
}
+ /// <summary>
+ /// Constructs a new <see cref="Dictionary"/> from the given dictionary's elements.
+ /// </summary>
+ /// <param name="dictionary">The dictionary to construct from.</param>
+ /// <returns>A new Godot Dictionary.</returns>
public Dictionary(IDictionary dictionary) : this()
{
if (dictionary == null)
@@ -64,6 +78,9 @@ namespace Godot.Collections
return safeHandle.DangerousGetHandle();
}
+ /// <summary>
+ /// Disposes of this <see cref="Dictionary"/>.
+ /// </summary>
public void Dispose()
{
if (disposed)
@@ -78,6 +95,11 @@ namespace Godot.Collections
disposed = true;
}
+ /// <summary>
+ /// Duplicates this <see cref="Dictionary"/>.
+ /// </summary>
+ /// <param name="deep">If <see langword="true"/>, performs a deep copy.</param>
+ /// <returns>A new Godot Dictionary.</returns>
public Dictionary Duplicate(bool deep = false)
{
return new Dictionary(godot_icall_Dictionary_Duplicate(GetPtr(), deep));
@@ -85,6 +107,9 @@ namespace Godot.Collections
// IDictionary
+ /// <summary>
+ /// Gets the collection of keys in this <see cref="Dictionary"/>.
+ /// </summary>
public ICollection Keys
{
get
@@ -94,6 +119,9 @@ namespace Godot.Collections
}
}
+ /// <summary>
+ /// Gets the collection of elements in this <see cref="Dictionary"/>.
+ /// </summary>
public ICollection Values
{
get
@@ -103,47 +131,88 @@ namespace Godot.Collections
}
}
- public bool IsFixedSize => false;
+ private (Array keys, Array values, int count) GetKeyValuePairs()
+ {
+ int count = godot_icall_Dictionary_KeyValuePairs(GetPtr(), out IntPtr keysHandle, out IntPtr valuesHandle);
+ Array keys = new Array(new ArraySafeHandle(keysHandle));
+ Array values = new Array(new ArraySafeHandle(valuesHandle));
+ return (keys, values, count);
+ }
+
+ bool IDictionary.IsFixedSize => false;
- public bool IsReadOnly => false;
+ bool IDictionary.IsReadOnly => false;
+ /// <summary>
+ /// Returns the object at the given <paramref name="key"/>.
+ /// </summary>
+ /// <value>The object at the given <paramref name="key"/>.</value>
public object this[object key]
{
get => godot_icall_Dictionary_GetValue(GetPtr(), key);
set => godot_icall_Dictionary_SetValue(GetPtr(), key, value);
}
+ /// <summary>
+ /// Adds an object <paramref name="value"/> at key <paramref name="key"/>
+ /// to this <see cref="Dictionary"/>.
+ /// </summary>
+ /// <param name="key">The key at which to add the object.</param>
+ /// <param name="value">The object to add.</param>
public void Add(object key, object value) => godot_icall_Dictionary_Add(GetPtr(), key, value);
+ /// <summary>
+ /// Erases all items from this <see cref="Dictionary"/>.
+ /// </summary>
public void Clear() => godot_icall_Dictionary_Clear(GetPtr());
+ /// <summary>
+ /// Checks if this <see cref="Dictionary"/> contains the given key.
+ /// </summary>
+ /// <param name="key">The key to look for.</param>
+ /// <returns>Whether or not this dictionary contains the given key.</returns>
public bool Contains(object key) => godot_icall_Dictionary_ContainsKey(GetPtr(), key);
+ /// <summary>
+ /// Gets an enumerator for this <see cref="Dictionary"/>.
+ /// </summary>
+ /// <returns>An enumerator.</returns>
public IDictionaryEnumerator GetEnumerator() => new DictionaryEnumerator(this);
+ /// <summary>
+ /// Removes an element from this <see cref="Dictionary"/> by key.
+ /// </summary>
+ /// <param name="key">The key of the element to remove.</param>
public void Remove(object key) => godot_icall_Dictionary_RemoveKey(GetPtr(), key);
// ICollection
- public object SyncRoot => this;
+ object ICollection.SyncRoot => this;
- public bool IsSynchronized => false;
+ bool ICollection.IsSynchronized => false;
+ /// <summary>
+ /// Returns the number of elements in this <see cref="Dictionary"/>.
+ /// This is also known as the size or length of the dictionary.
+ /// </summary>
+ /// <returns>The number of elements.</returns>
public int Count => godot_icall_Dictionary_Count(GetPtr());
+ /// <summary>
+ /// Copies the elements of this <see cref="Dictionary"/> to the given
+ /// untyped C# array, starting at the given index.
+ /// </summary>
+ /// <param name="array">The array to copy to.</param>
+ /// <param name="index">The index to start at.</param>
public void CopyTo(System.Array array, int index)
{
- // TODO Can be done with single internal call
-
if (array == null)
throw new ArgumentNullException(nameof(array), "Value cannot be null.");
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index), "Number was less than the array's lower bound in the first dimension.");
- Array keys = (Array)Keys;
- Array values = (Array)Values;
- int count = Count;
+ var (keys, values, count) = GetKeyValuePairs();
if (array.Length < (index + count))
throw new ArgumentException("Destination array was not long enough. Check destIndex and length, and the array's lower bounds.");
@@ -161,24 +230,39 @@ namespace Godot.Collections
private class DictionaryEnumerator : IDictionaryEnumerator
{
- Array keys;
- Array values;
- int count;
- int index = -1;
+ private readonly Dictionary dictionary;
+ private readonly int count;
+ private int index = -1;
+ private bool dirty = true;
+
+ private DictionaryEntry entry;
public DictionaryEnumerator(Dictionary dictionary)
{
- // TODO 3 internal calls, can reduce to 1
- keys = (Array)dictionary.Keys;
- values = (Array)dictionary.Values;
+ this.dictionary = dictionary;
count = dictionary.Count;
}
public object Current => Entry;
- public DictionaryEntry Entry =>
- // TODO 2 internal calls, can reduce to 1
- new DictionaryEntry(keys[index], values[index]);
+ public DictionaryEntry Entry
+ {
+ get
+ {
+ if (dirty)
+ {
+ UpdateEntry();
+ }
+ return entry;
+ }
+ }
+
+ private void UpdateEntry()
+ {
+ dirty = false;
+ godot_icall_Dictionary_KeyValuePairAt(dictionary.GetPtr(), index, out object key, out object value);
+ entry = new DictionaryEntry(key, value);
+ }
public object Key => Entry.Key;
@@ -187,15 +271,21 @@ namespace Godot.Collections
public bool MoveNext()
{
index++;
+ dirty = true;
return index < count;
}
public void Reset()
{
index = -1;
+ dirty = true;
}
}
+ /// <summary>
+ /// Converts this <see cref="Dictionary"/> to a string.
+ /// </summary>
+ /// <returns>A string representation of this dictionary.</returns>
public override string ToString()
{
return godot_icall_Dictionary_ToString(GetPtr());
@@ -226,6 +316,12 @@ namespace Godot.Collections
internal extern static int godot_icall_Dictionary_Count(IntPtr ptr);
[MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static int godot_icall_Dictionary_KeyValuePairs(IntPtr ptr, out IntPtr keys, out IntPtr values);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern static void godot_icall_Dictionary_KeyValuePairAt(IntPtr ptr, int index, out object key, out object value);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
internal extern static void godot_icall_Dictionary_Add(IntPtr ptr, object key, object value);
[MethodImpl(MethodImplOptions.InternalCall)]
@@ -259,10 +355,18 @@ namespace Godot.Collections
internal extern static string godot_icall_Dictionary_ToString(IntPtr ptr);
}
+ /// <summary>
+ /// Typed wrapper around Godot's Dictionary class, a dictionary of Variant
+ /// typed elements allocated in the engine in C++. Useful when
+ /// interfacing with the engine. Otherwise prefer .NET collections
+ /// such as <see cref="System.Collections.Generic.Dictionary{TKey, TValue}"/>.
+ /// </summary>
+ /// <typeparam name="TKey">The type of the dictionary's keys.</typeparam>
+ /// <typeparam name="TValue">The type of the dictionary's values.</typeparam>
public class Dictionary<TKey, TValue> :
IDictionary<TKey, TValue>
{
- Dictionary objectDict;
+ private readonly Dictionary objectDict;
internal static int valTypeEncoding;
internal static IntPtr valTypeClass;
@@ -272,11 +376,19 @@ namespace Godot.Collections
Dictionary.godot_icall_Dictionary_Generic_GetValueTypeInfo(typeof(TValue), out valTypeEncoding, out valTypeClass);
}
+ /// <summary>
+ /// Constructs a new empty <see cref="Dictionary{TKey, TValue}"/>.
+ /// </summary>
public Dictionary()
{
objectDict = new Dictionary();
}
+ /// <summary>
+ /// Constructs a new <see cref="Dictionary{TKey, TValue}"/> from the given dictionary's elements.
+ /// </summary>
+ /// <param name="dictionary">The dictionary to construct from.</param>
+ /// <returns>A new Godot Dictionary.</returns>
public Dictionary(IDictionary<TKey, TValue> dictionary)
{
objectDict = new Dictionary();
@@ -294,6 +406,11 @@ namespace Godot.Collections
}
}
+ /// <summary>
+ /// Constructs a new <see cref="Dictionary{TKey, TValue}"/> from the given dictionary's elements.
+ /// </summary>
+ /// <param name="dictionary">The dictionary to construct from.</param>
+ /// <returns>A new Godot Dictionary.</returns>
public Dictionary(Dictionary dictionary)
{
objectDict = dictionary;
@@ -309,6 +426,10 @@ namespace Godot.Collections
objectDict = new Dictionary(handle);
}
+ /// <summary>
+ /// Converts this typed <see cref="Dictionary{TKey, TValue}"/> to an untyped <see cref="Dictionary"/>.
+ /// </summary>
+ /// <param name="from">The typed dictionary to convert.</param>
public static explicit operator Dictionary(Dictionary<TKey, TValue> from)
{
return from.objectDict;
@@ -319,6 +440,11 @@ namespace Godot.Collections
return objectDict.GetPtr();
}
+ /// <summary>
+ /// Duplicates this <see cref="Dictionary{TKey, TValue}"/>.
+ /// </summary>
+ /// <param name="deep">If <see langword="true"/>, performs a deep copy.</param>
+ /// <returns>A new Godot Dictionary.</returns>
public Dictionary<TKey, TValue> Duplicate(bool deep = false)
{
return new Dictionary<TKey, TValue>(objectDict.Duplicate(deep));
@@ -326,12 +452,19 @@ namespace Godot.Collections
// IDictionary<TKey, TValue>
+ /// <summary>
+ /// Returns the value at the given <paramref name="key"/>.
+ /// </summary>
+ /// <value>The value at the given <paramref name="key"/>.</value>
public TValue this[TKey key]
{
get { return (TValue)Dictionary.godot_icall_Dictionary_GetValue_Generic(objectDict.GetPtr(), key, valTypeEncoding, valTypeClass); }
set { objectDict[key] = value; }
}
+ /// <summary>
+ /// Gets the collection of keys in this <see cref="Dictionary{TKey, TValue}"/>.
+ /// </summary>
public ICollection<TKey> Keys
{
get
@@ -341,6 +474,9 @@ namespace Godot.Collections
}
}
+ /// <summary>
+ /// Gets the collection of elements in this <see cref="Dictionary{TKey, TValue}"/>.
+ /// </summary>
public ICollection<TValue> Values
{
get
@@ -350,56 +486,93 @@ namespace Godot.Collections
}
}
+ private KeyValuePair<TKey, TValue> GetKeyValuePair(int index)
+ {
+ Dictionary.godot_icall_Dictionary_KeyValuePairAt(GetPtr(), index, out object key, out object value);
+ return new KeyValuePair<TKey, TValue>((TKey)key, (TValue)value);
+ }
+
+ /// <summary>
+ /// Adds an object <paramref name="value"/> at key <paramref name="key"/>
+ /// to this <see cref="Dictionary{TKey, TValue}"/>.
+ /// </summary>
+ /// <param name="key">The key at which to add the object.</param>
+ /// <param name="value">The object to add.</param>
public void Add(TKey key, TValue value)
{
objectDict.Add(key, value);
}
+ /// <summary>
+ /// Checks if this <see cref="Dictionary{TKey, TValue}"/> contains the given key.
+ /// </summary>
+ /// <param name="key">The key to look for.</param>
+ /// <returns>Whether or not this dictionary contains the given key.</returns>
public bool ContainsKey(TKey key)
{
return objectDict.Contains(key);
}
+ /// <summary>
+ /// Removes an element from this <see cref="Dictionary{TKey, TValue}"/> by key.
+ /// </summary>
+ /// <param name="key">The key of the element to remove.</param>
public bool Remove(TKey key)
{
return Dictionary.godot_icall_Dictionary_RemoveKey(GetPtr(), key);
}
- public bool TryGetValue(TKey key, out TValue value)
+ /// <summary>
+ /// Gets the object at the given <paramref name="key"/>.
+ /// </summary>
+ /// <param name="key">The key of the element to get.</param>
+ /// <param name="value">The value at the given <paramref name="key"/>.</param>
+ /// <returns>If an object was found for the given <paramref name="key"/>.</returns>
+ public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
{
- object retValue;
- bool found = Dictionary.godot_icall_Dictionary_TryGetValue_Generic(GetPtr(), key, out retValue, valTypeEncoding, valTypeClass);
- value = found ? (TValue)retValue : default(TValue);
+ bool found = Dictionary.godot_icall_Dictionary_TryGetValue_Generic(GetPtr(), key, out object retValue, valTypeEncoding, valTypeClass);
+ value = found ? (TValue)retValue : default;
return found;
}
// ICollection<KeyValuePair<TKey, TValue>>
+ /// <summary>
+ /// Returns the number of elements in this <see cref="Dictionary{TKey, TValue}"/>.
+ /// This is also known as the size or length of the dictionary.
+ /// </summary>
+ /// <returns>The number of elements.</returns>
public int Count
{
get { return objectDict.Count; }
}
- public bool IsReadOnly
- {
- get { return objectDict.IsReadOnly; }
- }
+ bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly => false;
- public void Add(KeyValuePair<TKey, TValue> item)
+ void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
{
objectDict.Add(item.Key, item.Value);
}
+ /// <summary>
+ /// Erases all the items from this <see cref="Dictionary{TKey, TValue}"/>.
+ /// </summary>
public void Clear()
{
objectDict.Clear();
}
- public bool Contains(KeyValuePair<TKey, TValue> item)
+ bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
{
return objectDict.Contains(new KeyValuePair<object, object>(item.Key, item.Value));
}
+ /// <summary>
+ /// Copies the elements of this <see cref="Dictionary{TKey, TValue}"/> to the given
+ /// untyped C# array, starting at the given index.
+ /// </summary>
+ /// <param name="array">The array to copy to.</param>
+ /// <param name="arrayIndex">The index to start at.</param>
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{
if (array == null)
@@ -408,9 +581,6 @@ namespace Godot.Collections
if (arrayIndex < 0)
throw new ArgumentOutOfRangeException(nameof(arrayIndex), "Number was less than the array's lower bound in the first dimension.");
- // TODO 3 internal calls, can reduce to 1
- Array<TKey> keys = (Array<TKey>)Keys;
- Array<TValue> values = (Array<TValue>)Values;
int count = Count;
if (array.Length < (arrayIndex + count))
@@ -418,13 +588,12 @@ namespace Godot.Collections
for (int i = 0; i < count; i++)
{
- // TODO 2 internal calls, can reduce to 1
- array[arrayIndex] = new KeyValuePair<TKey, TValue>(keys[i], values[i]);
+ array[arrayIndex] = GetKeyValuePair(i);
arrayIndex++;
}
}
- public bool Remove(KeyValuePair<TKey, TValue> item)
+ bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
{
return Dictionary.godot_icall_Dictionary_Remove(GetPtr(), item.Key, item.Value);
;
@@ -432,17 +601,15 @@ namespace Godot.Collections
// IEnumerable<KeyValuePair<TKey, TValue>>
+ /// <summary>
+ /// Gets an enumerator for this <see cref="Dictionary{TKey, TValue}"/>.
+ /// </summary>
+ /// <returns>An enumerator.</returns>
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
{
- // TODO 3 internal calls, can reduce to 1
- Array<TKey> keys = (Array<TKey>)Keys;
- Array<TValue> values = (Array<TValue>)Values;
- int count = Count;
-
- for (int i = 0; i < count; i++)
+ for (int i = 0; i < Count; i++)
{
- // TODO 2 internal calls, can reduce to 1
- yield return new KeyValuePair<TKey, TValue>(keys[i], values[i]);
+ yield return GetKeyValuePair(i);
}
}
@@ -451,6 +618,10 @@ namespace Godot.Collections
return GetEnumerator();
}
+ /// <summary>
+ /// Converts this <see cref="Dictionary{TKey, TValue}"/> to a string.
+ /// </summary>
+ /// <returns>A string representation of this dictionary.</returns>
public override string ToString() => objectDict.ToString();
}
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
index f8f5e27397..71d0593916 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
@@ -28,6 +28,16 @@ namespace Godot
return (real_t)Math.Exp(db * 0.11512925464970228420089957273422);
}
+ private static object[] GetPrintParams(object[] parameters)
+ {
+ if (parameters == null)
+ {
+ return new[] { "null" };
+ }
+
+ return Array.ConvertAll(parameters, x => x?.ToString() ?? "null");
+ }
+
public static int Hash(object var)
{
return godot_icall_GD_hash(var);
@@ -65,7 +75,7 @@ namespace Godot
public static void Print(params object[] what)
{
- godot_icall_GD_print(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
+ godot_icall_GD_print(GetPrintParams(what));
}
public static void PrintStack()
@@ -75,22 +85,22 @@ namespace Godot
public static void PrintErr(params object[] what)
{
- godot_icall_GD_printerr(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
+ godot_icall_GD_printerr(GetPrintParams(what));
}
public static void PrintRaw(params object[] what)
{
- godot_icall_GD_printraw(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
+ godot_icall_GD_printraw(GetPrintParams(what));
}
public static void PrintS(params object[] what)
{
- godot_icall_GD_prints(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
+ godot_icall_GD_prints(GetPrintParams(what));
}
public static void PrintT(params object[] what)
{
- godot_icall_GD_printt(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
+ godot_icall_GD_printt(GetPrintParams(what));
}
public static float Randf()
@@ -118,9 +128,9 @@ namespace Godot
return godot_icall_GD_randi_range(from, to);
}
- public static uint RandSeed(ulong seed, out ulong newSeed)
+ public static uint RandFromSeed(ref ulong seed)
{
- return godot_icall_GD_rand_seed(seed, out newSeed);
+ return godot_icall_GD_rand_seed(seed, out seed);
}
public static IEnumerable<int> Range(int end)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 1b717fb4ae..afc6a65a45 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -124,11 +124,11 @@ namespace Godot
/* not sure if very "efficient" but good enough? */
Vector3 sourceScale = basis.Scale;
- Quaternion sourceRotation = basis.RotationQuaternion();
+ Quaternion sourceRotation = basis.GetRotationQuaternion();
Vector3 sourceLocation = origin;
Vector3 destinationScale = transform.basis.Scale;
- Quaternion destinationRotation = transform.basis.RotationQuaternion();
+ Quaternion destinationRotation = transform.basis.GetRotationQuaternion();
Vector3 destinationLocation = transform.origin;
var interpolated = new Transform3D();
diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp
index 191f863350..86976de244 100644
--- a/modules/mono/glue/collections_glue.cpp
+++ b/modules/mono/glue/collections_glue.cpp
@@ -230,6 +230,19 @@ int32_t godot_icall_Dictionary_Count(Dictionary *ptr) {
return ptr->size();
}
+int32_t godot_icall_Dictionary_KeyValuePairs(Dictionary *ptr, Array **keys, Array **values) {
+ *keys = godot_icall_Dictionary_Keys(ptr);
+ *values = godot_icall_Dictionary_Values(ptr);
+ return godot_icall_Dictionary_Count(ptr);
+}
+
+void godot_icall_Dictionary_KeyValuePairAt(Dictionary *ptr, int index, MonoObject **key, MonoObject **value) {
+ Array *keys = godot_icall_Dictionary_Keys(ptr);
+ Array *values = godot_icall_Dictionary_Values(ptr);
+ *key = GDMonoMarshal::variant_to_mono_object(keys->get(index));
+ *value = GDMonoMarshal::variant_to_mono_object(values->get(index));
+}
+
void godot_icall_Dictionary_Add(Dictionary *ptr, MonoObject *key, MonoObject *value) {
Variant varKey = GDMonoMarshal::mono_object_to_variant(key);
Variant *ret = ptr->getptr(varKey);
@@ -338,6 +351,8 @@ void godot_register_collections_icalls() {
GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Keys", godot_icall_Dictionary_Keys);
GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Values", godot_icall_Dictionary_Values);
GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Count", godot_icall_Dictionary_Count);
+ GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_KeyValuePairs", godot_icall_Dictionary_KeyValuePairs);
+ GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_KeyValuePairAt", godot_icall_Dictionary_KeyValuePairAt);
GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Add", godot_icall_Dictionary_Add);
GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Clear", godot_icall_Dictionary_Clear);
GDMonoUtils::add_internal_call("Godot.Collections.Dictionary::godot_icall_Dictionary_Contains", godot_icall_Dictionary_Contains);
diff --git a/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml b/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml
index 0c4a0d4ea0..c53af22ae1 100644
--- a/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml
+++ b/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml
@@ -51,10 +51,12 @@
<return type="int" enum="Error" />
<argument index="0" name="peer_id" type="int" />
<argument index="1" name="server_compatibility" type="bool" default="false" />
+ <argument index="2" name="channels_config" type="Array" default="[]" />
<description>
Initialize the multiplayer peer with the given [code]peer_id[/code] (must be between 1 and 2147483647).
If [code]server_compatibilty[/code] is [code]false[/code] (default), the multiplayer peer will be immediately in state [constant MultiplayerPeer.CONNECTION_CONNECTED] and [signal MultiplayerPeer.connection_succeeded] will not be emitted.
If [code]server_compatibilty[/code] is [code]true[/code] the peer will suppress all [signal MultiplayerPeer.peer_connected] signals until a peer with id [constant MultiplayerPeer.TARGET_PEER_SERVER] connects and then emit [signal MultiplayerPeer.connection_succeeded]. After that the signal [signal MultiplayerPeer.peer_connected] will be emitted for every already connected peer, and any new peer that might connect. If the server peer disconnects after that, signal [signal MultiplayerPeer.server_disconnected] will be emitted and state will become [constant MultiplayerPeer.CONNECTION_CONNECTED].
+ You can optionally specify a [code]channels_config[/code] array of [enum MultiplayerPeer.TransferMode] which will be used to create extra channels (WebRTC only supports one transfer mode per channel).
</description>
</method>
<method name="remove_peer">
diff --git a/modules/webrtc/webrtc_multiplayer_peer.cpp b/modules/webrtc/webrtc_multiplayer_peer.cpp
index 9b08a26aed..95c8c13449 100644
--- a/modules/webrtc/webrtc_multiplayer_peer.cpp
+++ b/modules/webrtc/webrtc_multiplayer_peer.cpp
@@ -34,7 +34,7 @@
#include "core/os/os.h"
void WebRTCMultiplayerPeer::_bind_methods() {
- ClassDB::bind_method(D_METHOD("initialize", "peer_id", "server_compatibility"), &WebRTCMultiplayerPeer::initialize, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("initialize", "peer_id", "server_compatibility", "channels_config"), &WebRTCMultiplayerPeer::initialize, DEFVAL(false), DEFVAL(Array()));
ClassDB::bind_method(D_METHOD("add_peer", "peer", "peer_id", "unreliable_lifetime"), &WebRTCMultiplayerPeer::add_peer, DEFVAL(1));
ClassDB::bind_method(D_METHOD("remove_peer", "peer_id"), &WebRTCMultiplayerPeer::remove_peer);
ClassDB::bind_method(D_METHOD("has_peer", "peer_id"), &WebRTCMultiplayerPeer::has_peer);
@@ -43,6 +43,14 @@ void WebRTCMultiplayerPeer::_bind_methods() {
ClassDB::bind_method(D_METHOD("close"), &WebRTCMultiplayerPeer::close);
}
+void WebRTCMultiplayerPeer::set_transfer_channel(int p_channel) {
+ transfer_channel = p_channel;
+}
+
+int WebRTCMultiplayerPeer::get_transfer_channel() const {
+ return transfer_channel;
+}
+
void WebRTCMultiplayerPeer::set_transfer_mode(TransferMode p_mode) {
transfer_mode = p_mode;
}
@@ -192,8 +200,34 @@ MultiplayerPeer::ConnectionStatus WebRTCMultiplayerPeer::get_connection_status()
return connection_status;
}
-Error WebRTCMultiplayerPeer::initialize(int p_self_id, bool p_server_compat) {
- ERR_FAIL_COND_V(p_self_id < 0 || p_self_id > ~(1 << 31), ERR_INVALID_PARAMETER);
+Error WebRTCMultiplayerPeer::initialize(int p_self_id, bool p_server_compat, Array p_channels_config) {
+ ERR_FAIL_COND_V(p_self_id < 1 || p_self_id > ~(1 << 31), ERR_INVALID_PARAMETER);
+ channels_config.clear();
+ for (int i = 0; i < p_channels_config.size(); i++) {
+ ERR_FAIL_COND_V_MSG(p_channels_config[i].get_type() != Variant::INT, ERR_INVALID_PARAMETER, "The 'channels_config' array must contain only enum values from 'MultiplayerPeer.TransferMode'");
+ int mode = p_channels_config[i].operator int();
+ // Initialize data channel configurations.
+ Dictionary cfg;
+ cfg["id"] = CH_RESERVED_MAX + i + 1;
+ cfg["negotiated"] = true;
+ cfg["ordered"] = true;
+
+ switch (mode) {
+ case TRANSFER_MODE_UNRELIABLE_ORDERED:
+ cfg["maxPacketLifetime"] = 1;
+ break;
+ case TRANSFER_MODE_UNRELIABLE:
+ cfg["maxPacketLifetime"] = 1;
+ cfg["ordered"] = false;
+ break;
+ case TRANSFER_MODE_RELIABLE:
+ break;
+ default:
+ ERR_FAIL_V_MSG(ERR_INVALID_PARAMETER, vformat("The 'channels_config' array must contain only enum values from 'MultiplayerPeer.TransferMode'. Got: %d", mode));
+ }
+ channels_config.push_back(cfg);
+ }
+
unique_id = p_self_id;
server_compat = p_server_compat;
@@ -260,17 +294,23 @@ Error WebRTCMultiplayerPeer::add_peer(Ref<WebRTCPeerConnection> p_peer, int p_pe
cfg["id"] = 1;
peer->channels[CH_RELIABLE] = p_peer->create_data_channel("reliable", cfg);
- ERR_FAIL_COND_V(!peer->channels[CH_RELIABLE].is_valid(), FAILED);
+ ERR_FAIL_COND_V(peer->channels[CH_RELIABLE].is_null(), FAILED);
cfg["id"] = 2;
cfg["maxPacketLifetime"] = p_unreliable_lifetime;
peer->channels[CH_ORDERED] = p_peer->create_data_channel("ordered", cfg);
- ERR_FAIL_COND_V(!peer->channels[CH_ORDERED].is_valid(), FAILED);
+ ERR_FAIL_COND_V(peer->channels[CH_ORDERED].is_null(), FAILED);
cfg["id"] = 3;
cfg["ordered"] = false;
peer->channels[CH_UNRELIABLE] = p_peer->create_data_channel("unreliable", cfg);
- ERR_FAIL_COND_V(!peer->channels[CH_UNRELIABLE].is_valid(), FAILED);
+ ERR_FAIL_COND_V(peer->channels[CH_UNRELIABLE].is_null(), FAILED);
+
+ for (const Dictionary &dict : channels_config) {
+ Ref<WebRTCDataChannel> ch = p_peer->create_data_channel(String::num_int64(dict["id"]), dict);
+ ERR_FAIL_COND_V(ch.is_null(), FAILED);
+ peer->channels.push_back(ch);
+ }
peer_map[p_peer_id] = peer; // add the new peer connection to the peer_map
@@ -312,17 +352,21 @@ Error WebRTCMultiplayerPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_
Error WebRTCMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
ERR_FAIL_COND_V(connection_status == CONNECTION_DISCONNECTED, ERR_UNCONFIGURED);
- int ch = CH_RELIABLE;
- switch (transfer_mode) {
- case TRANSFER_MODE_RELIABLE:
- ch = CH_RELIABLE;
- break;
- case TRANSFER_MODE_UNRELIABLE_ORDERED:
- ch = CH_ORDERED;
- break;
- case TRANSFER_MODE_UNRELIABLE:
- ch = CH_UNRELIABLE;
- break;
+ int ch = transfer_channel;
+ if (ch == 0) {
+ switch (transfer_mode) {
+ case TRANSFER_MODE_RELIABLE:
+ ch = CH_RELIABLE;
+ break;
+ case TRANSFER_MODE_UNRELIABLE_ORDERED:
+ ch = CH_ORDERED;
+ break;
+ case TRANSFER_MODE_UNRELIABLE:
+ ch = CH_UNRELIABLE;
+ break;
+ }
+ } else {
+ ch += CH_RESERVED_MAX - 1;
}
Map<int, Ref<ConnectedPeer>>::Element *E = nullptr;
@@ -331,8 +375,8 @@ Error WebRTCMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_si
E = peer_map.find(target_peer);
ERR_FAIL_COND_V_MSG(!E, ERR_INVALID_PARAMETER, "Invalid target peer: " + itos(target_peer) + ".");
- ERR_FAIL_COND_V(E->value()->channels.size() <= ch, ERR_BUG);
- ERR_FAIL_COND_V(!E->value()->channels[ch].is_valid(), ERR_BUG);
+ ERR_FAIL_COND_V_MSG(E->value()->channels.size() <= ch, ERR_INVALID_PARAMETER, vformat("Unable to send packet on channel %d, max channels: %d", ch, E->value()->channels.size()));
+ ERR_FAIL_COND_V(E->value()->channels[ch].is_null(), ERR_BUG);
return E->value()->channels[ch]->put_packet(p_buffer, p_buffer_size);
} else {
@@ -344,7 +388,8 @@ Error WebRTCMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_si
continue;
}
- ERR_CONTINUE(F->value()->channels.size() <= ch || !F->value()->channels[ch].is_valid());
+ ERR_CONTINUE_MSG(F->value()->channels.size() <= ch, vformat("Unable to send packet on channel %d, max channels: %d", ch, E->value()->channels.size()));
+ ERR_CONTINUE(F->value()->channels[ch].is_null());
F->value()->channels[ch]->put_packet(p_buffer, p_buffer_size);
}
}
@@ -370,23 +415,13 @@ int WebRTCMultiplayerPeer::get_max_packet_size() const {
void WebRTCMultiplayerPeer::close() {
peer_map.clear();
+ channels_config.clear();
unique_id = 0;
next_packet_peer = 0;
target_peer = 0;
connection_status = CONNECTION_DISCONNECTED;
}
-WebRTCMultiplayerPeer::WebRTCMultiplayerPeer() {
- unique_id = 0;
- next_packet_peer = 0;
- target_peer = 0;
- client_count = 0;
- transfer_mode = TRANSFER_MODE_RELIABLE;
- refuse_connections = false;
- connection_status = CONNECTION_DISCONNECTED;
- server_compat = false;
-}
-
WebRTCMultiplayerPeer::~WebRTCMultiplayerPeer() {
close();
}
diff --git a/modules/webrtc/webrtc_multiplayer_peer.h b/modules/webrtc/webrtc_multiplayer_peer.h
index 1d9387b6dc..ef4fe1678c 100644
--- a/modules/webrtc/webrtc_multiplayer_peer.h
+++ b/modules/webrtc/webrtc_multiplayer_peer.h
@@ -62,25 +62,27 @@ private:
}
};
- uint32_t unique_id;
- int target_peer;
- int client_count;
- bool refuse_connections;
- ConnectionStatus connection_status;
- TransferMode transfer_mode;
- int next_packet_peer;
- bool server_compat;
+ uint32_t unique_id = 0;
+ int target_peer = 0;
+ int client_count = 0;
+ bool refuse_connections = false;
+ ConnectionStatus connection_status = CONNECTION_DISCONNECTED;
+ int transfer_channel = 0;
+ TransferMode transfer_mode = TRANSFER_MODE_RELIABLE;
+ int next_packet_peer = 0;
+ bool server_compat = false;
Map<int, Ref<ConnectedPeer>> peer_map;
+ List<Dictionary> channels_config;
void _peer_to_dict(Ref<ConnectedPeer> p_connected_peer, Dictionary &r_dict);
void _find_next_peer();
public:
- WebRTCMultiplayerPeer();
+ WebRTCMultiplayerPeer() {}
~WebRTCMultiplayerPeer();
- Error initialize(int p_self_id, bool p_server_compat = false);
+ Error initialize(int p_self_id, bool p_server_compat = false, Array p_channels_config = Array());
Error add_peer(Ref<WebRTCPeerConnection> p_peer, int p_peer_id, int p_unreliable_lifetime = 1);
void remove_peer(int p_peer_id);
bool has_peer(int p_peer_id);
@@ -95,6 +97,8 @@ public:
int get_max_packet_size() const override;
// MultiplayerPeer
+ void set_transfer_channel(int p_channel) override;
+ int get_transfer_channel() const override;
void set_transfer_mode(TransferMode p_mode) override;
TransferMode get_transfer_mode() const override;
void set_target_peer(int p_peer_id) override;
diff --git a/modules/websocket/websocket_multiplayer_peer.cpp b/modules/websocket/websocket_multiplayer_peer.cpp
index 52d9a602a1..163cc7706b 100644
--- a/modules/websocket/websocket_multiplayer_peer.cpp
+++ b/modules/websocket/websocket_multiplayer_peer.cpp
@@ -105,6 +105,14 @@ Error WebSocketMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer
//
// MultiplayerPeer
//
+void WebSocketMultiplayerPeer::set_transfer_channel(int p_channel) {
+ // Websocket does not have channels.
+}
+
+int WebSocketMultiplayerPeer::get_transfer_channel() const {
+ return 0;
+}
+
void WebSocketMultiplayerPeer::set_transfer_mode(TransferMode p_mode) {
// Websocket uses TCP, reliable
}
diff --git a/modules/websocket/websocket_multiplayer_peer.h b/modules/websocket/websocket_multiplayer_peer.h
index 4e80f876d6..0fee196f41 100644
--- a/modules/websocket/websocket_multiplayer_peer.h
+++ b/modules/websocket/websocket_multiplayer_peer.h
@@ -78,6 +78,8 @@ protected:
public:
/* MultiplayerPeer */
+ void set_transfer_channel(int p_channel) override;
+ int get_transfer_channel() const override;
void set_transfer_mode(TransferMode p_mode) override;
TransferMode get_transfer_mode() const override;
void set_target_peer(int p_target_peer) override;
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 9b4da2a77a..a382fb2f1e 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1322,7 +1322,7 @@ int CharacterBody2D::get_max_slides() const {
}
void CharacterBody2D::set_max_slides(int p_max_slides) {
- ERR_FAIL_COND(p_max_slides > 0);
+ ERR_FAIL_COND(p_max_slides < 1);
max_slides = p_max_slides;
}
@@ -1396,7 +1396,7 @@ void CharacterBody2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "linear_velocity"), "set_linear_velocity", "get_linear_velocity");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stop_on_slope"), "set_stop_on_slope_enabled", "is_stop_on_slope_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "infinite_inertia"), "set_infinite_inertia_enabled", "is_infinite_inertia_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "max_slides"), "set_max_slides", "get_max_slides");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "max_slides", PROPERTY_HINT_RANGE, "1,8,1,or_greater"), "set_max_slides", "get_max_slides");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle", PROPERTY_HINT_RANGE, "0,180,0.1"), "set_floor_max_angle", "get_floor_max_angle");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "snap"), "set_snap", "get_snap");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "up_direction"), "set_up_direction", "get_up_direction");
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 6afa0c0779..e2a415e5aa 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -1576,7 +1576,7 @@ void TileMap::set_cell(int p_layer, const Vector2i &p_coords, int p_source_id, c
_make_quadrant_dirty(Q);
}
- used_size_cache_dirty = true;
+ used_rect_cache_dirty = true;
} else {
if (!E) {
// Insert a new cell in the tile map.
@@ -1604,7 +1604,7 @@ void TileMap::set_cell(int p_layer, const Vector2i &p_coords, int p_source_id, c
c.alternative_tile = alternative_tile;
_make_quadrant_dirty(Q);
- used_size_cache_dirty = true;
+ used_rect_cache_dirty = true;
}
}
@@ -1800,7 +1800,7 @@ void TileMap::clear_layer(int p_layer) {
_clear_layer_internals(p_layer);
layers[p_layer].tile_map.clear();
- used_size_cache_dirty = true;
+ used_rect_cache_dirty = true;
}
void TileMap::clear() {
@@ -1809,7 +1809,7 @@ void TileMap::clear() {
for (unsigned int i = 0; i < layers.size(); i++) {
layers[i].tile_map.clear();
}
- used_size_cache_dirty = true;
+ used_rect_cache_dirty = true;
}
void TileMap::_set_tile_data(int p_layer, const Vector<int> &p_data) {
@@ -2666,25 +2666,31 @@ TypedArray<Vector2i> TileMap::get_used_cells(int p_layer) const {
Rect2 TileMap::get_used_rect() { // Not const because of cache
// Return the rect of the currently used area
- if (used_size_cache_dirty) {
+ if (used_rect_cache_dirty) {
bool first = true;
+ used_rect_cache = Rect2i();
+
for (unsigned int i = 0; i < layers.size(); i++) {
const Map<Vector2i, TileMapCell> &tile_map = layers[i].tile_map;
if (tile_map.size() > 0) {
if (first) {
- used_size_cache = Rect2(tile_map.front()->key().x, tile_map.front()->key().y, 1, 1);
+ used_rect_cache = Rect2i(tile_map.front()->key().x, tile_map.front()->key().y, 0, 0);
first = false;
}
for (Map<Vector2i, TileMapCell>::Element *E = tile_map.front(); E; E = E->next()) {
- used_size_cache.expand_to(Vector2(E->key().x + 1, E->key().y + 1));
+ used_rect_cache.expand_to(Vector2i(E->key().x, E->key().y));
}
}
}
- used_size_cache_dirty = false;
+
+ if (!first) { // first is true if every layer is empty.
+ used_rect_cache.size += Vector2i(1, 1); // The cache expands to top-left coordinate, so we add one full tile.
+ }
+ used_rect_cache_dirty = false;
}
- return used_size_cache;
+ return used_rect_cache;
}
// --- Override some methods of the CanvasItem class to pass the changes to the quadrants CanvasItems ---
diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h
index 4800780f94..dce18f7682 100644
--- a/scene/2d/tile_map.h
+++ b/scene/2d/tile_map.h
@@ -213,8 +213,8 @@ private:
// Rect.
Rect2 rect_cache;
bool rect_cache_dirty = true;
- Rect2 used_size_cache;
- bool used_size_cache_dirty = true;
+ Rect2i used_rect_cache;
+ bool used_rect_cache_dirty = true;
// TileMap layers.
struct TileMapLayer {
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index 93ecb2cd3a..100e3563a3 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -1347,7 +1347,7 @@ int CharacterBody3D::get_max_slides() const {
}
void CharacterBody3D::set_max_slides(int p_max_slides) {
- ERR_FAIL_COND(p_max_slides > 0);
+ ERR_FAIL_COND(p_max_slides < 1);
max_slides = p_max_slides;
}
@@ -1422,7 +1422,7 @@ void CharacterBody3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "linear_velocity"), "set_linear_velocity", "get_linear_velocity");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "stop_on_slope"), "set_stop_on_slope_enabled", "is_stop_on_slope_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "infinite_inertia"), "set_infinite_inertia_enabled", "is_infinite_inertia_enabled");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "max_slides"), "set_max_slides", "get_max_slides");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "max_slides", PROPERTY_HINT_RANGE, "1,8,1,or_greater"), "set_max_slides", "get_max_slides");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "floor_max_angle", PROPERTY_HINT_RANGE, "0,180,0.1,radians"), "set_floor_max_angle", "get_floor_max_angle");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "snap"), "set_snap", "get_snap");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "up_direction"), "set_up_direction", "get_up_direction");
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index 75a4464a40..82f4a216b8 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -345,7 +345,7 @@ void BaseButton::_unhandled_key_input(Ref<InputEvent> p_event) {
return;
}
- if (!is_disabled() && is_visible_in_tree() && !p_event->is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) {
+ if (!is_disabled() && is_visible_in_tree() && !p_event->is_echo() && shortcut.is_valid() && shortcut->matches_event(p_event)) {
on_action_event(p_event);
accept_event();
}
@@ -353,7 +353,7 @@ void BaseButton::_unhandled_key_input(Ref<InputEvent> p_event) {
String BaseButton::get_tooltip(const Point2 &p_pos) const {
String tooltip = Control::get_tooltip(p_pos);
- if (shortcut_in_tooltip && shortcut.is_valid() && shortcut->is_valid()) {
+ if (shortcut_in_tooltip && shortcut.is_valid() && shortcut->has_valid_event()) {
String text = shortcut->get_name() + " (" + shortcut->get_as_text() + ")";
if (tooltip != String() && shortcut->get_name().nocasecmp_to(tooltip) != 0) {
text += "\n" + tooltip;
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp
index 490548fce0..44f7200cd7 100644
--- a/scene/gui/popup_menu.cpp
+++ b/scene/gui/popup_menu.cpp
@@ -74,7 +74,7 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
size.width += items[i].text_buf->get_size().x;
size.height += vseparation;
- if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->is_valid())) {
+ if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->has_valid_event())) {
int accel_w = hseparation * 2;
accel_w += items[i].accel_text_buf->get_size().x;
accel_max_w = MAX(accel_w, accel_max_w);
@@ -635,7 +635,7 @@ void PopupMenu::_draw_items() {
}
// Accelerator / Shortcut
- if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->is_valid())) {
+ if (items[i].accel || (items[i].shortcut.is_valid() && items[i].shortcut->has_valid_event())) {
if (rtl) {
item_ofs.x = scroll_width + style->get_margin(SIDE_LEFT) + item_end_padding;
} else {
@@ -1301,7 +1301,7 @@ bool PopupMenu::activate_item_by_event(const Ref<InputEvent> &p_event, bool p_fo
continue;
}
- if (items[i].shortcut.is_valid() && items[i].shortcut->is_shortcut(p_event) && (items[i].shortcut_is_global || !p_for_global_only)) {
+ if (items[i].shortcut.is_valid() && items[i].shortcut->matches_event(p_event) && (items[i].shortcut_is_global || !p_for_global_only)) {
activate_item(i);
return true;
}
diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp
index 962c6dcc60..885a51e058 100644
--- a/scene/gui/shortcut.cpp
+++ b/scene/gui/shortcut.cpp
@@ -32,42 +32,39 @@
#include "core/os/keyboard.h"
-void Shortcut::set_shortcut(const Ref<InputEvent> &p_shortcut) {
- shortcut = p_shortcut;
+void Shortcut::set_event(const Ref<InputEvent> &p_event) {
+ event = p_event;
emit_changed();
}
-Ref<InputEvent> Shortcut::get_shortcut() const {
- return shortcut;
+Ref<InputEvent> Shortcut::get_event() const {
+ return event;
}
-bool Shortcut::is_shortcut(const Ref<InputEvent> &p_event) const {
- return shortcut.is_valid() && shortcut->is_match(p_event, true);
+bool Shortcut::matches_event(const Ref<InputEvent> &p_event) const {
+ return event.is_valid() && event->is_match(p_event, true);
}
String Shortcut::get_as_text() const {
- if (shortcut.is_valid()) {
- return shortcut->as_text();
+ if (event.is_valid()) {
+ return event->as_text();
} else {
return "None";
}
}
-bool Shortcut::is_valid() const {
- return shortcut.is_valid();
+bool Shortcut::has_valid_event() const {
+ return event.is_valid();
}
void Shortcut::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &Shortcut::set_shortcut);
- ClassDB::bind_method(D_METHOD("get_shortcut"), &Shortcut::get_shortcut);
+ ClassDB::bind_method(D_METHOD("set_event", "event"), &Shortcut::set_event);
+ ClassDB::bind_method(D_METHOD("get_event"), &Shortcut::get_event);
- ClassDB::bind_method(D_METHOD("is_valid"), &Shortcut::is_valid);
+ ClassDB::bind_method(D_METHOD("has_valid_event"), &Shortcut::has_valid_event);
- ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &Shortcut::is_shortcut);
+ ClassDB::bind_method(D_METHOD("matches_event", "event"), &Shortcut::matches_event);
ClassDB::bind_method(D_METHOD("get_as_text"), &Shortcut::get_as_text);
- ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), "set_shortcut", "get_shortcut");
-}
-
-Shortcut::Shortcut() {
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), "set_event", "get_event");
}
diff --git a/scene/gui/shortcut.h b/scene/gui/shortcut.h
index ea91f29b5d..249dd1971f 100644
--- a/scene/gui/shortcut.h
+++ b/scene/gui/shortcut.h
@@ -37,20 +37,18 @@
class Shortcut : public Resource {
GDCLASS(Shortcut, Resource);
- Ref<InputEvent> shortcut;
+ Ref<InputEvent> event;
protected:
static void _bind_methods();
public:
- void set_shortcut(const Ref<InputEvent> &p_shortcut);
- Ref<InputEvent> get_shortcut() const;
- bool is_shortcut(const Ref<InputEvent> &p_event) const;
- bool is_valid() const;
+ void set_event(const Ref<InputEvent> &p_shortcut);
+ Ref<InputEvent> get_event() const;
+ bool matches_event(const Ref<InputEvent> &p_event) const;
+ bool has_valid_event() const;
String get_as_text() const;
-
- Shortcut();
};
#endif // SHORTCUT_H
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 424a54f344..44d524f142 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -76,8 +76,9 @@ void Shader::get_param_list(List<PropertyInfo> *p_params) const {
if (default_textures.has(pi.name)) { //do not show default textures
continue;
}
+ String original_name = pi.name;
pi.name = "shader_param/" + pi.name;
- params_cache[pi.name] = pi.name;
+ params_cache[pi.name] = original_name;
if (p_params) {
//small little hack
if (pi.type == Variant::RID) {
diff --git a/tests/data/translations.csv b/tests/data/translations.csv
index 4c9ad4996a..8cb7b800c5 100644
--- a/tests/data/translations.csv
+++ b/tests/data/translations.csv
@@ -1,3 +1,8 @@
keys,en,de
GOOD_MORNING,"Good Morning","Guten Morgen"
GOOD_EVENING,"Good Evening",""
+Without quotes,"With, comma","With ""inner"" quotes","With ""inner"", quotes"","" and comma","With ""inner
+split"" quotes and
+line breaks","With \nnewline chars"
+Some other~delimiter~should still work, shouldn't it?
+What about tab separated lines, good?
diff --git a/tests/test_file_access.h b/tests/test_file_access.h
index cb74e08a0d..b3da16c1d1 100644
--- a/tests/test_file_access.h
+++ b/tests/test_file_access.h
@@ -37,12 +37,12 @@
namespace TestFileAccess {
TEST_CASE("[FileAccess] CSV read") {
- FileAccess *f = FileAccess::open(TestUtils::get_data_path("translations.csv"), FileAccess::READ);
+ FileAccessRef f = FileAccess::open(TestUtils::get_data_path("translations.csv"), FileAccess::READ);
- Vector<String> header = f->get_csv_line(); // Default delimiter: ","
+ Vector<String> header = f->get_csv_line(); // Default delimiter: ",".
REQUIRE(header.size() == 3);
- Vector<String> row1 = f->get_csv_line(",");
+ Vector<String> row1 = f->get_csv_line(","); // Explicit delimiter, should be the same.
REQUIRE(row1.size() == 3);
CHECK(row1[0] == "GOOD_MORNING");
CHECK(row1[1] == "Good Morning");
@@ -53,12 +53,31 @@ TEST_CASE("[FileAccess] CSV read") {
CHECK(row2[0] == "GOOD_EVENING");
CHECK(row2[1] == "Good Evening");
CHECK(row2[2] == ""); // Use case: not yet translated!
-
// https://github.com/godotengine/godot/issues/44269
CHECK_MESSAGE(row2[2] != "\"", "Should not parse empty string as a single double quote.");
+ Vector<String> row3 = f->get_csv_line();
+ REQUIRE(row3.size() == 6);
+ CHECK(row3[0] == "Without quotes");
+ CHECK(row3[1] == "With, comma");
+ CHECK(row3[2] == "With \"inner\" quotes");
+ CHECK(row3[3] == "With \"inner\", quotes\",\" and comma");
+ CHECK(row3[4] == "With \"inner\nsplit\" quotes and\nline breaks");
+ CHECK(row3[5] == "With \\nnewline chars"); // Escaped, not an actual newline.
+
+ Vector<String> row4 = f->get_csv_line("~"); // Custom delimiter, makes inline commas easier.
+ REQUIRE(row4.size() == 3);
+ CHECK(row4[0] == "Some other");
+ CHECK(row4[1] == "delimiter");
+ CHECK(row4[2] == "should still work, shouldn't it?");
+
+ Vector<String> row5 = f->get_csv_line("\t"); // Tab separated variables.
+ REQUIRE(row5.size() == 3);
+ CHECK(row5[0] == "What about");
+ CHECK(row5[1] == "tab separated");
+ CHECK(row5[2] == "lines, good?");
+
f->close();
- memdelete(f);
}
} // namespace TestFileAccess