diff options
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/box_shape.cpp | 1 | ||||
-rw-r--r-- | scene/resources/capsule_shape.cpp | 1 | ||||
-rw-r--r-- | scene/resources/concave_polygon_shape.cpp | 1 | ||||
-rw-r--r-- | scene/resources/convex_polygon_shape.cpp | 2 | ||||
-rw-r--r-- | scene/resources/cylinder_shape.cpp | 1 | ||||
-rw-r--r-- | scene/resources/plane_shape.cpp | 1 | ||||
-rw-r--r-- | scene/resources/ray_shape.cpp | 2 | ||||
-rw-r--r-- | scene/resources/shape.cpp | 5 | ||||
-rw-r--r-- | scene/resources/shape.h | 2 | ||||
-rw-r--r-- | scene/resources/sphere_shape.cpp | 1 |
10 files changed, 15 insertions, 2 deletions
diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp index d93754076c..d819e9f776 100644 --- a/scene/resources/box_shape.cpp +++ b/scene/resources/box_shape.cpp @@ -51,6 +51,7 @@ Vector<Vector3> BoxShape::_gen_debug_mesh_lines() { void BoxShape::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), extents); + Shape::_update_shape(); } void BoxShape::set_extents(const Vector3 &p_extents) { diff --git a/scene/resources/capsule_shape.cpp b/scene/resources/capsule_shape.cpp index 3f7bf1e0ec..669b261bfe 100644 --- a/scene/resources/capsule_shape.cpp +++ b/scene/resources/capsule_shape.cpp @@ -75,6 +75,7 @@ void CapsuleShape::_update_shape() { d["radius"] = radius; d["height"] = height; PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); + Shape::_update_shape(); } void CapsuleShape::set_radius(float p_radius) { diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp index b192d088d8..b4cc38c8c0 100644 --- a/scene/resources/concave_polygon_shape.cpp +++ b/scene/resources/concave_polygon_shape.cpp @@ -65,6 +65,7 @@ Vector<Vector3> ConcavePolygonShape::_gen_debug_mesh_lines() { } void ConcavePolygonShape::_update_shape() { + Shape::_update_shape(); } void ConcavePolygonShape::set_faces(const PoolVector<Vector3> &p_faces) { diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp index 5845e4be50..499688a185 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape.cpp @@ -58,7 +58,7 @@ Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() { void ConvexPolygonShape::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), points); - emit_changed(); + Shape::_update_shape(); } void ConvexPolygonShape::set_points(const PoolVector<Vector3> &p_points) { diff --git a/scene/resources/cylinder_shape.cpp b/scene/resources/cylinder_shape.cpp index 4fd829b349..f60f7ab376 100644 --- a/scene/resources/cylinder_shape.cpp +++ b/scene/resources/cylinder_shape.cpp @@ -68,6 +68,7 @@ void CylinderShape::_update_shape() { d["radius"] = radius; d["height"] = height; PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); + Shape::_update_shape(); } void CylinderShape::set_radius(float p_radius) { diff --git a/scene/resources/plane_shape.cpp b/scene/resources/plane_shape.cpp index 419ff8f972..08f6ccd764 100644 --- a/scene/resources/plane_shape.cpp +++ b/scene/resources/plane_shape.cpp @@ -64,6 +64,7 @@ Vector<Vector3> PlaneShape::_gen_debug_mesh_lines() { void PlaneShape::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), plane); + Shape::_update_shape(); } void PlaneShape::set_plane(Plane p_plane) { diff --git a/scene/resources/ray_shape.cpp b/scene/resources/ray_shape.cpp index b7925d8a58..0acfffdc06 100644 --- a/scene/resources/ray_shape.cpp +++ b/scene/resources/ray_shape.cpp @@ -47,7 +47,7 @@ void RayShape::_update_shape() { d["length"] = length; d["slips_on_slope"] = slips_on_slope; PhysicsServer::get_singleton()->shape_set_data(get_shape(), d); - emit_changed(); + Shape::_update_shape(); } void RayShape::set_length(float p_length) { diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index 825b7f4c8b..6ba46f066c 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -96,6 +96,11 @@ Ref<ArrayMesh> Shape::get_debug_mesh() { return debug_mesh_cache; } +void Shape::_update_shape() { + emit_changed(); + debug_mesh_cache.unref(); +} + void Shape::_bind_methods() { ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Shape::set_margin); diff --git a/scene/resources/shape.h b/scene/resources/shape.h index de99a967a8..ba763eaab1 100644 --- a/scene/resources/shape.h +++ b/scene/resources/shape.h @@ -51,6 +51,8 @@ protected: Shape(RID p_shape); virtual Vector<Vector3> _gen_debug_mesh_lines() = 0; // { return Vector<Vector3>(); } + virtual void _update_shape(); + public: virtual RID get_rid() const { return shape; } diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape.cpp index 492cf3959d..af89413ced 100644 --- a/scene/resources/sphere_shape.cpp +++ b/scene/resources/sphere_shape.cpp @@ -58,6 +58,7 @@ Vector<Vector3> SphereShape::_gen_debug_mesh_lines() { void SphereShape::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), radius); + Shape::_update_shape(); } void SphereShape::set_radius(float p_radius) { |