diff options
author | Lisandro Lorea <lisandrolorea@gmail.com> | 2024-09-18 16:07:47 -0300 |
---|---|---|
committer | Lisandro Lorea <lisandrolorea@gmail.com> | 2024-09-19 18:43:33 -0300 |
commit | bdcee836adf52f38d5d89f3304556bd707a79705 (patch) | |
tree | f46afa249c8a7465d78690b4c438e2e297bd06c6 | |
parent | 0a4aedb36065f66fc7e99cb2e6de3e55242f9dfb (diff) | |
download | redot-engine-bdcee836adf52f38d5d89f3304556bd707a79705.tar.gz |
Expose Viewport::get_audio_listener_2d and Viewport::get_audio_listener_3d to scripting
Document exposed methods
Apply suggestions from code review
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
Document default behavior when no audio listeners are active
-rw-r--r-- | doc/classes/Viewport.xml | 12 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 85663e10b2..95a1d0f77e 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -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> diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index acf4f67673..ba69f8cc45 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -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); |