summaryrefslogtreecommitdiff
path: root/scene/3d/xr_nodes.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-10-01 14:03:29 +0200
committerGitHub <noreply@github.com>2020-10-01 14:03:29 +0200
commit12091b39d275b15a0aa93b944a670eec8b92d51b (patch)
tree46e2e9a4d1bbd93435f270b6a088287f2515e862 /scene/3d/xr_nodes.cpp
parent23ab8ea6f62e0859313d282bc68982b05332cadb (diff)
parent9fc2b0fddcaeee3085e42512d7df5c39aec1368c (diff)
Merge pull request #38743 from arrowinaknee/node-config-warnings
Update all get_configuration_warning() to retrieve warnings from the parent
Diffstat (limited to 'scene/3d/xr_nodes.cpp')
-rw-r--r--scene/3d/xr_nodes.cpp46
1 files changed, 36 insertions, 10 deletions
diff --git a/scene/3d/xr_nodes.cpp b/scene/3d/xr_nodes.cpp
index f4a514cdd6..c0015aa338 100644
--- a/scene/3d/xr_nodes.cpp
+++ b/scene/3d/xr_nodes.cpp
@@ -60,13 +60,18 @@ String XRCamera3D::get_configuration_warning() const {
return String();
}
+ String warning = Camera3D::get_configuration_warning();
+
// must be child node of XROrigin3D!
XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin == nullptr) {
- return TTR("XRCamera3D must have an XROrigin3D node as its parent.");
+ if (!warning.empty()) {
+ warning += "\n\n";
+ }
+ warning += TTR("XRCamera3D must have an XROrigin3D node as its parent.");
};
- return String();
+ return warning;
};
Vector3 XRCamera3D::project_local_ray_normal(const Point2 &p_pos) const {
@@ -362,17 +367,25 @@ String XRController3D::get_configuration_warning() const {
return String();
}
+ String warning = Node3D::get_configuration_warning();
+
// must be child node of XROrigin!
XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin == nullptr) {
- return TTR("XRController3D must have an XROrigin3D node as its parent.");
+ if (!warning.empty()) {
+ warning += "\n\n";
+ }
+ warning += TTR("XRController3D must have an XROrigin3D node as its parent.");
};
if (controller_id == 0) {
- return TTR("The controller ID must not be 0 or this controller won't be bound to an actual controller.");
+ if (!warning.empty()) {
+ warning += "\n\n";
+ }
+ warning += TTR("The controller ID must not be 0 or this controller won't be bound to an actual controller.");
};
- return String();
+ return warning;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -479,17 +492,25 @@ String XRAnchor3D::get_configuration_warning() const {
return String();
}
+ String warning = Node3D::get_configuration_warning();
+
// must be child node of XROrigin3D!
XROrigin3D *origin = Object::cast_to<XROrigin3D>(get_parent());
if (origin == nullptr) {
- return TTR("XRAnchor3D must have an XROrigin3D node as its parent.");
+ if (!warning.empty()) {
+ warning += "\n\n";
+ }
+ warning += TTR("XRAnchor3D must have an XROrigin3D node as its parent.");
};
if (anchor_id == 0) {
- return TTR("The anchor ID must not be 0 or this anchor won't be bound to an actual anchor.");
+ if (!warning.empty()) {
+ warning += "\n\n";
+ }
+ warning += TTR("The anchor ID must not be 0 or this anchor won't be bound to an actual anchor.");
};
- return String();
+ return warning;
};
Plane XRAnchor3D::get_plane() const {
@@ -512,11 +533,16 @@ String XROrigin3D::get_configuration_warning() const {
return String();
}
+ String warning = Node3D::get_configuration_warning();
+
if (tracked_camera == nullptr) {
- return TTR("XROrigin3D requires an XRCamera3D child node.");
+ if (!warning.empty()) {
+ warning += "\n\n";
+ }
+ warning += TTR("XROrigin3D requires an XRCamera3D child node.");
}
- return String();
+ return warning;
};
void XROrigin3D::_bind_methods() {