Changed get_audio_bus and set functions to get_audio_bus_name and set

and edited docs for Area2D due to renaming o get_audio_bus and set_audio_bus
This commit is contained in:
Marcelo Paez 2017-09-22 13:29:33 -03:00
parent 3237e05c36
commit 5e50fde3d9
4 changed files with 11 additions and 11 deletions

View File

@ -18,7 +18,7 @@
Return the angular damp rate. Return the angular damp rate.
</description> </description>
</method> </method>
<method name="get_audio_bus" qualifiers="const"> <method name="get_audio_bus_name" qualifiers="const">
<return type="String"> <return type="String">
</return> </return>
<description> <description>
@ -167,7 +167,7 @@
In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second. In practice, as the fraction of speed lost gets smaller with each frame, a value of 1.0 does not mean the object will stop in exactly one second. Only when the physics calculations are done at 1 frame per second, it does stop in a second.
</description> </description>
</method> </method>
<method name="set_audio_bus"> <method name="set_audio_bus_name">
<return type="void"> <return type="void">
</return> </return>
<argument index="0" name="name" type="String"> <argument index="0" name="name" type="String">
@ -320,7 +320,7 @@
<member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp"> <member name="angular_damp" type="float" setter="set_angular_damp" getter="get_angular_damp">
The rate at which objects stop spinning in this area. Represents the amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'. The rate at which objects stop spinning in this area. Represents the amount of speed lost per second. If 1.0, physics bodies in the area stop rotating immediately. If 0.0, they never slow down. Does not incorporate external forces. The physics-update's rate affects 'angular_damp'.
</member> </member>
<member name="audio_bus_name" type="String" setter="set_audio_bus" getter="get_audio_bus"> <member name="audio_bus_name" type="String" setter="set_audio_bus_name" getter="get_audio_bus_name">
The name of the Area2D's audio bus. The name of the Area2D's audio bus.
</member> </member>
<member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus"> <member name="audio_bus_override" type="bool" setter="set_audio_bus_override" getter="is_overriding_audio_bus">

View File

@ -557,12 +557,12 @@ bool Area2D::is_overriding_audio_bus() const {
return audio_bus_override; return audio_bus_override;
} }
void Area2D::set_audio_bus(const StringName &p_audio_bus) { void Area2D::set_audio_bus_name(const StringName &p_audio_bus) {
audio_bus = p_audio_bus; audio_bus = p_audio_bus;
} }
StringName Area2D::get_audio_bus() const { StringName Area2D::get_audio_bus_name() const {
for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) {
if (AudioServer::get_singleton()->get_bus_name(i) == audio_bus) { if (AudioServer::get_singleton()->get_bus_name(i) == audio_bus) {
@ -644,8 +644,8 @@ void Area2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("overlaps_body", "body"), &Area2D::overlaps_body); ClassDB::bind_method(D_METHOD("overlaps_body", "body"), &Area2D::overlaps_body);
ClassDB::bind_method(D_METHOD("overlaps_area", "area"), &Area2D::overlaps_area); ClassDB::bind_method(D_METHOD("overlaps_area", "area"), &Area2D::overlaps_area);
ClassDB::bind_method(D_METHOD("set_audio_bus", "name"), &Area2D::set_audio_bus); ClassDB::bind_method(D_METHOD("set_audio_bus_name", "name"), &Area2D::set_audio_bus_name);
ClassDB::bind_method(D_METHOD("get_audio_bus"), &Area2D::get_audio_bus); ClassDB::bind_method(D_METHOD("get_audio_bus_name"), &Area2D::get_audio_bus_name);
ClassDB::bind_method(D_METHOD("set_audio_bus_override", "enable"), &Area2D::set_audio_bus_override); ClassDB::bind_method(D_METHOD("set_audio_bus_override", "enable"), &Area2D::set_audio_bus_override);
ClassDB::bind_method(D_METHOD("is_overriding_audio_bus"), &Area2D::is_overriding_audio_bus); ClassDB::bind_method(D_METHOD("is_overriding_audio_bus"), &Area2D::is_overriding_audio_bus);
@ -679,7 +679,7 @@ void Area2D::_bind_methods() {
ADD_GROUP("Audio Bus", "audio_bus_"); ADD_GROUP("Audio Bus", "audio_bus_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_bus_override"), "set_audio_bus_override", "is_overriding_audio_bus"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "audio_bus_override"), "set_audio_bus_override", "is_overriding_audio_bus");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "audio_bus_name", PROPERTY_HINT_ENUM, ""), "set_audio_bus", "get_audio_bus"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "audio_bus_name", PROPERTY_HINT_ENUM, ""), "set_audio_bus_name", "get_audio_bus_name");
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_DISABLED); BIND_ENUM_CONSTANT(SPACE_OVERRIDE_DISABLED);
BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE); BIND_ENUM_CONSTANT(SPACE_OVERRIDE_COMBINE);

View File

@ -186,8 +186,8 @@ public:
void set_audio_bus_override(bool p_override); void set_audio_bus_override(bool p_override);
bool is_overriding_audio_bus() const; bool is_overriding_audio_bus() const;
void set_audio_bus(const StringName &p_audio_bus); void set_audio_bus_name(const StringName &p_audio_bus);
StringName get_audio_bus() const; StringName get_audio_bus_name() const;
Area2D(); Area2D();
~Area2D(); ~Area2D();

View File

@ -145,7 +145,7 @@ void AudioStreamPlayer2D::_notification(int p_what) {
if (!area2d->is_overriding_audio_bus()) if (!area2d->is_overriding_audio_bus())
continue; continue;
StringName bus_name = area2d->get_audio_bus(); StringName bus_name = area2d->get_audio_bus_name();
bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus_name); bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus_name);
break; break;
} }