diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2017-03-05 16:44:50 +0100 |
commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /scene/3d/listener.cpp | |
parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
download | redot-engine-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'scene/3d/listener.cpp')
-rw-r--r-- | scene/3d/listener.cpp | 62 |
1 files changed, 21 insertions, 41 deletions
diff --git a/scene/3d/listener.cpp b/scene/3d/listener.cpp index 578044ad09..fc9326b571 100644 --- a/scene/3d/listener.cpp +++ b/scene/3d/listener.cpp @@ -31,8 +31,6 @@ #include "scene/resources/mesh.h" void Listener::_update_audio_listener_state() { - - } void Listener::_request_listener_update() { @@ -40,53 +38,48 @@ void Listener::_request_listener_update() { _update_listener(); } -bool Listener::_set(const StringName& p_name, const Variant& p_value) { +bool Listener::_set(const StringName &p_name, const Variant &p_value) { if (p_name == "current") { if (p_value.operator bool()) { make_current(); - } - else { + } else { clear_current(); } - } - else + } else return false; return true; } -bool Listener::_get(const StringName& p_name,Variant &r_ret) const { +bool Listener::_get(const StringName &p_name, Variant &r_ret) const { if (p_name == "current") { if (is_inside_tree() && get_tree()->is_node_being_edited(this)) { r_ret = current; - } - else { + } else { r_ret = is_current(); } - } - else + } else return false; return true; } -void Listener::_get_property_list( List<PropertyInfo> *p_list) const { +void Listener::_get_property_list(List<PropertyInfo> *p_list) const { - p_list->push_back( PropertyInfo( Variant::BOOL, "current" ) ); + p_list->push_back(PropertyInfo(Variant::BOOL, "current")); } void Listener::_update_listener() { if (is_inside_tree() && is_current()) { get_viewport()->_listener_transform_changed_notify(); - } } void Listener::_notification(int p_what) { - switch(p_what) { + switch (p_what) { case NOTIFICATION_ENTER_WORLD: { bool first_listener = get_viewport()->_listener_add(this); @@ -101,24 +94,19 @@ void Listener::_notification(int p_what) { if (!get_tree()->is_node_being_edited(this)) { if (is_current()) { clear_current(); - current=true; //keep it true + current = true; //keep it true } else { - current=false; + current = false; } } get_viewport()->_listener_remove(this); - } break; - - } - } - Transform Listener::get_listener_transform() const { return get_global_transform().orthonormalized(); @@ -126,7 +114,7 @@ Transform Listener::get_listener_transform() const { void Listener::make_current() { - current=true; + current = true; if (!is_inside_tree()) return; @@ -134,27 +122,23 @@ void Listener::make_current() { get_viewport()->_listener_set(this); } - - - void Listener::clear_current() { - current=false; + current = false; if (!is_inside_tree()) return; - if (get_viewport()->get_listener()==this) { + if (get_viewport()->get_listener() == this) { get_viewport()->_listener_set(NULL); get_viewport()->_listener_make_next_current(this); } - } bool Listener::is_current() const { if (is_inside_tree() && !get_tree()->is_node_being_edited(this)) { - return get_viewport()->get_listener()==this; + return get_viewport()->get_listener() == this; } else return current; @@ -174,23 +158,19 @@ RES Listener::_get_gizmo_geometry() const { void Listener::_bind_methods() { - ClassDB::bind_method( D_METHOD("make_current"),&Listener::make_current ); - ClassDB::bind_method( D_METHOD("clear_current"),&Listener::clear_current ); - ClassDB::bind_method( D_METHOD("is_current"),&Listener::is_current ); - ClassDB::bind_method( D_METHOD("get_listener_transform"),&Listener::get_listener_transform ); + ClassDB::bind_method(D_METHOD("make_current"), &Listener::make_current); + ClassDB::bind_method(D_METHOD("clear_current"), &Listener::clear_current); + ClassDB::bind_method(D_METHOD("is_current"), &Listener::is_current); + ClassDB::bind_method(D_METHOD("get_listener_transform"), &Listener::get_listener_transform); } Listener::Listener() { - current=false; - force_change=false; + current = false; + force_change = false; set_notify_transform(true); //active=false; } - Listener::~Listener() { - } - - |