From bd95e18ae48711e5c62f3f2254aaf3d9edc989e1 Mon Sep 17 00:00:00 2001 From: Josh Grams Date: Mon, 25 Apr 2016 05:41:23 -0400 Subject: AnimationTree: add filters to Animation nodes. --- .../plugins/animation_tree_editor_plugin.cpp | 52 ++++++++++++---------- 1 file changed, 29 insertions(+), 23 deletions(-) (limited to 'tools') diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp index 08c2a1c3ae..7e1214ec83 100644 --- a/tools/editor/plugins/animation_tree_editor_plugin.cpp +++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp @@ -239,8 +239,12 @@ void AnimationTreeEditor::_play_toggled() { void AnimationTreeEditor::_master_anim_menu_item(int p_item) { - String str = master_anim_popup->get_item_text(p_item); - anim_tree->animation_node_set_master_animation(edited_node,str); + if(p_item == 0) _edit_filters(); + else { + + String str = master_anim_popup->get_item_text(p_item); + anim_tree->animation_node_set_master_animation(edited_node,str); + } update(); } @@ -291,6 +295,8 @@ void AnimationTreeEditor::_popup_edit_dialog() { AnimationPlayer *ap = anim_tree->get_node(anim_tree->get_master_player())->cast_to(); master_anim_popup->clear(); + master_anim_popup->add_item("Edit Filters"); + master_anim_popup->add_separator(); List sn; ap->get_animation_list(&sn); sn.sort_custom(); @@ -652,39 +658,35 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2& float y = pos.y-style->get_offset().height; - if (ynode_get_input_count(node); - count += inputs?inputs:1; + int count = MAX(inputs,1); - for(int i=0;i size.width/2 && type != AnimationTreePlayer::NODE_OUTPUT)) { - if (y size.width/2)) { + if (p_slot_index) + *p_slot_index=0; + return CLICK_OUTPUT_SLOT; + } + } - if (p_slot_index) - *p_slot_index=0; - return CLICK_OUTPUT_SLOT; - } else { + for(int i=0;ioneshot_node_set_filter_path(edited_node,ed->get_metadata(0),ed->is_checked(0)); } else if (anim_tree->node_get_type(edited_node)==AnimationTreePlayer::NODE_BLEND2) { anim_tree->blend2_node_set_filter_path(edited_node,ed->get_metadata(0),ed->is_checked(0)); + } else if (anim_tree->node_get_type(edited_node)==AnimationTreePlayer::NODE_ANIMATION) { + anim_tree->animation_node_set_filter_path(edited_node,ed->get_metadata(0),ed->is_checked(0)); } } @@ -1310,6 +1314,8 @@ void AnimationTreeEditor::_edit_filters() { it->set_checked(0, anim_tree->oneshot_node_is_path_filtered(edited_node,E->get())); } else if (anim_tree->node_get_type(edited_node)==AnimationTreePlayer::NODE_BLEND2) { it->set_checked(0, anim_tree->blend2_node_is_path_filtered(edited_node,E->get())); + } else if (anim_tree->node_get_type(edited_node)==AnimationTreePlayer::NODE_ANIMATION) { + it->set_checked(0, anim_tree->animation_node_is_path_filtered(edited_node,E->get())); } pm[E->get()]=it; } -- cgit v1.2.3