Style: Fix previous commits from @reduz

This commit is contained in:
Rémi Verschelde 2018-08-24 16:50:29 +02:00
parent f6c0a3fce9
commit 0b67d1665d
2 changed files with 14 additions and 19 deletions

View File

@ -128,11 +128,10 @@ PhysicalBone *SkeletonEditor::create_physical_bone(int bone_id, int bone_child_i
void SkeletonEditor::edit(Skeleton *p_node) { void SkeletonEditor::edit(Skeleton *p_node) {
skeleton = p_node; skeleton = p_node;
} }
void SkeletonEditor::_notification(int p_what) { 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"); get_tree()->connect("node_removed", this, "_node_removed");
} }
} }

View File

@ -109,12 +109,12 @@ float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p
Ref<AnimationNode> node = blend_tree->get_node(node_name); Ref<AnimationNode> node = blend_tree->get_node(node_name);
//inputs.write[p_input].last_pass = state->last_pass; //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); 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<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path); Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path);
if (activity_ptr && p_input<activity_ptr->size()) { if (activity_ptr && p_input < activity_ptr->size()) {
activity_ptr->write[p_input].last_pass = state->last_pass; activity_ptr->write[p_input].last_pass = state->last_pass;
activity_ptr->write[p_input].activity = activity; activity_ptr->write[p_input].activity = activity;
} }
@ -674,7 +674,6 @@ void AnimationTree::_clear_caches() {
cache_valid = false; cache_valid = false;
} }
void AnimationTree::_process_graph(float p_delta) { void AnimationTree::_process_graph(float p_delta) {
_update_properties(); //if properties need updating, update them _update_properties(); //if properties need updating, update them
@ -699,10 +698,10 @@ void AnimationTree::_process_graph(float p_delta) {
AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player)); AnimationPlayer *player = Object::cast_to<AnimationPlayer>(get_node(animation_player));
ObjectID current_animation_player =0; ObjectID current_animation_player = 0;
if (player) { if (player) {
current_animation_player=player->get_instance_id(); current_animation_player = player->get_instance_id();
} }
if (last_animation_player != current_animation_player) { if (last_animation_player != current_animation_player) {
@ -710,16 +709,15 @@ void AnimationTree::_process_graph(float p_delta) {
if (last_animation_player) { if (last_animation_player) {
Object *old_player = ObjectDB::get_instance(last_animation_player); Object *old_player = ObjectDB::get_instance(last_animation_player);
if (old_player) { if (old_player) {
old_player->disconnect("caches_cleared",this,"_clear_caches"); old_player->disconnect("caches_cleared", this, "_clear_caches");
} }
} }
if (player) { if (player) {
player->connect("caches_cleared",this,"_clear_caches"); player->connect("caches_cleared", this, "_clear_caches");
} }
last_animation_player = current_animation_player; last_animation_player = current_animation_player;
} }
if (!player) { if (!player) {
@ -1225,10 +1223,9 @@ void AnimationTree::_notification(int p_what) {
Object *old_player = ObjectDB::get_instance(last_animation_player); Object *old_player = ObjectDB::get_instance(last_animation_player);
if (old_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, Ref<A
if (node->get_input_count() && !input_activity_map.has(p_base_path)) { if (node->get_input_count() && !input_activity_map.has(p_base_path)) {
Vector<Activity> activity; Vector<Activity> activity;
for(int i=0;i<node->get_input_count();i++) { for (int i = 0; i < node->get_input_count(); i++) {
Activity a; Activity a;
a.last_pass=0; a.last_pass = 0;
activity.push_back(a); activity.push_back(a);
} }
input_activity_map[p_base_path] = activity; 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<PropertyInfo> plist; List<PropertyInfo> plist;
@ -1434,14 +1431,14 @@ void AnimationTree::rename_parameter(const String &p_base, const String &p_new_b
_update_properties(); _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)) { if (!input_activity_map_get.has(p_path)) {
return 0; return 0;
} }
const Vector<Activity> *activity = input_activity_map_get[p_path]; const Vector<Activity> *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; return 0;
} }
@ -1452,7 +1449,6 @@ float AnimationTree::get_connection_activity(const StringName& p_path,int p_conn
return (*activity)[p_connection].activity; return (*activity)[p_connection].activity;
} }
void AnimationTree::_bind_methods() { void AnimationTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationTree::set_active); ClassDB::bind_method(D_METHOD("set_active", "active"), &AnimationTree::set_active);
ClassDB::bind_method(D_METHOD("is_active"), &AnimationTree::is_active); ClassDB::bind_method(D_METHOD("is_active"), &AnimationTree::is_active);
@ -1501,7 +1497,7 @@ AnimationTree::AnimationTree() {
setup_pass = 1; setup_pass = 1;
started = true; started = true;
properties_dirty = true; properties_dirty = true;
last_animation_player =0; last_animation_player = 0;
} }
AnimationTree::~AnimationTree() { AnimationTree::~AnimationTree() {