From 0b67d1665d94f91069e9163087f51c632d5b4d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 24 Aug 2018 16:50:29 +0200 Subject: [PATCH] Style: Fix previous commits from @reduz --- editor/plugins/skeleton_editor_plugin.cpp | 3 +-- scene/animation/animation_tree.cpp | 30 ++++++++++------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/editor/plugins/skeleton_editor_plugin.cpp b/editor/plugins/skeleton_editor_plugin.cpp index d871922c8b..314db4198d 100644 --- a/editor/plugins/skeleton_editor_plugin.cpp +++ b/editor/plugins/skeleton_editor_plugin.cpp @@ -128,11 +128,10 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i void SkeletonEditor::edit(Skeleton *p_node) { skeleton = p_node; - } void SkeletonEditor::_notification(int p_what) { - if (p_what==NOTIFICATION_ENTER_TREE) { + if (p_what == NOTIFICATION_ENTER_TREE) { get_tree()->connect("node_removed", this, "_node_removed"); } } diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index d084369a0e..73bd00e456 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -109,12 +109,12 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p Ref node = blend_tree->get_node(node_name); //inputs.write[p_input].last_pass = state->last_pass; - float activity=0; + float activity = 0; float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), NULL, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity); Vector *activity_ptr = state->tree->input_activity_map.getptr(base_path); - if (activity_ptr && p_inputsize()) { + if (activity_ptr && p_input < activity_ptr->size()) { activity_ptr->write[p_input].last_pass = state->last_pass; activity_ptr->write[p_input].activity = activity; } @@ -674,7 +674,6 @@ void AnimationTree::_clear_caches() { cache_valid = false; } - void AnimationTree::_process_graph(float p_delta) { _update_properties(); //if properties need updating, update them @@ -699,10 +698,10 @@ void AnimationTree::_process_graph(float p_delta) { AnimationPlayer *player = Object::cast_to(get_node(animation_player)); - ObjectID current_animation_player =0; + ObjectID current_animation_player = 0; if (player) { - current_animation_player=player->get_instance_id(); + current_animation_player = player->get_instance_id(); } if (last_animation_player != current_animation_player) { @@ -710,16 +709,15 @@ void AnimationTree::_process_graph(float p_delta) { if (last_animation_player) { Object *old_player = ObjectDB::get_instance(last_animation_player); if (old_player) { - old_player->disconnect("caches_cleared",this,"_clear_caches"); + old_player->disconnect("caches_cleared", this, "_clear_caches"); } } if (player) { - player->connect("caches_cleared",this,"_clear_caches"); + player->connect("caches_cleared", this, "_clear_caches"); } last_animation_player = current_animation_player; - } if (!player) { @@ -1225,10 +1223,9 @@ void AnimationTree::_notification(int p_what) { Object *old_player = ObjectDB::get_instance(last_animation_player); if (old_player) { - old_player->disconnect("caches_cleared",this,"_clear_caches"); + old_player->disconnect("caches_cleared", this, "_clear_caches"); } } - } } @@ -1328,13 +1325,13 @@ void AnimationTree::_update_properties_for_node(const String &p_base_path, Refget_input_count() && !input_activity_map.has(p_base_path)) { Vector activity; - for(int i=0;iget_input_count();i++) { + for (int i = 0; i < node->get_input_count(); i++) { Activity a; - a.last_pass=0; + a.last_pass = 0; activity.push_back(a); } input_activity_map[p_base_path] = activity; - input_activity_map_get[String(p_base_path).substr(0,String(p_base_path).length()-1)]=&input_activity_map[p_base_path]; + input_activity_map_get[String(p_base_path).substr(0, String(p_base_path).length() - 1)] = &input_activity_map[p_base_path]; } List plist; @@ -1434,14 +1431,14 @@ void AnimationTree::rename_parameter(const String &p_base, const String &p_new_b _update_properties(); } -float AnimationTree::get_connection_activity(const StringName& p_path,int p_connection) const { +float AnimationTree::get_connection_activity(const StringName &p_path, int p_connection) const { if (!input_activity_map_get.has(p_path)) { return 0; } const Vector *activity = input_activity_map_get[p_path]; - if (!activity || p_connection<0 || p_connection>=activity->size()) { + if (!activity || p_connection < 0 || p_connection >= activity->size()) { return 0; } @@ -1452,7 +1449,6 @@ float AnimationTree::get_connection_activity(const StringName& p_path,int p_conn return (*activity)[p_connection].activity; } - void AnimationTree::_bind_methods() { ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationTree::set_active); ClassDB::bind_method(D_METHOD("is_active"), &AnimationTree::is_active); @@ -1501,7 +1497,7 @@ AnimationTree::AnimationTree() { setup_pass = 1; started = true; properties_dirty = true; - last_animation_player =0; + last_animation_player = 0; } AnimationTree::~AnimationTree() {