diff options
Diffstat (limited to 'modules/gdnative')
-rw-r--r-- | modules/gdnative/doc_classes/GDNative.xml | 18 | ||||
-rw-r--r-- | modules/gdnative/doc_classes/GDNativeLibrary.xml | 6 | ||||
-rw-r--r-- | modules/gdnative/doc_classes/NativeScript.xml | 24 | ||||
-rw-r--r-- | modules/gdnative/doc_classes/PluginScript.xml | 3 | ||||
-rw-r--r-- | modules/gdnative/doc_classes/VideoStreamGDNative.xml | 9 | ||||
-rw-r--r-- | modules/gdnative/gdnative.cpp | 16 | ||||
-rw-r--r-- | modules/gdnative/gdnative/variant.cpp | 16 | ||||
-rw-r--r-- | modules/gdnative/include/net/godot_net.h | 2 | ||||
-rw-r--r-- | modules/gdnative/include/net/godot_webrtc.h | 5 | ||||
-rw-r--r-- | modules/gdnative/nativescript/api_generator.cpp | 22 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 6 | ||||
-rw-r--r-- | modules/gdnative/net/multiplayer_peer_gdnative.cpp | 11 | ||||
-rw-r--r-- | modules/gdnative/net/multiplayer_peer_gdnative.h | 2 | ||||
-rw-r--r-- | modules/gdnative/register_types.cpp | 12 | ||||
-rw-r--r-- | modules/gdnative/tests/test_variant.h | 4 |
15 files changed, 69 insertions, 87 deletions
diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml index 4f1530598c..e4c5d34a2c 100644 --- a/modules/gdnative/doc_classes/GDNative.xml +++ b/modules/gdnative/doc_classes/GDNative.xml @@ -8,26 +8,20 @@ </tutorials> <methods> <method name="call_native"> - <return type="Variant"> - </return> - <argument index="0" name="calling_type" type="StringName"> - </argument> - <argument index="1" name="procedure_name" type="StringName"> - </argument> - <argument index="2" name="arguments" type="Array"> - </argument> + <return type="Variant" /> + <argument index="0" name="calling_type" type="StringName" /> + <argument index="1" name="procedure_name" type="StringName" /> + <argument index="2" name="arguments" type="Array" /> <description> </description> </method> <method name="initialize"> - <return type="bool"> - </return> + <return type="bool" /> <description> </description> </method> <method name="terminate"> - <return type="bool"> - </return> + <return type="bool" /> <description> </description> </method> diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml index 05cda05f9f..f84d4e60f3 100644 --- a/modules/gdnative/doc_classes/GDNativeLibrary.xml +++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml @@ -12,15 +12,13 @@ </tutorials> <methods> <method name="get_current_dependencies" qualifiers="const"> - <return type="PackedStringArray"> - </return> + <return type="PackedStringArray" /> <description> Returns paths to all dependency libraries for the current platform and architecture. </description> </method> <method name="get_current_library_path" qualifiers="const"> - <return type="String"> - </return> + <return type="String" /> <description> Returns the path to the dynamic library file for the current platform and architecture. </description> diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml index f2e9cac6dc..397d12a3a9 100644 --- a/modules/gdnative/doc_classes/NativeScript.xml +++ b/modules/gdnative/doc_classes/NativeScript.xml @@ -8,42 +8,34 @@ </tutorials> <methods> <method name="get_class_documentation" qualifiers="const"> - <return type="String"> - </return> + <return type="String" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_class_documentation[/code]. </description> </method> <method name="get_method_documentation" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="method" type="StringName"> - </argument> + <return type="String" /> + <argument index="0" name="method" type="StringName" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_method_documentation[/code]. </description> </method> <method name="get_property_documentation" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="path" type="StringName"> - </argument> + <return type="String" /> + <argument index="0" name="path" type="StringName" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_property_documentation[/code]. </description> </method> <method name="get_signal_documentation" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="signal_name" type="StringName"> - </argument> + <return type="String" /> + <argument index="0" name="signal_name" type="StringName" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_signal_documentation[/code]. </description> </method> <method name="new" qualifiers="vararg"> - <return type="Variant"> - </return> + <return type="Variant" /> <description> Constructs a new object of the base type with a script of this type already attached. [i]Note[/i]: Any arguments passed to this function will be ignored and not passed to the native constructor function. This will change with in a future API extension. diff --git a/modules/gdnative/doc_classes/PluginScript.xml b/modules/gdnative/doc_classes/PluginScript.xml index 9616101090..8e28187482 100644 --- a/modules/gdnative/doc_classes/PluginScript.xml +++ b/modules/gdnative/doc_classes/PluginScript.xml @@ -8,8 +8,7 @@ </tutorials> <methods> <method name="new" qualifiers="vararg"> - <return type="Variant"> - </return> + <return type="Variant" /> <description> Returns a new instance of the script. </description> diff --git a/modules/gdnative/doc_classes/VideoStreamGDNative.xml b/modules/gdnative/doc_classes/VideoStreamGDNative.xml index 153988bad8..8b1a3210df 100644 --- a/modules/gdnative/doc_classes/VideoStreamGDNative.xml +++ b/modules/gdnative/doc_classes/VideoStreamGDNative.xml @@ -11,17 +11,14 @@ </tutorials> <methods> <method name="get_file"> - <return type="String"> - </return> + <return type="String" /> <description> Returns the video file handled by this [VideoStreamGDNative]. </description> </method> <method name="set_file"> - <return type="void"> - </return> - <argument index="0" name="file" type="String"> - </argument> + <return type="void" /> + <argument index="0" name="file" type="String" /> <description> Sets the video file that this [VideoStreamGDNative] resource handles. The supported extensions depend on the GDNative plugins used to expose video formats. </description> diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index 1ff591a87f..9445fac1c6 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -129,9 +129,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { config_file->get_section_keys("entry", &entry_key_list); } - for (List<String>::Element *E = entry_key_list.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_key_list) { PropertyInfo prop; prop.type = Variant::STRING; @@ -147,9 +145,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { config_file->get_section_keys("dependencies", &dependency_key_list); } - for (List<String>::Element *E = dependency_key_list.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : dependency_key_list) { PropertyInfo prop; prop.type = Variant::STRING; @@ -175,9 +171,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) { p_config_file->get_section_keys("entry", &entry_keys); } - for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -207,9 +201,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) { p_config_file->get_section_keys("dependencies", &dependency_keys); } - for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : dependency_keys) { Vector<String> tags = key.split("."); bool skip = false; diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index cfb57137bb..1d75ea206c 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -915,8 +915,8 @@ void GDAPI godot_variant_get_builtin_method_list(godot_variant_type p_type, godo List<StringName> list; Variant::get_builtin_method_list((Variant::Type)p_type, &list); int i = 0; - for (const List<StringName>::Element *E = list.front(); E; E = E->next()) { - memnew_placement_custom(&r_list[i], StringName, StringName(E->get())); + for (const StringName &E : list) { + memnew_placement_custom(&r_list[i], StringName, StringName(E)); } } @@ -970,8 +970,8 @@ void GDAPI godot_variant_get_member_list(godot_variant_type p_type, godot_string List<StringName> members; Variant::get_member_list((Variant::Type)p_type, &members); int i = 0; - for (const List<StringName>::Element *E = members.front(); E; E = E->next()) { - memnew_placement_custom(&r_list[i++], StringName, StringName(E->get())); + for (const StringName &E : members) { + memnew_placement_custom(&r_list[i++], StringName, StringName(E)); } } @@ -1075,8 +1075,8 @@ void GDAPI godot_variant_get_constants_list(godot_variant_type p_type, godot_str List<StringName> constants; int i = 0; Variant::get_constants_for_type((Variant::Type)p_type, &constants); - for (const List<StringName>::Element *E = constants.front(); E; E = E->next()) { - memnew_placement_custom(&r_list[i++], StringName, StringName(E->get())); + for (const StringName &E : constants) { + memnew_placement_custom(&r_list[i++], StringName, StringName(E)); } } @@ -1227,8 +1227,8 @@ void GDAPI godot_variant_get_utility_function_list(godot_string_name *r_function godot_string_name *func = r_functions; Variant::get_utility_function_list(&functions); - for (const List<StringName>::Element *E = functions.front(); E; E = E->next()) { - memnew_placement_custom(func++, StringName, StringName(E->get())); + for (const StringName &E : functions) { + memnew_placement_custom(func++, StringName, StringName(E)); } } 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/include/net/godot_webrtc.h b/modules/gdnative/include/net/godot_webrtc.h index 25aa72dae1..52006e56ec 100644 --- a/modules/gdnative/include/net/godot_webrtc.h +++ b/modules/gdnative/include/net/godot_webrtc.h @@ -37,8 +37,8 @@ extern "C" { #endif -#define GODOT_NET_WEBRTC_API_MAJOR 3 -#define GODOT_NET_WEBRTC_API_MINOR 2 +#define GODOT_NET_WEBRTC_API_MAJOR 4 +#define GODOT_NET_WEBRTC_API_MINOR 0 /* Library Interface (used to set default GDNative WebRTC implementation */ typedef struct { @@ -101,6 +101,7 @@ typedef struct { int (*get_max_retransmits)(const void *); const char *(*get_protocol)(const void *); bool (*is_negotiated)(const void *); + int (*get_buffered_amount)(const void *); godot_error (*poll)(void *); void (*close)(void *); diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index 477bc9f74d..df0f29277e 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -425,11 +425,11 @@ List<ClassAPI> generate_c_api_classes() { List<EnumAPI> enums; List<StringName> enum_names; ClassDB::get_enum_list(class_name, &enum_names, true); - for (List<StringName>::Element *E = enum_names.front(); E; E = E->next()) { + for (const StringName &E : enum_names) { List<StringName> value_names; EnumAPI enum_api; - enum_api.name = E->get(); - ClassDB::get_enum_constants(class_name, E->get(), &value_names, true); + enum_api.name = E; + ClassDB::get_enum_constants(class_name, E, &value_names, true); for (List<StringName>::Element *val_e = value_names.front(); val_e; val_e = val_e->next()) { int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), nullptr); enum_api.values.push_back(Pair<int, String>(int_val, val_e->get())); @@ -459,8 +459,8 @@ List<ClassAPI> generate_c_builtin_api_types() { List<StringName> utility_functions; Variant::get_utility_function_list(&utility_functions); - for (const List<StringName>::Element *E = utility_functions.front(); E; E = E->next()) { - const StringName &function_name = E->get(); + for (const StringName &E : utility_functions) { + const StringName &function_name = E; MethodAPI function_api; function_api.method_name = function_name; @@ -521,8 +521,8 @@ List<ClassAPI> generate_c_builtin_api_types() { List<StringName> methods; Variant::get_builtin_method_list(type, &methods); - for (const List<StringName>::Element *E = methods.front(); E; E = E->next()) { - const StringName &method_name = E->get(); + for (const StringName &E : methods) { + const StringName &method_name = E; MethodAPI method_api; @@ -578,8 +578,8 @@ List<ClassAPI> generate_c_builtin_api_types() { List<StringName> constants; Variant::get_constants_for_type(type, &constants); - for (const List<StringName>::Element *E = constants.front(); E; E = E->next()) { - const StringName &constant_name = E->get(); + for (const StringName &E : constants) { + const StringName &constant_name = E; ConstantAPI constant_api; constant_api.constant_name = constant_name; @@ -593,8 +593,8 @@ List<ClassAPI> generate_c_builtin_api_types() { List<StringName> members; Variant::get_member_list(type, &members); - for (const List<StringName>::Element *E = members.front(); E; E = E->next()) { - const StringName &member_name = E->get(); + for (const StringName &E : members) { + const StringName &member_name = E; PropertyAPI member_api; member_api.name = member_name; diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index d7943827c2..f3a0e9603f 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -98,10 +98,10 @@ void NativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) List<PropertyInfo> info; get_script_property_list(&info); Map<StringName, Variant> values; - for (List<PropertyInfo>::Element *E = info.front(); E; E = E->next()) { + for (const PropertyInfo &E : info) { Variant value; - get_property_default_value(E->get().name, value); - values[E->get().name] = value; + get_property_default_value(E.name, value); + values[E.name] = value; } p_placeholder->update(info, values); 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/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 8e5ae29ed9..a41c4f7b19 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -79,9 +79,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty List<String> entry_keys; config->get_section_keys("entry", &entry_keys); - for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -112,9 +110,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty List<String> dependency_keys; config->get_section_keys("dependencies", &dependency_keys); - for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : dependency_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -149,9 +145,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty List<String> entry_keys; config->get_section_keys("entry", &entry_keys); - for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_keys) { Vector<String> tags = key.split("."); bool skip = false; diff --git a/modules/gdnative/tests/test_variant.h b/modules/gdnative/tests/test_variant.h index 2850036604..c506882283 100644 --- a/modules/gdnative/tests/test_variant.h +++ b/modules/gdnative/tests/test_variant.h @@ -191,8 +191,8 @@ TEST_CASE("[GDNative Variant] Get utility function list") { godot_string_name *cur = c_list; - for (const List<StringName>::Element *E = cpp_list.front(); E; E = E->next()) { - const StringName &cpp_name = E->get(); + for (const StringName &E : cpp_list) { + const StringName &cpp_name = E; StringName *c_name = (StringName *)cur++; CHECK(*c_name == cpp_name); |