diff options
96 files changed, 1435 insertions, 827 deletions
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/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/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/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/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_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/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/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/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/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/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_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/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 a6f7a80d64..71d0593916 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs @@ -128,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/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/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) { |