Use Array for node configuration warnings

Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
This commit is contained in:
Nathan Franke
2020-10-29 05:01:28 -05:00
parent 4a1f2dcb74
commit 2a8c59c171
96 changed files with 426 additions and 674 deletions

View File

@ -249,21 +249,16 @@ void PathFollow2D::_validate_property(PropertyInfo &property) const {
}
}
String PathFollow2D::get_configuration_warning() const {
if (!is_visible_in_tree() || !is_inside_tree()) {
return String();
}
TypedArray<String> PathFollow2D::get_configuration_warnings() const {
TypedArray<String> warnings = Node::get_configuration_warnings();
String warning = Node2D::get_configuration_warning();
if (!Object::cast_to<Path2D>(get_parent())) {
if (!warning.is_empty()) {
warning += "\n\n";
if (is_visible_in_tree() && is_inside_tree()) {
if (!Object::cast_to<Path2D>(get_parent())) {
warnings.push_back(TTR("PathFollow2D only works when set as a child of a Path2D node."));
}
warning += TTR("PathFollow2D only works when set as a child of a Path2D node.");
}
return warning;
return warnings;
}
void PathFollow2D::_bind_methods() {