-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AnimationTrackFilter
and implement filter as an AnimationNode
's parameter.
#76788
base: master
Are you sure you want to change the base?
Add AnimationTrackFilter
and implement filter as an AnimationNode
's parameter.
#76788
Conversation
7dfccbb
to
ba2a36e
Compare
How to fix this static checks? |
c51ea17
to
5fdc92e
Compare
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. |
386ba01
to
f81fce7
Compare
Can someone help me? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At any rate, the file must end with a new line.
e8606f8
to
caf4962
Compare
AnimationTrackFilter
and implemte filter as an AnimationNode
's parameter.AnimationTrackFilter
and implement filter as an AnimationNode
's parameter.
2597e17
to
e3d7409
Compare
Refactor is done, please review again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes which break API compatibility. This is a hard blocker for merging this PR. It is okay to mark functions deprecated, but existing methods, including virtual methods, must not be removed between Godot 4 versions.
EDIT: See Godot's policy on compatibility across engine versions.
doc/classes/AnimationNode.xml
Outdated
<method name="_has_filter" qualifiers="virtual const"> | ||
<return type="bool" /> | ||
<description> | ||
When inheriting from [AnimationRootNode], implement this virtual method to return whether the blend tree editor should display filter editing on this animation node. | ||
</description> | ||
</method> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error: Validate extension JSON: API was removed: classes/AnimationNode/methods/_has_filter
It is not permitted to remove public APIs, such as AnimationNode.is_path_filtered(path:NodePath)
, AnimationNode.set_filter_path(path:NodePath,enable:bool)
, AnimationNode.set_filter_enabled(enable:bool)
, AnimationNode.is_filter_enabled()
or the virtual function AnimationNode._has_filter()
. The property filter_enabled
may also be kept for script compatibility, but it is not required to do so for GDExtension support.
These AnimationNode
methods must be kept but marked deprecated, such as using is_deprecated="true"
in this documentation XML. I would suggest that it would be good practice to implement them if possible, for example accessing the attached AnimationTrackFilter
if possible, or returning empty if this is not possible.
@@ -247,6 +249,7 @@ void AnimationNodeOneShot::get_parameter_list(List<PropertyInfo> *r_list) const | |||
r_list->push_back(PropertyInfo(Variant::FLOAT, remaining, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE)); | |||
r_list->push_back(PropertyInfo(Variant::FLOAT, fade_out_remaining, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE)); | |||
r_list->push_back(PropertyInfo(Variant::FLOAT, time_to_restart, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE)); | |||
APPEND_FILTER_PARAMETER(r_list); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do some animation nodes have a filter and some don't?
I find this use of macro really confusing. Why can't we have the "filter" parameter in the base class AnimationNode
?
If we do have a special type of "filterable" animationnode, perhaps we should add an abstract class / level of inheritance to indicate the filterability (having the "filter" parameter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I "filter" just a normal parameter like "add_amount" in AnimationNodeAdd2
, I think it should be added where they need in get_parameter_list()
, this macros just for copying duplicate code and avoiding stupid mistake.
However, if user create their own AnimationNode
in GDScript (godot/pull/69641) and need filter, it may not work expectantly because of misspell.
For user friendly, I readd has_filter()
now.
But I am not sure which way is more reasonable.
|
||
public: | ||
StringName filter = PNAME("filter"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like having a member variable named the same as its string constant value. If this is effectively a constant, it should be marked const
and made capital, or renamed to _string
or _parameter
to indicate that it refers to the parameter / string constant, and it isn't itself a filter object or a time value.
The existing code is also bad practice and should be fixed in a separate PR. In particular, the use of time
as a member variable name shadows the C library's time(time_t*)
function. I wouldn't have as much of an issue with this additional parameter as long as it is next to the other PNAME values, namely time
, remaining
and so on.
This issue isn't a sticking point, just something I observed that made it especially difficult for me to read and follow the property list code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree your opinion, here I just abey the existing code.
e28643a
to
4db5943
Compare
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. |
4db5943
to
0e11e55
Compare
0e11e55
to
bc51e2b
Compare
"filter" in this pr is not belong to |
The filter_enabled doesn't work from code. I've tried to trigger it in multiple ways, but in 4.3 it doesn't work. |
Implement #6808.
AnimationTrackFilter
, removeAnimationNode
menbers:filter
,filter_enabled
_get_filters()
,_set_filters()
,has_filter()
,set_filter_path()
,set_filter_path()
,filter
like otherAnimationNode
's parameters.AnimationNodeBlendTreeEditor
to adapt to first change.AnimationTrackFilterEditorPlugin
to edit filter tracks in inspector.2023-10-02.11-58-11.mp4
This pr implement filter for
AnimationNodeBlend3
, will close #76506.The filter is implemented as gradual style, will close #7578.
Bugsquad Edited:
Closes godotengine/godot-proposals#7896