Fix bug in animationplayer editor not using subproperties properly
Fixes #19448
This commit is contained in:
@ -2972,12 +2972,12 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
|
|||||||
if (res.is_valid()) {
|
if (res.is_valid()) {
|
||||||
property_info_base = res;
|
property_info_base = res;
|
||||||
if (r_current_val) {
|
if (r_current_val) {
|
||||||
*r_current_val = res->get(leftover_path[leftover_path.size() - 1]);
|
*r_current_val = res->get_indexed(leftover_path);
|
||||||
}
|
}
|
||||||
} else if (node) {
|
} else if (node) {
|
||||||
property_info_base = node;
|
property_info_base = node;
|
||||||
if (r_current_val) {
|
if (r_current_val) {
|
||||||
*r_current_val = node->get(leftover_path[leftover_path.size() - 1]);
|
*r_current_val = node->get_indexed(leftover_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3011,31 +3011,31 @@ static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool
|
|||||||
subindices.push_back("");
|
subindices.push_back("");
|
||||||
} break;
|
} break;
|
||||||
case Variant::VECTOR2: {
|
case Variant::VECTOR2: {
|
||||||
subindices.push_back(".x");
|
subindices.push_back(":x");
|
||||||
subindices.push_back(".y");
|
subindices.push_back(":y");
|
||||||
} break;
|
} break;
|
||||||
case Variant::VECTOR3: {
|
case Variant::VECTOR3: {
|
||||||
subindices.push_back(".x");
|
subindices.push_back(":x");
|
||||||
subindices.push_back(".y");
|
subindices.push_back(":y");
|
||||||
subindices.push_back(".z");
|
subindices.push_back(":z");
|
||||||
} break;
|
} break;
|
||||||
case Variant::QUAT: {
|
case Variant::QUAT: {
|
||||||
subindices.push_back(".x");
|
subindices.push_back(":x");
|
||||||
subindices.push_back(".y");
|
subindices.push_back(":y");
|
||||||
subindices.push_back(".z");
|
subindices.push_back(":z");
|
||||||
subindices.push_back(".w");
|
subindices.push_back(":w");
|
||||||
} break;
|
} break;
|
||||||
case Variant::COLOR: {
|
case Variant::COLOR: {
|
||||||
subindices.push_back(".r");
|
subindices.push_back(":r");
|
||||||
subindices.push_back(".g");
|
subindices.push_back(":g");
|
||||||
subindices.push_back(".b");
|
subindices.push_back(":b");
|
||||||
subindices.push_back(".a");
|
subindices.push_back(":a");
|
||||||
} break;
|
} break;
|
||||||
case Variant::PLANE: {
|
case Variant::PLANE: {
|
||||||
subindices.push_back(".x");
|
subindices.push_back(":x");
|
||||||
subindices.push_back(".y");
|
subindices.push_back(":y");
|
||||||
subindices.push_back(".z");
|
subindices.push_back(":z");
|
||||||
subindices.push_back(".d");
|
subindices.push_back(":d");
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
if (r_valid) {
|
if (r_valid) {
|
||||||
@ -3246,31 +3246,19 @@ void AnimationTrackEditor::_update_tracks() {
|
|||||||
|
|
||||||
if (root && root->has_node_and_resource(path)) {
|
if (root && root->has_node_and_resource(path)) {
|
||||||
RES res;
|
RES res;
|
||||||
|
NodePath base_path;
|
||||||
Vector<StringName> leftover_path;
|
Vector<StringName> leftover_path;
|
||||||
Node *node = root->get_node_and_resource(path, res, leftover_path, true);
|
Node *node = root->get_node_and_resource(path, res, leftover_path, true);
|
||||||
|
PropertyInfo pinfo = _find_hint_for_track(i, base_path);
|
||||||
|
|
||||||
Object *object = node;
|
Object *object = node;
|
||||||
if (res.is_valid()) {
|
if (res.is_valid()) {
|
||||||
object = res.ptr();
|
object = res.ptr();
|
||||||
} else {
|
|
||||||
object = node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object && !leftover_path.empty()) {
|
if (object && !leftover_path.empty()) {
|
||||||
//not a property (value track?)
|
if (pinfo.name.empty()) {
|
||||||
PropertyInfo pinfo;
|
pinfo.name = leftover_path[leftover_path.size() - 1];
|
||||||
pinfo.name = leftover_path[leftover_path.size() - 1];
|
|
||||||
//now let's see if we can get more info about it
|
|
||||||
|
|
||||||
List<PropertyInfo> plist;
|
|
||||||
object->get_property_list(&plist);
|
|
||||||
|
|
||||||
for (List<PropertyInfo>::Element *E = plist.front(); E; E = E->next()) {
|
|
||||||
|
|
||||||
if (E->get().name == leftover_path[leftover_path.size() - 1]) {
|
|
||||||
pinfo = E->get();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < track_edit_plugins.size(); j++) {
|
for (int j = 0; j < track_edit_plugins.size(); j++) {
|
||||||
|
|||||||
@ -331,11 +331,7 @@ void AnimationPlayer::_ensure_node_caches(AnimationData *p_anim) {
|
|||||||
if (!p_anim->node_cache[i]->bezier_anim.has(a->track_get_path(i).get_concatenated_subnames())) {
|
if (!p_anim->node_cache[i]->bezier_anim.has(a->track_get_path(i).get_concatenated_subnames())) {
|
||||||
|
|
||||||
TrackNodeCache::BezierAnim ba;
|
TrackNodeCache::BezierAnim ba;
|
||||||
String path = leftover_path[leftover_path.size() - 1];
|
ba.bezier_property = leftover_path;
|
||||||
Vector<String> index = path.split(".");
|
|
||||||
for (int j = 0; j < index.size(); j++) {
|
|
||||||
ba.bezier_property.push_back(index[j]);
|
|
||||||
}
|
|
||||||
ba.object = resource.is_valid() ? (Object *)resource.ptr() : (Object *)child;
|
ba.object = resource.is_valid() ? (Object *)resource.ptr() : (Object *)child;
|
||||||
ba.owner = p_anim->node_cache[i];
|
ba.owner = p_anim->node_cache[i];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user