Merge pull request #78237 from dsnopek/webrtc-gdextension-create-data-channel
Directly expose `WebRTCPeerConnection::create_data_channel()` to GDExtension
This commit is contained in:
commit
fe1aa263ca
|
@ -6,6 +6,10 @@ should instead be used to justify these changes and describe how users should wo
|
||||||
|
|
||||||
========================================================================================================================
|
========================================================================================================================
|
||||||
|
|
||||||
|
GH-78237
|
||||||
|
--------
|
||||||
|
Validate extension JSON: Error: Field 'classes/WebRTCPeerConnectionExtension/methods/_create_data_channel/return_value': type changed value in new API, from "Object" to "WebRTCDataChannel".
|
||||||
|
|
||||||
GH-77757
|
GH-77757
|
||||||
--------
|
--------
|
||||||
Validate extension JSON: Error: Field 'classes/Viewport/methods/gui_get_focus_owner': is_const changed value in new API, from false to true.
|
Validate extension JSON: Error: Field 'classes/Viewport/methods/gui_get_focus_owner': is_const changed value in new API, from false to true.
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="_create_data_channel" qualifiers="virtual">
|
<method name="_create_data_channel" qualifiers="virtual">
|
||||||
<return type="Object" />
|
<return type="WebRTCDataChannel" />
|
||||||
<param index="0" name="p_label" type="String" />
|
<param index="0" name="p_label" type="String" />
|
||||||
<param index="1" name="p_config" type="Dictionary" />
|
<param index="1" name="p_config" type="Dictionary" />
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -43,14 +43,3 @@ void WebRTCPeerConnectionExtension::_bind_methods() {
|
||||||
GDVIRTUAL_BIND(_poll);
|
GDVIRTUAL_BIND(_poll);
|
||||||
GDVIRTUAL_BIND(_close);
|
GDVIRTUAL_BIND(_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<WebRTCDataChannel> WebRTCPeerConnectionExtension::create_data_channel(String p_label, Dictionary p_options) {
|
|
||||||
Object *ret = nullptr;
|
|
||||||
if (GDVIRTUAL_CALL(_create_data_channel, p_label, p_options, ret)) {
|
|
||||||
WebRTCDataChannel *ch = Object::cast_to<WebRTCDataChannel>(ret);
|
|
||||||
ERR_FAIL_COND_V_MSG(ret && !ch, nullptr, "Returned object must be an instance of WebRTCDataChannel.");
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
WARN_PRINT_ONCE("WebRTCPeerConnectionExtension::_create_data_channel is unimplemented!");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
|
@ -45,17 +45,12 @@ protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// FIXME Can't be directly exposed due to issues in exchanging Ref(s) between godot and extensions.
|
|
||||||
// See godot-cpp GH-652 .
|
|
||||||
virtual Ref<WebRTCDataChannel> create_data_channel(String p_label, Dictionary p_options = Dictionary()) override;
|
|
||||||
GDVIRTUAL2R(Object *, _create_data_channel, String, Dictionary);
|
|
||||||
// EXBIND2R(Ref<WebRTCDataChannel>, create_data_channel, String, Dictionary);
|
|
||||||
|
|
||||||
/** GDExtension **/
|
/** GDExtension **/
|
||||||
EXBIND0RC(ConnectionState, get_connection_state);
|
EXBIND0RC(ConnectionState, get_connection_state);
|
||||||
EXBIND0RC(GatheringState, get_gathering_state);
|
EXBIND0RC(GatheringState, get_gathering_state);
|
||||||
EXBIND0RC(SignalingState, get_signaling_state);
|
EXBIND0RC(SignalingState, get_signaling_state);
|
||||||
EXBIND1R(Error, initialize, Dictionary);
|
EXBIND1R(Error, initialize, Dictionary);
|
||||||
|
EXBIND2R(Ref<WebRTCDataChannel>, create_data_channel, String, Dictionary);
|
||||||
EXBIND0R(Error, create_offer);
|
EXBIND0R(Error, create_offer);
|
||||||
EXBIND2R(Error, set_remote_description, String, String);
|
EXBIND2R(Error, set_remote_description, String, String);
|
||||||
EXBIND2R(Error, set_local_description, String, String);
|
EXBIND2R(Error, set_local_description, String, String);
|
||||||
|
|
Loading…
Reference in New Issue