From bc51e2bf11b357149a839e43b78940d9d6ce68f3 Mon Sep 17 00:00:00 2001 From: Daylily-Zeleen Date: Sun, 7 May 2023 02:39:11 +0800 Subject: [PATCH] Add AnimationTrackFilter and its Editor plugin. --- doc/classes/AnimationNode.xml | 10 +- doc/classes/AnimationTrackFilter.xml | 51 ++ .../animation_blend_tree_editor_plugin.cpp | 261 ++-------- .../animation_blend_tree_editor_plugin.h | 14 +- .../animation_track_filter_editor_plugin.cpp | 488 ++++++++++++++++++ .../animation_track_filter_editor_plugin.h | 144 ++++++ editor/register_editor_types.cpp | 2 + editor/renames_map_3_to_4.cpp | 1 - scene/animation/animation_blend_tree.cpp | 21 +- scene/animation/animation_blend_tree.h | 1 + scene/animation/animation_tree.compat.inc | 75 +++ scene/animation/animation_tree.cpp | 79 +-- scene/animation/animation_tree.h | 23 +- scene/register_scene_types.cpp | 2 + scene/resources/animation_track_filter.cpp | 118 +++++ scene/resources/animation_track_filter.h | 76 +++ 16 files changed, 1076 insertions(+), 290 deletions(-) create mode 100644 doc/classes/AnimationTrackFilter.xml create mode 100644 editor/plugins/animation_track_filter_editor_plugin.cpp create mode 100644 editor/plugins/animation_track_filter_editor_plugin.h create mode 100644 scene/resources/animation_track_filter.cpp create mode 100644 scene/resources/animation_track_filter.h diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml index a028d0bb4f4e..2c390e98a4d9 100644 --- a/doc/classes/AnimationNode.xml +++ b/doc/classes/AnimationNode.xml @@ -142,10 +142,10 @@ - Gets the value of a parameter. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees. + Gets the value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. - + @@ -159,7 +159,7 @@ Removes an input, call this only when inactive. - + @@ -185,8 +185,8 @@ - - If [code]true[/code], filtering is enabled. + + Deprecated, sets this property will do noting, gets will return [code]false[/code]. diff --git a/doc/classes/AnimationTrackFilter.xml b/doc/classes/AnimationTrackFilter.xml new file mode 100644 index 000000000000..7c220e9b3700 --- /dev/null +++ b/doc/classes/AnimationTrackFilter.xml @@ -0,0 +1,51 @@ + + + + A filter to describe [AnimationNode]'s filters. + + + A filter to describe [AnimationNode]'s filters. + + + + + + + + Clear all tracks. + + + + + + + + + + + + + Return [code]true[/code] if has [param track_path]. + + + + + + + Remove track, will do noting if this filter have not [param track_path]. + + + + + + + + + + + + + A array of animation tracks' Nodepath which should be filtered. + + + diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 673f135a5435..30d90dec004f 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -49,8 +49,11 @@ #include "scene/gui/separator.h" #include "scene/gui/view_panner.h" #include "scene/main/window.h" +#include "scene/resources/animation_track_filter.h" #include "scene/resources/style_box_flat.h" +#define GET_ANIM_NODE_FILTER_BASE_PATH(m_node_name) AnimationTreeEditor::get_singleton()->get_base_path() + String(m_node_name) + "/filter" + void AnimationNodeBlendTreeEditor::add_custom_type(const String &p_name, const Ref