From 404ee1a56b138ac6280c0cba9dbd9ea92b9e9a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 21 Aug 2018 21:28:06 +0200 Subject: [PATCH] Style: Fix issues that went past CI --- .../animation_blend_space_1d_editor.cpp | 25 ++--- .../plugins/animation_blend_space_1d_editor.h | 2 +- .../animation_blend_space_2d_editor.cpp | 16 +-- .../plugins/animation_blend_space_2d_editor.h | 4 +- editor/spatial_editor_gizmos.cpp | 2 +- modules/mono/utils/thread_local.cpp | 4 +- modules/mono/utils/thread_local.h | 3 +- scene/animation/animation_blend_space_1d.cpp | 35 +++--- scene/animation/animation_blend_space_1d.h | 2 - scene/animation/animation_blend_space_2d.cpp | 33 ++---- scene/animation/animation_blend_space_2d.h | 2 - scene/animation/animation_tree.cpp | 105 ++++++++---------- scene/main/node.cpp | 2 +- 13 files changed, 92 insertions(+), 143 deletions(-) diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 1106464edfe..53730156542 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -4,11 +4,10 @@ #include "scene/animation/animation_blend_tree.h" StringName AnimationNodeBlendSpace1DEditor::get_blend_position_path() const { - StringName path = AnimationTreeEditor::get_singleton()->get_base_path()+"blend_position"; + StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + "blend_position"; return path; } - void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref &p_event) { Ref k = p_event; @@ -55,7 +54,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refget_item_count(); - menu->add_item(vformat("Add %s", name),idx); + menu->add_item(vformat("Add %s", name), idx); menu->set_item_metadata(idx, E->get()); } @@ -136,7 +135,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refget_max_space() - blend_space->get_min_space(); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -159,7 +158,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Refget_max_space() - blend_space->get_min_space(); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -258,7 +257,6 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() { float point = AnimationTreeEditor::get_singleton()->get_tree()->get(get_blend_position_path()); - point = (point - blend_space->get_min_space()) / (blend_space->get_max_space() - blend_space->get_min_space()); point *= s.width; @@ -501,8 +499,6 @@ void AnimationNodeBlendSpace1DEditor::_open_editor() { } } - - void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); @@ -514,7 +510,6 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { tool_erase->set_icon(get_icon("Remove", "EditorIcons")); snap->set_icon(get_icon("SnapGrid", "EditorIcons")); open_editor->set_icon(get_icon("Edit", "EditorIcons")); - } if (p_what == NOTIFICATION_PROCESS) { @@ -536,7 +531,7 @@ void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { } } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process(is_visible_in_tree()); } } @@ -561,22 +556,17 @@ void AnimationNodeBlendSpace1DEditor::_bind_methods() { ClassDB::bind_method("_open_editor", &AnimationNodeBlendSpace1DEditor::_open_editor); ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace1DEditor::_file_opened); - - - } bool AnimationNodeBlendSpace1DEditor::can_edit(const Ref &p_node) { - Ref b1d=p_node; + Ref b1d = p_node; return b1d.is_valid(); } void AnimationNodeBlendSpace1DEditor::edit(const Ref &p_node) { - - - blend_space=p_node; + blend_space = p_node; if (!blend_space.is_null()) { _update_space(); @@ -595,7 +585,6 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { Ref bg; bg.instance(); - tool_blend = memnew(ToolButton); tool_blend->set_toggle_mode(true); tool_blend->set_button_group(bg); diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h index f040f6dcab4..278357b9c74 100644 --- a/editor/plugins/animation_blend_space_1d_editor.h +++ b/editor/plugins/animation_blend_space_1d_editor.h @@ -3,13 +3,13 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" +#include "editor/plugins/animation_tree_editor_plugin.h" #include "editor/property_editor.h" #include "scene/animation/animation_blend_space_1d.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit.h" #include "scene/gui/popup.h" #include "scene/gui/tree.h" -#include "editor/plugins/animation_tree_editor_plugin.h" class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin { diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index e008971e5c8..e5476aaf081 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -13,7 +13,7 @@ bool AnimationNodeBlendSpace2DEditor::can_edit(const Ref &p_node) { - Ref bs2d=p_node; + Ref bs2d = p_node; return bs2d.is_valid(); } @@ -27,7 +27,7 @@ void AnimationNodeBlendSpace2DEditor::edit(const Ref &p_node) { } StringName AnimationNodeBlendSpace2DEditor::get_blend_position_path() const { - StringName path = AnimationTreeEditor::get_singleton()->get_base_path()+"blend_position"; + StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + "blend_position"; return path; } @@ -73,7 +73,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refget_item_count(); - menu->add_item(vformat("Add %s", name),idx); + menu->add_item(vformat("Add %s", name), idx); menu->set_item_metadata(idx, E->get()); } @@ -85,7 +85,6 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refadd_separator(); menu->add_item(TTR("Load.."), MENU_LOAD_FILE); - menu->set_global_position(blend_space_draw->get_global_transform().xform(mb->get_position())); menu->popup(); add_point_pos = (mb->get_position() / blend_space_draw->get_size()); @@ -211,7 +210,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refget_max_space() - blend_space->get_min_space()); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -246,7 +245,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Refget_max_space() - blend_space->get_min_space()); blend_pos += blend_space->get_min_space(); - AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(),blend_pos); + AnimationTreeEditor::get_singleton()->get_tree()->set(get_blend_position_path(), blend_pos); blend_space_draw->update(); } @@ -750,12 +749,11 @@ void AnimationNodeBlendSpace2DEditor::_notification(int p_what) { } } - if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + if (p_what == NOTIFICATION_VISIBILITY_CHANGED) { set_process(is_visible_in_tree()); } } - void AnimationNodeBlendSpace2DEditor::_open_editor() { if (selected_point >= 0 && selected_point < blend_space->get_blend_point_count()) { @@ -804,7 +802,6 @@ void AnimationNodeBlendSpace2DEditor::_bind_methods() { ClassDB::bind_method("_auto_triangles_toggled", &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled); ClassDB::bind_method("_file_opened", &AnimationNodeBlendSpace2DEditor::_file_opened); - } AnimationNodeBlendSpace2DEditor *AnimationNodeBlendSpace2DEditor::singleton = NULL; @@ -1019,4 +1016,3 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { dragging_selected = false; dragging_selected_attempt = false; } - diff --git a/editor/plugins/animation_blend_space_2d_editor.h b/editor/plugins/animation_blend_space_2d_editor.h index ae684985f34..0bf1e25d7a9 100644 --- a/editor/plugins/animation_blend_space_2d_editor.h +++ b/editor/plugins/animation_blend_space_2d_editor.h @@ -3,13 +3,13 @@ #include "editor/editor_node.h" #include "editor/editor_plugin.h" +#include "editor/plugins/animation_tree_editor_plugin.h" #include "editor/property_editor.h" #include "scene/animation/animation_blend_space_2d.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit.h" #include "scene/gui/popup.h" #include "scene/gui/tree.h" -#include "editor/plugins/animation_tree_editor_plugin.h" /** @author Juan Linietsky */ @@ -20,7 +20,6 @@ class AnimationNodeBlendSpace2DEditor : public AnimationTreeNodeEditorPlugin { Ref blend_space; - PanelContainer *panel; ToolButton *tool_blend; ToolButton *tool_select; @@ -119,5 +118,4 @@ public: AnimationNodeBlendSpace2DEditor(); }; - #endif // ANIMATION_BLEND_SPACE_2D_EDITOR_H diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 20ddfa99a82..64638cdb1e9 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -3655,7 +3655,7 @@ void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->add_collision_segments(lines); } - ////// +////// #define BODY_A_RADIUS 0.25 #define BODY_B_RADIUS 0.27 diff --git a/modules/mono/utils/thread_local.cpp b/modules/mono/utils/thread_local.cpp index ae9f1305183..a0e28fca5fa 100644 --- a/modules/mono/utils/thread_local.cpp +++ b/modules/mono/utils/thread_local.cpp @@ -69,7 +69,7 @@ struct ThreadLocalStorage::Impl { #define _CALLBACK_FUNC_ #endif - Impl(void (_CALLBACK_FUNC_ *p_destr_callback_func)(void *)) { + Impl(void(_CALLBACK_FUNC_ *p_destr_callback_func)(void *)) { #ifdef WINDOWS_ENABLED dwFlsIndex = FlsAlloc(p_destr_callback_func); ERR_FAIL_COND(dwFlsIndex == FLS_OUT_OF_INDEXES); @@ -95,7 +95,7 @@ void ThreadLocalStorage::set_value(void *p_value) const { pimpl->set_value(p_value); } -void ThreadLocalStorage::alloc(void (_CALLBACK_FUNC_ *p_destr_callback)(void *)) { +void ThreadLocalStorage::alloc(void(_CALLBACK_FUNC_ *p_destr_callback)(void *)) { pimpl = memnew(ThreadLocalStorage::Impl(p_destr_callback)); } diff --git a/modules/mono/utils/thread_local.h b/modules/mono/utils/thread_local.h index 783e40dc019..84dae1d86b6 100644 --- a/modules/mono/utils/thread_local.h +++ b/modules/mono/utils/thread_local.h @@ -76,7 +76,7 @@ struct ThreadLocalStorage { void *get_value() const; void set_value(void *p_value) const; - void alloc(void (_CALLBACK_FUNC_ *p_dest_callback)(void *)); + void alloc(void(_CALLBACK_FUNC_ *p_dest_callback)(void *)); void free(); private: @@ -95,7 +95,6 @@ class ThreadLocal { memdelete(static_cast(tls_data)); } - T *_tls_get_value() const { void *tls_data = storage.get_value(); diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp index 2bde8a16c97..289cf7a3a75 100644 --- a/scene/animation/animation_blend_space_1d.cpp +++ b/scene/animation/animation_blend_space_1d.cpp @@ -1,8 +1,7 @@ #include "animation_blend_space_1d.h" - void AnimationNodeBlendSpace1D::get_parameter_list(List *r_list) const { - r_list->push_back(PropertyInfo(Variant::REAL,blend_position)); + r_list->push_back(PropertyInfo(Variant::REAL, blend_position)); } Variant AnimationNodeBlendSpace1D::get_parameter_default_value(const StringName &p_parameter) const { return 0; @@ -64,10 +63,10 @@ void AnimationNodeBlendSpace1D::_bind_methods() { } void AnimationNodeBlendSpace1D::get_child_nodes(List *r_child_nodes) { - for(int i=0;ipush_back(cn); } } @@ -89,12 +88,10 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref &p_ blend_points[p_at_index].node = p_node; blend_points[p_at_index].position = p_position; - blend_points[p_at_index].node->connect("tree_changed",this,"_tree_changed",varray(),CONNECT_REFERENCE_COUNTED); + blend_points[p_at_index].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); blend_points_used++; emit_signal("tree_changed"); - - } void AnimationNodeBlendSpace1D::set_blend_point_position(int p_point, float p_position) { @@ -108,14 +105,13 @@ void AnimationNodeBlendSpace1D::set_blend_point_node(int p_point, const Refdisconnect("tree_changed",this,"_tree_changed"); + blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); } blend_points[p_point].node = p_node; - blend_points[p_point].node->connect("tree_changed",this,"_tree_changed",varray(),CONNECT_REFERENCE_COUNTED); + blend_points[p_point].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); emit_signal("tree_changed"); - } float AnimationNodeBlendSpace1D::get_blend_point_position(int p_point) const { @@ -131,16 +127,14 @@ Ref AnimationNodeBlendSpace1D::get_blend_point_node(int p_poi void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) { ERR_FAIL_INDEX(p_point, blend_points_used); - blend_points[p_point].node->disconnect("tree_changed",this,"_tree_changed"); + blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); for (int i = p_point; i < blend_points_used - 1; i++) { blend_points[i] = blend_points[i + 1]; } - blend_points_used--; emit_signal("tree_changed"); - } int AnimationNodeBlendSpace1D::get_blend_point_count() const { @@ -180,7 +174,6 @@ float AnimationNodeBlendSpace1D::get_snap() const { return snap; } - void AnimationNodeBlendSpace1D::set_value_label(const String &p_label) { value_label = p_label; } @@ -203,10 +196,9 @@ float AnimationNodeBlendSpace1D::process(float p_time, bool p_seek) { return 0.0; } - if (blend_points_used == 1) { // only one point available, just play that animation - return blend_node(blend_points[0].name,blend_points[0].node, p_time, p_seek, 1.0, FILTER_IGNORE, false); + return blend_node(blend_points[0].name, blend_points[0].node, p_time, p_seek, 1.0, FILTER_IGNORE, false); } float blend_pos = get_parameter(blend_position); @@ -277,7 +269,7 @@ float AnimationNodeBlendSpace1D::process(float p_time, bool p_seek) { float max_time_remaining = 0.0; for (int i = 0; i < blend_points_used; i++) { - float remaining = blend_node(blend_points[i].name,blend_points[i].node, p_time, p_seek, weights[i], FILTER_IGNORE, false); + float remaining = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, weights[i], FILTER_IGNORE, false); max_time_remaining = MAX(max_time_remaining, remaining); } @@ -291,8 +283,8 @@ String AnimationNodeBlendSpace1D::get_caption() const { AnimationNodeBlendSpace1D::AnimationNodeBlendSpace1D() { - for(int i=0;i *r_list) const; virtual Variant get_parameter_default_value(const StringName &p_parameter) const; virtual void get_child_nodes(List *r_child_nodes); - void add_blend_point(const Ref &p_node, float p_position, int p_at_index = -1); void set_blend_point_position(int p_point, float p_position); void set_blend_point_node(int p_point, const Ref &p_node); diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index bce1477d4ed..3dc7f2a86f7 100644 --- a/scene/animation/animation_blend_space_2d.cpp +++ b/scene/animation/animation_blend_space_2d.cpp @@ -1,20 +1,18 @@ #include "animation_blend_space_2d.h" #include "math/delaunay.h" - void AnimationNodeBlendSpace2D::get_parameter_list(List *r_list) const { - r_list->push_back(PropertyInfo(Variant::VECTOR2,blend_position)); + r_list->push_back(PropertyInfo(Variant::VECTOR2, blend_position)); } Variant AnimationNodeBlendSpace2D::get_parameter_default_value(const StringName &p_parameter) const { return Vector2(); } - void AnimationNodeBlendSpace2D::get_child_nodes(List *r_child_nodes) { - for(int i=0;ipush_back(cn); } } @@ -41,15 +39,13 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref &p_ blend_points[p_at_index].node = p_node; blend_points[p_at_index].position = p_position; - blend_points[p_at_index].node->connect("tree_changed",this,"_tree_changed",varray(),CONNECT_REFERENCE_COUNTED); + blend_points[p_at_index].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); blend_points_used++; - if (auto_triangles) { trianges_dirty = true; } emit_signal("tree_changed"); - } void AnimationNodeBlendSpace2D::set_blend_point_position(int p_point, const Vector2 &p_position) { @@ -64,13 +60,12 @@ void AnimationNodeBlendSpace2D::set_blend_point_node(int p_point, const Refdisconnect("tree_changed",this,"_tree_changed"); + blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); } blend_points[p_point].node = p_node; - blend_points[p_point].node->connect("tree_changed",this,"_tree_changed",varray(),CONNECT_REFERENCE_COUNTED); + blend_points[p_point].node->connect("tree_changed", this, "_tree_changed", varray(), CONNECT_REFERENCE_COUNTED); emit_signal("tree_changed"); - } Vector2 AnimationNodeBlendSpace2D::get_blend_point_position(int p_point) const { ERR_FAIL_INDEX_V(p_point, blend_points_used, Vector2()); @@ -83,7 +78,7 @@ Ref AnimationNodeBlendSpace2D::get_blend_point_node(int p_poi void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) { ERR_FAIL_INDEX(p_point, blend_points_used); - blend_points[p_point].node->disconnect("tree_changed",this,"_tree_changed"); + blend_points[p_point].node->disconnect("tree_changed", this, "_tree_changed"); for (int i = 0; i < triangles.size(); i++) { bool erase = false; @@ -107,7 +102,6 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) { } blend_points_used--; emit_signal("tree_changed"); - } int AnimationNodeBlendSpace2D::get_blend_point_count() const { @@ -451,7 +445,7 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) { for (int j = 0; j < 3; j++) { if (i == triangle_points[j]) { //blend with the given weight - float t = blend_node(blend_points[i].name,blend_points[i].node, p_time, p_seek, blend_weights[j], FILTER_IGNORE, false); + float t = blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, blend_weights[j], FILTER_IGNORE, false); if (first || t < mind) { mind = t; first = false; @@ -463,7 +457,7 @@ float AnimationNodeBlendSpace2D::process(float p_time, bool p_seek) { if (!found) { //ignore - blend_node(blend_points[i].name,blend_points[i].node, p_time, p_seek, 0, FILTER_IGNORE, false); + blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, 0, FILTER_IGNORE, false); } } return mind; @@ -491,7 +485,6 @@ void AnimationNodeBlendSpace2D::set_auto_triangles(bool p_enable) { } } - bool AnimationNodeBlendSpace2D::get_auto_triangles() const { return auto_triangles; } @@ -562,8 +555,8 @@ void AnimationNodeBlendSpace2D::_bind_methods() { AnimationNodeBlendSpace2D::AnimationNodeBlendSpace2D() { - for(int i=0;i *r_list) const; virtual Variant get_parameter_default_value(const StringName &p_parameter) const; diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 68b0602c671..1513010a8a5 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -5,36 +5,32 @@ #include "scene/scene_string_names.h" #include "servers/audio/audio_stream.h" - - void AnimationNode::get_parameter_list(List *r_list) const { - } Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter) const { return Variant(); } -void AnimationNode::set_parameter(const StringName& p_name, const Variant& p_value) { +void AnimationNode::set_parameter(const StringName &p_name, const Variant &p_value) { ERR_FAIL_COND(!state); ERR_FAIL_COND(!state->tree->property_parent_map.has(base_path)); ERR_FAIL_COND(!state->tree->property_parent_map[base_path].has(p_name)); StringName path = state->tree->property_parent_map[base_path][p_name]; - state->tree->property_map[path]=p_value; + state->tree->property_map[path] = p_value; } -Variant AnimationNode::get_parameter(const StringName& p_name) const { - ERR_FAIL_COND_V(!state,Variant()); - ERR_FAIL_COND_V(!state->tree->property_parent_map.has(base_path),Variant()); - ERR_FAIL_COND_V(!state->tree->property_parent_map[base_path].has(p_name),Variant()); +Variant AnimationNode::get_parameter(const StringName &p_name) const { + ERR_FAIL_COND_V(!state, Variant()); + ERR_FAIL_COND_V(!state->tree->property_parent_map.has(base_path), Variant()); + ERR_FAIL_COND_V(!state->tree->property_parent_map[base_path].has(p_name), Variant()); StringName path = state->tree->property_parent_map[base_path][p_name]; return state->tree->property_map[path]; } void AnimationNode::get_child_nodes(List *r_child_nodes) { - } void AnimationNode::blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend) { @@ -46,7 +42,7 @@ void AnimationNode::blend_animation(const StringName &p_animation, float p_time, if (animation.is_null()) { - AnimationNodeBlendTree* btree = Object::cast_to(parent); + AnimationNodeBlendTree *btree = Object::cast_to(parent); if (btree) { String name = btree->get_node_name(Ref(this)); make_invalid(vformat(RTR("In node '%s', invalid animation: '%s'."), name, p_animation)); @@ -69,11 +65,11 @@ void AnimationNode::blend_animation(const StringName &p_animation, float p_time, state->animation_states.push_back(anim_state); } -float AnimationNode::_pre_process(const StringName& p_base_path, AnimationNode *p_parent, State *p_state, float p_time, bool p_seek, const Vector& p_connections) { +float AnimationNode::_pre_process(const StringName &p_base_path, AnimationNode *p_parent, State *p_state, float p_time, bool p_seek, const Vector &p_connections) { base_path = p_base_path; parent = p_parent; - connections=p_connections; + connections = p_connections; state = p_state; float t = process(p_time, p_seek); @@ -99,8 +95,8 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p ERR_FAIL_INDEX_V(p_input, inputs.size(), 0); ERR_FAIL_COND_V(!state, 0); - AnimationNodeBlendTree* blend_tree = Object::cast_to(parent); - ERR_FAIL_COND_V(!blend_tree,0); + AnimationNodeBlendTree *blend_tree = Object::cast_to(parent); + ERR_FAIL_COND_V(!blend_tree, 0); StringName node_name = connections[p_input]; @@ -114,15 +110,15 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p //inputs.write[p_input].last_pass = state->last_pass; float activity; - return _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); + return _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); } -float AnimationNode::blend_node(const StringName& p_sub_path,Ref p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) { +float AnimationNode::blend_node(const StringName &p_sub_path, Ref p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) { - return _blend_node(p_sub_path,Vector(),this,p_node, p_time, p_seek, p_blend, p_filter, p_optimize); + return _blend_node(p_sub_path, Vector(), this, p_node, p_time, p_seek, p_blend, p_filter, p_optimize); } -float AnimationNode::_blend_node(const StringName &p_subpath, const Vector& p_connections, AnimationNode *p_new_parent, Ref p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize, float *r_max) { +float AnimationNode::_blend_node(const StringName &p_subpath, const Vector &p_connections, AnimationNode *p_new_parent, Ref p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize, float *r_max) { ERR_FAIL_COND_V(!p_node.is_valid(), 0); ERR_FAIL_COND_V(!state, 0); @@ -229,13 +225,13 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vectorbase_path) + String(p_subpath)+"/"; + new_path = String(parent->base_path) + String(p_subpath) + "/"; } - return p_node->_pre_process(new_path,new_parent,state, p_time, p_seek, p_connections); + return p_node->_pre_process(new_path, new_parent, state, p_time, p_seek, p_connections); } int AnimationNode::get_input_count() const { @@ -247,7 +243,6 @@ String AnimationNode::get_input_name(int p_input) { return inputs[p_input].name; } - String AnimationNode::get_caption() const { if (get_script_instance()) { @@ -313,8 +308,6 @@ bool AnimationNode::has_filter() const { return false; } - - Array AnimationNode::_get_filters() const { Array paths; @@ -358,16 +351,15 @@ void AnimationNode::_bind_methods() { ClassDB::bind_method(D_METHOD("set_filter_enabled", "enable"), &AnimationNode::set_filter_enabled); ClassDB::bind_method(D_METHOD("is_filter_enabled"), &AnimationNode::is_filter_enabled); - ClassDB::bind_method(D_METHOD("_set_filters", "filters"), &AnimationNode::_set_filters); ClassDB::bind_method(D_METHOD("_get_filters"), &AnimationNode::_get_filters); ClassDB::bind_method(D_METHOD("blend_animation", "animation", "time", "delta", "seeked", "blend"), &AnimationNode::blend_animation); - ClassDB::bind_method(D_METHOD("blend_node", "name","node", "time", "seek", "blend", "filter", "optimize"), &AnimationNode::blend_node, DEFVAL(FILTER_IGNORE), DEFVAL(true)); + ClassDB::bind_method(D_METHOD("blend_node", "name", "node", "time", "seek", "blend", "filter", "optimize"), &AnimationNode::blend_node, DEFVAL(FILTER_IGNORE), DEFVAL(true)); ClassDB::bind_method(D_METHOD("blend_input", "input_index", "time", "seek", "blend", "filter", "optimize"), &AnimationNode::blend_input, DEFVAL(FILTER_IGNORE), DEFVAL(true)); - ClassDB::bind_method(D_METHOD("set_parameter","name","value"), &AnimationNode::set_parameter); - ClassDB::bind_method(D_METHOD("get_parameter","name"), &AnimationNode::get_parameter); + ClassDB::bind_method(D_METHOD("set_parameter", "name", "value"), &AnimationNode::set_parameter); + ClassDB::bind_method(D_METHOD("get_parameter", "name"), &AnimationNode::get_parameter); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_filter_enabled", "is_filter_enabled"); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "filters", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_filters", "_get_filters"); @@ -398,16 +390,16 @@ AnimationNode::AnimationNode() { void AnimationTree::set_tree_root(const Ref &p_root) { if (root.is_valid()) { - root->disconnect("tree_changed",this,"_tree_changed"); + root->disconnect("tree_changed", this, "_tree_changed"); } root = p_root; if (root.is_valid()) { - root->connect("tree_changed",this,"_tree_changed"); + root->connect("tree_changed", this, "_tree_changed"); } - properties_dirty=true; + properties_dirty = true; update_configuration_warning(); } @@ -738,11 +730,11 @@ void AnimationTree::_process_graph(float p_delta) { if (started) { //if started, seek - root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path,NULL,&state, 0, true,Vector()); + root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, 0, true, Vector()); started = false; } - root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path,NULL,&state, p_delta, false,Vector()); + root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, p_delta, false, Vector()); } if (!state.valid) { @@ -1284,27 +1276,27 @@ void AnimationTree::_tree_changed() { } call_deferred("_update_properties"); - properties_dirty=true; + properties_dirty = true; } -void AnimationTree::_update_properties_for_node(const String& p_base_path,Ref node) { +void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref node) { if (!property_parent_map.has(p_base_path)) { - property_parent_map[p_base_path]=HashMap(); + property_parent_map[p_base_path] = HashMap(); } List plist; node->get_parameter_list(&plist); - for(List::Element *E=plist.front();E;E=E->next()) { + for (List::Element *E = plist.front(); E; E = E->next()) { PropertyInfo pinfo = E->get(); StringName key = pinfo.name; - if (!property_map.has(p_base_path +key)) { + if (!property_map.has(p_base_path + key)) { property_map[p_base_path + key] = node->get_parameter_default_value(key); } - property_parent_map[p_base_path][key]=p_base_path+key; + property_parent_map[p_base_path][key] = p_base_path + key; pinfo.name = p_base_path + key; properties.push_back(pinfo); @@ -1313,8 +1305,8 @@ void AnimationTree::_update_properties_for_node(const String& p_base_path,Ref children; node->get_child_nodes(&children); - for (List::Element *E=children.front();E;E=E->next()) { - _update_properties_for_node(p_base_path+E->get().name+"/",E->get().node); + for (List::Element *E = children.front(); E; E = E->next()) { + _update_properties_for_node(p_base_path + E->get().name + "/", E->get().node); } } @@ -1327,7 +1319,7 @@ void AnimationTree::_update_properties() { property_parent_map.clear(); if (root.is_valid()) { - _update_properties_for_node(SceneStringNames::get_singleton()->parameters_base_path,root); + _update_properties_for_node(SceneStringNames::get_singleton()->parameters_base_path, root); } properties_dirty = false; @@ -1341,7 +1333,7 @@ bool AnimationTree::_set(const StringName &p_name, const Variant &p_value) { } if (property_map.has(p_name)) { - property_map[p_name]=p_value; + property_map[p_name] = p_value; #ifdef TOOLS_ENABLED _change_notify(p_name.operator String().utf8().get_data()); #endif @@ -1353,39 +1345,38 @@ bool AnimationTree::_set(const StringName &p_name, const Variant &p_value) { bool AnimationTree::_get(const StringName &p_name, Variant &r_ret) const { if (properties_dirty) { - const_cast(this)->_update_properties(); + const_cast(this)->_update_properties(); } if (property_map.has(p_name)) { - r_ret=property_map[p_name]; + r_ret = property_map[p_name]; return true; } return false; - } void AnimationTree::_get_property_list(List *p_list) const { if (properties_dirty) { - const_cast(this)->_update_properties(); + const_cast(this)->_update_properties(); } - for (const List::Element *E=properties.front();E;E=E->next()) { + for (const List::Element *E = properties.front(); E; E = E->next()) { p_list->push_back(E->get()); } } -void AnimationTree::rename_parameter(const String& p_base,const String& p_new_base) { +void AnimationTree::rename_parameter(const String &p_base, const String &p_new_base) { //rename values first - for (const List::Element *E=properties.front();E;E=E->next()) { + for (const List::Element *E = properties.front(); E; E = E->next()) { if (E->get().name.begins_with(p_base)) { - String new_name = E->get().name.replace_first(p_base,p_new_base); - property_map[new_name]=property_map[E->get().name]; + String new_name = E->get().name.replace_first(p_base, p_new_base); + property_map[new_name] = property_map[E->get().name]; } } //update tree second - properties_dirty=true; + properties_dirty = true; _update_properties(); } @@ -1410,8 +1401,7 @@ void AnimationTree::_bind_methods() { ClassDB::bind_method(D_METHOD("_tree_changed"), &AnimationTree::_tree_changed); ClassDB::bind_method(D_METHOD("_update_properties"), &AnimationTree::_update_properties); - ClassDB::bind_method(D_METHOD("rename_parameter","old_name","new_name"), &AnimationTree::rename_parameter); - + ClassDB::bind_method(D_METHOD("rename_parameter", "old_name", "new_name"), &AnimationTree::rename_parameter); ClassDB::bind_method(D_METHOD("advance", "delta"), &AnimationTree::advance); @@ -1440,5 +1430,4 @@ AnimationTree::AnimationTree() { } AnimationTree::~AnimationTree() { - } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index d6a80bfb1a2..f6905e7c2e7 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -240,7 +240,7 @@ void Node::_propagate_enter_tree() { void Node::_propagate_exit_tree() { -//block while removing children + //block while removing children #ifdef DEBUG_ENABLED