diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-10-01 14:03:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 14:03:29 +0200 |
commit | 12091b39d275b15a0aa93b944a670eec8b92d51b (patch) | |
tree | 46e2e9a4d1bbd93435f270b6a088287f2515e862 /scene/2d/collision_polygon_2d.cpp | |
parent | 23ab8ea6f62e0859313d282bc68982b05332cadb (diff) | |
parent | 9fc2b0fddcaeee3085e42512d7df5c39aec1368c (diff) | |
download | redot-engine-12091b39d275b15a0aa93b944a670eec8b92d51b.tar.gz |
Merge pull request #38743 from arrowinaknee/node-config-warnings
Update all get_configuration_warning() to retrieve warnings from the parent
Diffstat (limited to 'scene/2d/collision_polygon_2d.cpp')
-rw-r--r-- | scene/2d/collision_polygon_2d.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index d23398713a..3cbb0f72f8 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -230,15 +230,23 @@ bool CollisionPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, doubl #endif String CollisionPolygon2D::get_configuration_warning() const { + String warning = Node2D::get_configuration_warning(); + if (!Object::cast_to<CollisionObject2D>(get_parent())) { - return TTR("CollisionPolygon2D only serves to provide a collision shape to a CollisionObject2D derived node. Please only use it as a child of Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("CollisionPolygon2D only serves to provide a collision shape to a CollisionObject2D derived node. Please only use it as a child of Area2D, StaticBody2D, RigidBody2D, KinematicBody2D, etc. to give them a shape."); } if (polygon.empty()) { - return TTR("An empty CollisionPolygon2D has no effect on collision."); + if (!warning.empty()) { + warning += "\n\n"; + } + warning += TTR("An empty CollisionPolygon2D has no effect on collision."); } - return String(); + return warning; } void CollisionPolygon2D::set_disabled(bool p_disabled) { |