Skip to content

Commit 6ce461e

Browse files
Arctis-FireblightSaracenOneYuriSizov
committed
Fix animation track inserted path and key type
Co-authored-by: SaracenOne <[email protected]> Co-authored-by: Yuri Sizov <[email protected]> (cherry picked from commit 19f342e)
1 parent b06fb9c commit 6ce461e

File tree

1 file changed

+5
-35
lines changed

1 file changed

+5
-35
lines changed

editor/animation_track_editor.cpp

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4302,17 +4302,8 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p
43024302
String path = root->get_path_to(p_node, true);
43034303

43044304
// Get the value from the subpath.
4305-
Variant value = p_node;
4306-
Vector<String> property_path = p_property.split(":");
4307-
for (const String &E : property_path) {
4308-
if (value.get_type() == Variant::OBJECT) {
4309-
Object *obj = value;
4310-
value = obj->get(E);
4311-
} else {
4312-
value = Variant();
4313-
break;
4314-
}
4315-
}
4305+
Vector<StringName> subpath = NodePath(p_property).get_as_property_path().get_subnames();
4306+
Variant value = p_node->get_indexed(subpath);
43164307

43174308
if (Object::cast_to<AnimationPlayer>(p_node) && p_property == "current_animation") {
43184309
if (p_node == AnimationPlayerEditor::get_singleton()->get_player()) {
@@ -4549,30 +4540,6 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
45494540
}
45504541
}
45514542

4552-
for (int i = 0; i < leftover_path.size() - 1; i++) {
4553-
bool valid;
4554-
property_info_base = property_info_base.get_named(leftover_path[i], valid);
4555-
}
4556-
4557-
// Hack for the fact that bezier tracks leftover paths can reference
4558-
// the individual components for types like vectors.
4559-
if (property_info_base.is_null()) {
4560-
if (res.is_valid()) {
4561-
property_info_base = res;
4562-
} else if (node) {
4563-
property_info_base = node;
4564-
}
4565-
4566-
if (leftover_path.size()) {
4567-
leftover_path.remove_at(leftover_path.size() - 1);
4568-
}
4569-
4570-
for (int i = 0; i < leftover_path.size() - 1; i++) {
4571-
bool valid;
4572-
property_info_base = property_info_base.get_named(leftover_path[i], valid);
4573-
}
4574-
}
4575-
45764543
if (property_info_base.is_null()) {
45774544
WARN_PRINT(vformat("Could not determine track hint for '%s:%s' because its base property is null.",
45784545
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
46304597
subindices.push_back(":z");
46314598
subindices.push_back(":d");
46324599
} break;
4600+
case Variant::NIL: {
4601+
subindices.push_back(""); // Hack: it is probably float since non-numeric types are filtered in the selection window.
4602+
} break;
46334603
default: {
46344604
if (r_valid) {
46354605
*r_valid = false;

0 commit comments

Comments
 (0)