godot icon indicating copy to clipboard operation
godot copied to clipboard

Add `AnimationTrackFilter` and implement filter as an `AnimationNode`'s parameter.

Open Daylily-Zeleen opened this issue 2 years ago • 12 comments

Implement #6808.

  • Add resource type AnimationTrackFilter, remove AnimationNode menbers:
    • filter, filter_enabled
    • _get_filters(), _set_filters(), has_filter(), set_filter_path(), set_filter_path(),
  • Implement filter like other AnimationNode's parameters.
  • Modify AnimationNodeBlendTreeEditor to adapt to first change.
  • Implement AnimationTrackFilterEditorPlugin to edit filter tracks in inspector.

https://github.com/godotengine/godot/assets/61624558/d60a00fc-9506-400b-af81-c008b572d16a


This pr implement filter for AnimationNodeBlend3, will close #76506.

The filter is implemented as gradual style, will close #7578.

Bugsquad Edited: Closes https://github.com/godotengine/godot-proposals/discussions/7896

Daylily-Zeleen avatar May 06 '23 18:05 Daylily-Zeleen

How to fix this static checks?

Daylily-Zeleen avatar May 06 '23 19:05 Daylily-Zeleen

You basically add whatever is marked green to your code. If you have line of code that is marked red and right below it is the same line of code that is marked green then that means that you have to edit the line of code to look like the green one.

In your case you seem to be missing license related comments so adding those should fix static checking.

warriormaster12 avatar May 07 '23 05:05 warriormaster12

You basically add whatever is marked green to your code. If you have line of code that is marked red and right below it is the same line of code that is marked green then that means that you have to edit the line of code to look like the green one.

In your case you seem to be missing license related comments so adding those should fix static checking.

You can my changed files, I already add the lisence info.

Daylily-Zeleen avatar May 07 '23 05:05 Daylily-Zeleen

Can someone help me?

Daylily-Zeleen avatar May 08 '23 04:05 Daylily-Zeleen

Also, you may want to check for invisible characters that may have been inserted such as unwanted invisible BOM codes. (Some multi-byte language users often encounter this problem)

TokageItLab avatar May 08 '23 04:05 TokageItLab

Also, you may want to check for invisible characters that may have been inserted such as unwanted invisible BOM codes. (Some multi-byte language users often encounter this problem)

Thanks,my editor default is UTF8-BOM, changed it to UTF8 can pass static check.

Daylily-Zeleen avatar May 08 '23 04:05 Daylily-Zeleen

@TokageItLab I am not sure filter should be used only extends from AnimationNodeSync.

From proppsals #6816 and #1187, we can see some users prefer to use a standalone filter node.

Because filter only make sense when work with multiple inputs, I oppose their are solutions, but it means that developers are hindered by animation node types, I think we should not limit the filterable node's extends type.

In conclusion, I implement this feature by adding "filter" parameter for each filterable node type repeatedly (including Blend3).

Daylily-Zeleen avatar May 17 '23 08:05 Daylily-Zeleen

It seems like the way to go is never wrong, but there may be a better writing way, so I will also think about it later.

I know it will be difficult to implement these changes immediately, but it definitely makes sense to make the filter a Resource, and I personally plan to make some improvements at 4.2 or 4.3.

TokageItLab avatar May 18 '23 09:05 TokageItLab

Refactor is done, please review again.

Daylily-Zeleen avatar Oct 02 '23 04:10 Daylily-Zeleen

I like this PR, I think its the right direction to go for both ease of use and memory saving. Regarding the deprecation thing, the way I would suggest implementing this without breaking compat is keeping the old filter function, but marking them as deprecated as per the deprecation system we introduced for 4.x. You can then make the existing functions, for example, for when setting the filters property, generate a unique filter resource for them. This will ensure backwards compatibility with the old system and allow this to be introduced without breaking existing trees.

SaracenOne avatar Oct 17 '23 07:10 SaracenOne

I like this PR, I think its the right direction to go for both ease of use and memory saving. Regarding the deprecation thing, the way I would suggest implementing this without breaking compat is keeping the old filter function, but marking them as deprecated as per the deprecation system we introduced for 4.x. You can then make the existing functions, for example, for when setting the filters property, generate a unique filter resource for them. This will ensure backwards compatibility with the old system and allow this to be introduced without breaking existing trees.

"filter" in this pr is not belong to AnimationNode and should be referenced by specific AnimationTree nodes, unless we can find out correct AnimationTree nodes when loading an AnimationNode, it is impossible to keep old filter info from old resources datas. Although I add filter, _set_filter(), _get_filter() to pass compat check, old filter info will be lost when opening old scenes.

Daylily-Zeleen avatar Oct 17 '23 18:10 Daylily-Zeleen

The filter_enabled doesn't work from code. filter_enabled

I've tried to trigger it in multiple ways, but in 4.3 it doesn't work.

DucktatorQuack avatar Sep 23 '24 18:09 DucktatorQuack