diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-08-21 21:28:06 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2018-08-21 21:28:06 +0200 |
commit | 404ee1a56b138ac6280c0cba9dbd9ea92b9e9a24 (patch) | |
tree | 487b8cb630ccf39bfb6b930dcbb1c85b73db39de /scene/animation | |
parent | a319d72071eaf0d2e67d88f205c53e1eca331162 (diff) | |
download | redot-engine-404ee1a56b138ac6280c0cba9dbd9ea92b9e9a24.tar.gz |
Style: Fix issues that went past CI
Diffstat (limited to 'scene/animation')
-rw-r--r-- | scene/animation/animation_blend_space_1d.cpp | 35 | ||||
-rw-r--r-- | scene/animation/animation_blend_space_1d.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_blend_space_2d.cpp | 33 | ||||
-rw-r--r-- | scene/animation/animation_blend_space_2d.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_tree.cpp | 105 |
5 files changed, 72 insertions, 105 deletions
diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp index 2bde8a16c9..289cf7a3a7 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<PropertyInfo> *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<ChildNode> *r_child_nodes) { - for(int i=0;i<blend_points_used;i++) { + for (int i = 0; i < blend_points_used; i++) { ChildNode cn; - cn.name=itos(i); - cn.node=blend_points[i].node; + cn.name = itos(i); + cn.node = blend_points[i].node; r_child_nodes->push_back(cn); } } @@ -89,12 +88,10 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref<AnimationRootNode> &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 Ref<Anim ERR_FAIL_COND(p_node.is_null()); if (blend_points[p_point].node.is_valid()) { - blend_points[p_point].node->disconnect("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<AnimationRootNode> 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<MAX_BLEND_POINTS;i++) { - blend_points[i].name=itos(i); + for (int i = 0; i < MAX_BLEND_POINTS; i++) { + blend_points[i].name = itos(i); } blend_points_used = 0; max_space = 1; @@ -301,9 +293,8 @@ AnimationNodeBlendSpace1D::AnimationNodeBlendSpace1D() { snap = 0.1; value_label = "value"; - blend_position="blend_position"; + blend_position = "blend_position"; } AnimationNodeBlendSpace1D::~AnimationNodeBlendSpace1D() { - } diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h index b47accf973..f4e20f0d70 100644 --- a/scene/animation/animation_blend_space_1d.h +++ b/scene/animation/animation_blend_space_1d.h @@ -37,13 +37,11 @@ protected: static void _bind_methods(); public: - virtual void get_parameter_list(List<PropertyInfo> *r_list) const; virtual Variant get_parameter_default_value(const StringName &p_parameter) const; virtual void get_child_nodes(List<ChildNode> *r_child_nodes); - void add_blend_point(const Ref<AnimationRootNode> &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<AnimationRootNode> &p_node); diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index bce1477d4e..3dc7f2a86f 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<PropertyInfo> *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<ChildNode> *r_child_nodes) { - for(int i=0;i<blend_points_used;i++) { + for (int i = 0; i < blend_points_used; i++) { ChildNode cn; - cn.name=itos(i); - cn.node=blend_points[i].node; + cn.name = itos(i); + cn.node = blend_points[i].node; r_child_nodes->push_back(cn); } } @@ -41,15 +39,13 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref<AnimationRootNode> &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 Ref<Anim ERR_FAIL_COND(p_node.is_null()); if (blend_points[p_point].node.is_valid()) { - blend_points[p_point].node->disconnect("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<AnimationRootNode> 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<MAX_BLEND_POINTS;i++) { - blend_points[i].name=itos(i); + for (int i = 0; i < MAX_BLEND_POINTS; i++) { + blend_points[i].name = itos(i); } auto_triangles = true; blend_points_used = 0; @@ -577,6 +570,4 @@ AnimationNodeBlendSpace2D::AnimationNodeBlendSpace2D() { } AnimationNodeBlendSpace2D::~AnimationNodeBlendSpace2D() { - - } diff --git a/scene/animation/animation_blend_space_2d.h b/scene/animation/animation_blend_space_2d.h index 342909531b..3e1c66c924 100644 --- a/scene/animation/animation_blend_space_2d.h +++ b/scene/animation/animation_blend_space_2d.h @@ -45,13 +45,11 @@ class AnimationNodeBlendSpace2D : public AnimationRootNode { void _tree_changed(); - protected: virtual void _validate_property(PropertyInfo &property) const; static void _bind_methods(); public: - virtual void get_parameter_list(List<PropertyInfo> *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 68b0602c67..1513010a8a 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<PropertyInfo> *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<ChildNode> *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<AnimationNodeBlendTree>(parent); + AnimationNodeBlendTree *btree = Object::cast_to<AnimationNodeBlendTree>(parent); if (btree) { String name = btree->get_node_name(Ref<AnimationNodeAnimation>(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<StringName>& 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<StringName> &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<AnimationNodeBlendTree>(parent); - ERR_FAIL_COND_V(!blend_tree,0); + AnimationNodeBlendTree *blend_tree = Object::cast_to<AnimationNodeBlendTree>(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<AnimationNode> 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<AnimationNode> p_node, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) { - return _blend_node(p_sub_path,Vector<StringName>(),this,p_node, p_time, p_seek, p_blend, p_filter, p_optimize); + return _blend_node(p_sub_path, Vector<StringName>(), this, p_node, p_time, p_seek, p_blend, p_filter, p_optimize); } -float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<StringName>& p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> 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<StringName> &p_connections, AnimationNode *p_new_parent, Ref<AnimationNode> 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 Vector<Strin //this is the slowest part of processing, but as strings process in powers of 2, and the paths always exist, it will not result in that many allocations if (p_new_parent) { new_parent = p_new_parent; - new_path = String(base_path)+String(p_subpath)+"/"; + new_path = String(base_path) + String(p_subpath) + "/"; } else { - ERR_FAIL_COND_V(!parent,0); + ERR_FAIL_COND_V(!parent, 0); new_parent = parent; - new_path = String(parent->base_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<AnimationNode> &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<StringName>()); + root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, 0, true, Vector<StringName>()); started = false; } - root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path,NULL,&state, p_delta, false,Vector<StringName>()); + root->_pre_process(SceneStringNames::get_singleton()->parameters_base_path, NULL, &state, p_delta, false, Vector<StringName>()); } 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<AnimationNode> node) { +void AnimationTree::_update_properties_for_node(const String &p_base_path, Ref<AnimationNode> node) { if (!property_parent_map.has(p_base_path)) { - property_parent_map[p_base_path]=HashMap<StringName, StringName>(); + property_parent_map[p_base_path] = HashMap<StringName, StringName>(); } List<PropertyInfo> plist; node->get_parameter_list(&plist); - for(List<PropertyInfo>::Element *E=plist.front();E;E=E->next()) { + for (List<PropertyInfo>::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<An List<AnimationNode::ChildNode> children; node->get_child_nodes(&children); - for (List<AnimationNode::ChildNode>::Element *E=children.front();E;E=E->next()) { - _update_properties_for_node(p_base_path+E->get().name+"/",E->get().node); + for (List<AnimationNode::ChildNode>::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<AnimationTree*>(this)->_update_properties(); + const_cast<AnimationTree *>(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<PropertyInfo> *p_list) const { if (properties_dirty) { - const_cast<AnimationTree*>(this)->_update_properties(); + const_cast<AnimationTree *>(this)->_update_properties(); } - for (const List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) { + for (const List<PropertyInfo>::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<PropertyInfo>::Element *E=properties.front();E;E=E->next()) { + for (const List<PropertyInfo>::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() { - } |