Before I forget, add warnings on areas without children (should not break anything).
Seen too many users misunderstanding the edit rect is the shape.
This commit is contained in:
parent
b3c66de27f
commit
cc8dfcc9c0
4 changed files with 32 additions and 0 deletions
|
@ -328,6 +328,20 @@ void CollisionObject2D::_update_pickable() {
|
||||||
Physics2DServer::get_singleton()->body_set_pickable(rid, 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() {
|
void CollisionObject2D::_bind_methods() {
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject2D::get_rid);
|
ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject2D::get_rid);
|
||||||
|
|
|
@ -107,6 +107,8 @@ public:
|
||||||
void set_pickable(bool p_enabled);
|
void set_pickable(bool p_enabled);
|
||||||
bool is_pickable() const;
|
bool is_pickable() const;
|
||||||
|
|
||||||
|
String get_configuration_warning() const;
|
||||||
|
|
||||||
_FORCE_INLINE_ RID get_rid() const { return rid; }
|
_FORCE_INLINE_ RID get_rid() const { return rid; }
|
||||||
|
|
||||||
CollisionObject2D();
|
CollisionObject2D();
|
||||||
|
|
|
@ -365,6 +365,20 @@ bool CollisionObject::get_capture_input_on_drag() const {
|
||||||
return capture_input_on_drag;
|
return capture_input_on_drag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String CollisionObject::get_configuration_warning() const {
|
||||||
|
|
||||||
|
String warning = Spatial::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 CollisionShape or CollisionPolygon children nodes to define it's shape.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return warning;
|
||||||
|
}
|
||||||
|
|
||||||
CollisionObject::CollisionObject() {
|
CollisionObject::CollisionObject() {
|
||||||
|
|
||||||
capture_input_on_drag = false;
|
capture_input_on_drag = false;
|
||||||
|
|
|
@ -109,6 +109,8 @@ public:
|
||||||
|
|
||||||
_FORCE_INLINE_ RID get_rid() const { return rid; }
|
_FORCE_INLINE_ RID get_rid() const { return rid; }
|
||||||
|
|
||||||
|
virtual String get_configuration_warning() const;
|
||||||
|
|
||||||
CollisionObject();
|
CollisionObject();
|
||||||
~CollisionObject();
|
~CollisionObject();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue