From 72453e566df99da018514cc2dece040abd814f9f Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Sat, 9 Nov 2019 21:52:22 +0100 Subject: Fixed function/audio/anim tracks in blend tree animation filter --- .../plugins/animation_blend_tree_editor_plugin.cpp | 39 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'editor') diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 235c204265..e147206ec4 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -534,6 +534,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano updating = true; Set paths; + HashMap > types; { List animations; player->get_animation_list(&animations); @@ -542,7 +543,27 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano Ref anim = player->get_animation(E->get()); for (int i = 0; i < anim->get_track_count(); i++) { - paths.insert(anim->track_get_path(i)); + String track_path = anim->track_get_path(i); + paths.insert(track_path); + + String track_type_name; + Animation::TrackType track_type = anim->track_get_type(i); + switch (track_type) { + case Animation::TrackType::TYPE_ANIMATION: { + track_type_name = TTR("Anim Clips"); + } break; + case Animation::TrackType::TYPE_AUDIO: { + track_type_name = TTR("Audio Clips"); + } break; + case Animation::TrackType::TYPE_METHOD: { + track_type_name = TTR("Functions"); + } break; + default: { + } break; + } + if (!track_type_name.empty()) { + types[track_path].insert(track_type_name); + } } } } @@ -646,10 +667,22 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref &ano } } else { if (ti) { - //just a node, likely call or animation track + //just a node, not a property track + String types_text = "["; + if (types.has(path)) { + Set::Element *F = types[path].front(); + types_text += F->get(); + while (F->next()) { + F = F->next(); + types_text += " / " + F->get(); + } + } + types_text += "]"; + ti = filters->create_item(ti); + ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); + ti->set_text(0, types_text); ti->set_editable(0, true); ti->set_selectable(0, true); - ti->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); ti->set_checked(0, anode->is_path_filtered(path)); ti->set_metadata(0, path); } -- cgit v1.2.3