Merge pull request #97159 from noidexe/Expose-viewport-get-audio-listener

Expose Viewport methods to get current 2D/3D audio listener
This commit is contained in:
Rémi Verschelde 2024-09-20 16:06:39 +02:00
commit 7ce8e4fd6b
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 14 additions and 0 deletions

View File

@ -33,6 +33,18 @@
Returns the first valid [World3D] for this viewport, searching the [member world_3d] property of itself and any Viewport ancestor.
</description>
</method>
<method name="get_audio_listener_2d" qualifiers="const">
<return type="AudioListener2D" />
<description>
Returns the currently active 2D audio listener. Returns [code]null[/code] if there are no active 2D audio listeners, in which case the active 2D camera will be treated as listener.
</description>
</method>
<method name="get_audio_listener_3d" qualifiers="const">
<return type="AudioListener3D" />
<description>
Returns the currently active 3D audio listener. Returns [code]null[/code] if there are no active 3D audio listeners, in which case the active 3D camera will be treated as listener.
</description>
</method>
<method name="get_camera_2d" qualifiers="const">
<return type="Camera2D" />
<description>

View File

@ -4671,6 +4671,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_as_audio_listener_2d", "enable"), &Viewport::set_as_audio_listener_2d);
ClassDB::bind_method(D_METHOD("is_audio_listener_2d"), &Viewport::is_audio_listener_2d);
ClassDB::bind_method(D_METHOD("get_audio_listener_2d"), &Viewport::get_audio_listener_2d);
ClassDB::bind_method(D_METHOD("get_camera_2d"), &Viewport::get_camera_2d);
#ifndef _3D_DISABLED
@ -4681,6 +4682,7 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_use_own_world_3d", "enable"), &Viewport::set_use_own_world_3d);
ClassDB::bind_method(D_METHOD("is_using_own_world_3d"), &Viewport::is_using_own_world_3d);
ClassDB::bind_method(D_METHOD("get_audio_listener_3d"), &Viewport::get_audio_listener_3d);
ClassDB::bind_method(D_METHOD("get_camera_3d"), &Viewport::get_camera_3d);
ClassDB::bind_method(D_METHOD("set_as_audio_listener_3d", "enable"), &Viewport::set_as_audio_listener_3d);
ClassDB::bind_method(D_METHOD("is_audio_listener_3d"), &Viewport::is_audio_listener_3d);