1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-14 13:41:12 +00:00

Create CollisionObject debug shapes using VS

(cherry picked from commit 60ee8c9639)
This commit is contained in:
trollodel
2021-04-27 11:23:08 +02:00
committed by Rémi Verschelde
parent 5193c3c8eb
commit 140cf0f2cb
5 changed files with 103 additions and 51 deletions

View File

@@ -158,8 +158,6 @@ void CollisionShape::_bind_methods() {
ClassDB::bind_method(D_METHOD("make_convex_from_brothers"), &CollisionShape::make_convex_from_brothers);
ClassDB::set_method_flags("CollisionShape", "make_convex_from_brothers", METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ClassDB::bind_method(D_METHOD("_shape_changed"), &CollisionShape::_shape_changed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape"), "set_shape", "get_shape");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
}
@@ -170,12 +168,10 @@ void CollisionShape::set_shape(const Ref<Shape> &p_shape) {
}
if (!shape.is_null()) {
shape->unregister_owner(this);
shape->disconnect("changed", this, "_shape_changed");
}
shape = p_shape;
if (!shape.is_null()) {
shape->register_owner(this);
shape->connect("changed", this, "_shape_changed");
}
update_gizmo();
if (parent) {
@@ -185,8 +181,10 @@ void CollisionShape::set_shape(const Ref<Shape> &p_shape) {
}
}
if (is_inside_tree())
_shape_changed();
if (is_inside_tree() && parent) {
// If this is a heightfield shape our center may have changed
_update_in_shape_owner(true);
}
update_configuration_warning();
}
@@ -223,10 +221,3 @@ CollisionShape::~CollisionShape() {
shape->unregister_owner(this);
//VisualServer::get_singleton()->free(indicator);
}
void CollisionShape::_shape_changed() {
// If this is a heightfield shape our center may have changed
if (parent) {
_update_in_shape_owner(true);
}
}