Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Viewport methods to get current 2D/3D audio listener #97159

Merged

Conversation

noidexe
Copy link
Contributor

@noidexe noidexe commented Sep 18, 2024

This exposes the already existing Viewport::get_current_audio_listener_2d and Viewport::get_current_audio_listener_3d methods to scripting, in the same way that get_camera_2d and get_camera_3d are already exposed.

closes #54612

Copy link
Contributor

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no reason not to, to be honest.

@Mickeon Mickeon requested a review from KoBeWi September 18, 2024 21:16
@noidexe noidexe force-pushed the Expose-viewport-get-audio-listener branch from 7f6d54e to 73be914 Compare September 19, 2024 16:28
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a squash but otherwise looks good to me.

…er_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
@noidexe noidexe force-pushed the Expose-viewport-get-audio-listener branch from 73be914 to bdcee83 Compare September 19, 2024 21:43
@akien-mga akien-mga merged commit 7ce8e4f into godotengine:master Sep 20, 2024
19 checks passed
@akien-mga
Copy link
Member

Thanks!

<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.
Copy link
Member

@KoBeWi KoBeWi Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2D uses viewport transform for positional audio. Unlike 3D, you can hear sounds without any Camera2D in the scene.

Sorry for late review .-.

@noidexe noidexe deleted the Expose-viewport-get-audio-listener branch September 23, 2024 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Viewport.get_listener_2d() to the scripting API
5 participants