-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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 type filters to AnimationPlayer's "Add Track" #98558
Conversation
f848a64
to
c1e4c51
Compare
After further testing I've found a bug where an error is thrown when alternating between adding Audio Tracks and Property tracks. (Between a type with and without a filter, needs to switch a few times). |
f90bac8
to
3da5b76
Compare
I've fixed the more consistent error message, but I occasionally get this one: I guess if you don't spam open/close the Add Track dialog it should be fine. I'm not sure what causes this particular error message, so I could use some feedback if it would prevent the PR from being merged or can be ignored. |
f1454d2
to
c542462
Compare
7433fe7
to
df673ee
Compare
df673ee
to
efe8cfc
Compare
editor/animation_track_editor.cpp
Outdated
// Blend Shape is a property of MeshInstance3D | ||
valid_types.push_back(StringName("MeshInstance3D")); | ||
} break; | ||
case Animation::TYPE_POSITION_3D: | ||
case Animation::TYPE_ROTATION_3D: | ||
case Animation::TYPE_SCALE_3D: { | ||
// 3D Properties come from nodes inheriting Node3D | ||
valid_types.push_back(StringName("Node3D")); | ||
} break; | ||
case Animation::TYPE_AUDIO: { | ||
valid_types.push_back(StringName("AudioStreamPlayer")); | ||
valid_types.push_back(StringName("AudioStreamPlayer2D")); | ||
valid_types.push_back(StringName("AudioStreamPlayer3D")); | ||
} break; | ||
case Animation::TYPE_ANIMATION: { | ||
valid_types.push_back(StringName("AnimationPlayer")); |
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.
// Blend Shape is a property of MeshInstance3D | |
valid_types.push_back(StringName("MeshInstance3D")); | |
} break; | |
case Animation::TYPE_POSITION_3D: | |
case Animation::TYPE_ROTATION_3D: | |
case Animation::TYPE_SCALE_3D: { | |
// 3D Properties come from nodes inheriting Node3D | |
valid_types.push_back(StringName("Node3D")); | |
} break; | |
case Animation::TYPE_AUDIO: { | |
valid_types.push_back(StringName("AudioStreamPlayer")); | |
valid_types.push_back(StringName("AudioStreamPlayer2D")); | |
valid_types.push_back(StringName("AudioStreamPlayer3D")); | |
} break; | |
case Animation::TYPE_ANIMATION: { | |
valid_types.push_back(StringName("AnimationPlayer")); | |
// Blend Shape is a property of MeshInstance3D. | |
valid_types.push_back(SNAME("MeshInstance3D")); | |
} break; | |
case Animation::TYPE_POSITION_3D: | |
case Animation::TYPE_ROTATION_3D: | |
case Animation::TYPE_SCALE_3D: { | |
// 3D Properties come from nodes inheriting Node3D. | |
valid_types.push_back(SNAME("Node3D")); | |
} break; | |
case Animation::TYPE_AUDIO: { | |
valid_types.push_back(SNAME("AudioStreamPlayer")); | |
valid_types.push_back(SNAME("AudioStreamPlayer2D")); | |
valid_types.push_back(SNAME("AudioStreamPlayer3D")); | |
} break; | |
case Animation::TYPE_ANIMATION: { | |
valid_types.push_back(SNAME("AnimationPlayer")); |
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've committed the change here. Is there a particular reasoning behind using SNAME vs StringName? or even SceneStringName? Or plain string with just quotes?
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.
It is a dedicated macro creating a static instance, otherwise this creates a new StringName
instance each time this method is run, forgot to add that to the comment when remaking it after some other changes
d472737
to
8c46c00
Compare
Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Co-Authored-By: Tomek <kobewi4e@gmail.com>
8c46c00
to
d517675
Compare
Thanks! Congratulations on your first contribution! 🎉 |
(My first contribution btw)
Adds type filters to the SceneTreeDialogs that come from AnimationPlayer's "Add Track" button.
The Add Track button has several types of tracks that require specific node types, but currently present a full SceneTreeDialog, and throw an error if you provide the wrong type.
Fixes #55944 which describes this issue specifically for Audio tracks.
I've tested the SceneTreeDialog in the inspector (export nodepath), works the same as usual. However, I'm not sure where else to find the prompts for the SceneTreeDialog in the editor for further testing.
I see it's in a few different places in the code such as:
All these examples set filters once after creating the dialog, so they should be unaffected.
Related, I did notice the SceneTreeDialog's set_valid_types was not set up correctly to be called on the same instance of SceneTreeDialog multiple times.
Seems the current workaround was deleting and recreating it.
See also this comment:
godot/editor/editor_interface.cpp
Lines 283 to 290 in 61accf0
I took a stab at fixing this issue, clearing the filter's label and types before setting it.
Fixed the icons not showing up, but it calls _notification() directly to update the icon sizes. Would like some feedback on that too, seems unusual for the codebase.