diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-01-18 14:30:07 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-01-18 14:31:07 -0300 |
commit | cc8dfcc9c09381252a5f35198b321c139d8e6569 (patch) | |
tree | 57695e81784e92c62cfbed55588d9c47ad4cc765 /scene/2d | |
parent | b3c66de27f1780ed53ac471190e6ca6a5847bf92 (diff) |
Before I forget, add warnings on areas without children (should not break anything).
Seen too many users misunderstanding the edit rect is the shape.
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/collision_object_2d.cpp | 14 | ||||
-rw-r--r-- | scene/2d/collision_object_2d.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index e451e7a65b..89edbb6cc1 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -328,6 +328,20 @@ void CollisionObject2D::_update_pickable() { Physics2DServer::get_singleton()->body_set_pickable(rid, pickable); } +String CollisionObject2D::get_configuration_warning() const { + + String warning = Node2D::get_configuration_warning(); + + if (shapes.empty()) { + if (warning == String()) { + warning += "\n"; + } + warning += TTR("This node has no children shapes, so it can't interact with the space.\nConsider adding CollisionShape2D or CollisionPolygon2D children nodes to define it's shape."); + } + + return warning; +} + void CollisionObject2D::_bind_methods() { ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject2D::get_rid); diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h index ee3cea46a5..6da63d1a0b 100644 --- a/scene/2d/collision_object_2d.h +++ b/scene/2d/collision_object_2d.h @@ -107,6 +107,8 @@ public: void set_pickable(bool p_enabled); bool is_pickable() const; + String get_configuration_warning() const; + _FORCE_INLINE_ RID get_rid() const { return rid; } CollisionObject2D(); |