Add type filters to AnimationPlayer's "Add Track"

Co-Authored-By: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-Authored-By: Tomek <kobewi4e@gmail.com>
This commit is contained in:
Jason Morgado
2024-10-20 09:01:33 -04:00
parent e65a23762b
commit d5176757c0
3 changed files with 49 additions and 12 deletions

View File

@@ -5297,6 +5297,28 @@ void AnimationTrackEditor::_add_track(int p_type) {
return;
}
adding_track_type = p_type;
Vector<StringName> valid_types;
switch (adding_track_type) {
case Animation::TYPE_BLEND_SHAPE: {
// 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"));
} break;
}
pick_track->set_valid_types(valid_types);
pick_track->popup_scenetree_dialog(nullptr, root_node);
pick_track->get_filter_line_edit()->clear();
pick_track->get_filter_line_edit()->grab_focus();