Fix animation track inserted path and key type

Co-authored-by: SaracenOne <SaracenOne@gmail.com>
Co-authored-by: Yuri Sizov <11782833+YuriSizov@users.noreply.github.com>
(cherry picked from commit 19f342e043)
This commit is contained in:
Arctis-Fireblight
2025-08-16 21:32:34 -05:00
parent b06fb9c952
commit 6ce461ec30

View File

@@ -4302,17 +4302,8 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
String path = root->get_path_to(p_node, true);
// Get the value from the subpath.
Variant value = p_node;
Vector<String> property_path = p_property.split(":");
for (const String &E : property_path) {
if (value.get_type() == Variant::OBJECT) {
Object *obj = value;
value = obj->get(E);
} else {
value = Variant();
break;
}
}
Vector<StringName> subpath = NodePath(p_property).get_as_property_path().get_subnames();
Variant value = p_node->get_indexed(subpath);
if (Object::cast_to<AnimationPlayer>(p_node) && p_property == "current_animation") {
if (p_node == AnimationPlayerEditor::get_singleton()->get_player()) {
@@ -4549,30 +4540,6 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
}
}
for (int i = 0; i < leftover_path.size() - 1; i++) {
bool valid;
property_info_base = property_info_base.get_named(leftover_path[i], valid);
}
// Hack for the fact that bezier tracks leftover paths can reference
// the individual components for types like vectors.
if (property_info_base.is_null()) {
if (res.is_valid()) {
property_info_base = res;
} else if (node) {
property_info_base = node;
}
if (leftover_path.size()) {
leftover_path.remove_at(leftover_path.size() - 1);
}
for (int i = 0; i < leftover_path.size() - 1; i++) {
bool valid;
property_info_base = property_info_base.get_named(leftover_path[i], valid);
}
}
if (property_info_base.is_null()) {
WARN_PRINT(vformat("Could not determine track hint for '%s:%s' because its base property is null.",
String(path.get_concatenated_names()), String(path.get_concatenated_subnames())));
@@ -4630,6 +4597,9 @@ static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool
subindices.push_back(":z");
subindices.push_back(":d");
} break;
case Variant::NIL: {
subindices.push_back(""); // Hack: it is probably float since non-numeric types are filtered in the selection window.
} break;
default: {
if (r_valid) {
*r_valid = false;