Update all get_configuration_warning to retrieve warnings from the parent

This commit is contained in:
ArrowInAKnee
2020-05-14 23:59:27 +03:00
parent 00949f0c5f
commit 9fc2b0fddc
40 changed files with 284 additions and 114 deletions

View File

@@ -252,16 +252,24 @@ String PathFollow3D::get_configuration_warning() const {
return String();
}
String warning = Node3D::get_configuration_warning();
if (!Object::cast_to<Path3D>(get_parent())) {
return TTR("PathFollow3D only works when set as a child of a Path3D node.");
if (!warning.empty()) {
warning += "\n\n";
}
warning += TTR("PathFollow3D only works when set as a child of a Path3D node.");
} else {
Path3D *path = Object::cast_to<Path3D>(get_parent());
if (path->get_curve().is_valid() && !path->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) {
return TTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource.");
if (!warning.empty()) {
warning += "\n\n";
}
warning += TTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource.");
}
}
return String();
return warning;
}
void PathFollow3D::_bind_methods() {