summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorEmmanuel Barroga <emmanuelbarroga@gmail.com>2019-10-10 13:35:00 -0700
committerEmmanuel Barroga <emmanuelbarroga@gmail.com>2019-10-11 03:42:36 -0700
commit29690f6aec8f31b0e61fb31aff32c16df98ad8c2 (patch)
treef586aa54f6b146b22235d790112ae021ca7ecdd6 /scene
parent781e4f8673857b2b318e919ecb780bfad972a5a6 (diff)
Fixes concaveshape not selecting in viewport
This PR resolves the issue of ConcaveShapes not being selectable in the Viewport.
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/box_shape.cpp2
-rw-r--r--scene/resources/box_shape.h3
-rw-r--r--scene/resources/capsule_shape.cpp2
-rw-r--r--scene/resources/capsule_shape.h4
-rw-r--r--scene/resources/concave_polygon_shape.cpp2
-rw-r--r--scene/resources/concave_polygon_shape.h3
-rw-r--r--scene/resources/convex_polygon_shape.cpp2
-rw-r--r--scene/resources/convex_polygon_shape.h4
-rw-r--r--scene/resources/cylinder_shape.cpp2
-rw-r--r--scene/resources/cylinder_shape.h4
-rw-r--r--scene/resources/height_map_shape.cpp2
-rw-r--r--scene/resources/height_map_shape.h4
-rw-r--r--scene/resources/plane_shape.cpp2
-rw-r--r--scene/resources/plane_shape.h4
-rw-r--r--scene/resources/ray_shape.cpp2
-rw-r--r--scene/resources/ray_shape.h3
-rw-r--r--scene/resources/shape.cpp4
-rw-r--r--scene/resources/shape.h2
-rw-r--r--scene/resources/sphere_shape.cpp2
-rw-r--r--scene/resources/sphere_shape.h3
20 files changed, 30 insertions, 26 deletions
diff --git a/scene/resources/box_shape.cpp b/scene/resources/box_shape.cpp
index d819e9f776..c6fe14e55e 100644
--- a/scene/resources/box_shape.cpp
+++ b/scene/resources/box_shape.cpp
@@ -31,7 +31,7 @@
#include "box_shape.h"
#include "servers/physics_server.h"
-Vector<Vector3> BoxShape::_gen_debug_mesh_lines() {
+Vector<Vector3> BoxShape::get_debug_mesh_lines() {
Vector<Vector3> lines;
AABB aabb;
diff --git a/scene/resources/box_shape.h b/scene/resources/box_shape.h
index 42d54310a8..0bce929aee 100644
--- a/scene/resources/box_shape.h
+++ b/scene/resources/box_shape.h
@@ -42,12 +42,13 @@ protected:
static void _bind_methods();
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
public:
void set_extents(const Vector3 &p_extents);
Vector3 get_extents() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
BoxShape();
};
diff --git a/scene/resources/capsule_shape.cpp b/scene/resources/capsule_shape.cpp
index 669b261bfe..1ec3bd7158 100644
--- a/scene/resources/capsule_shape.cpp
+++ b/scene/resources/capsule_shape.cpp
@@ -31,7 +31,7 @@
#include "capsule_shape.h"
#include "servers/physics_server.h"
-Vector<Vector3> CapsuleShape::_gen_debug_mesh_lines() {
+Vector<Vector3> CapsuleShape::get_debug_mesh_lines() {
float radius = get_radius();
float height = get_height();
diff --git a/scene/resources/capsule_shape.h b/scene/resources/capsule_shape.h
index 6bca53f783..befbc1dcd5 100644
--- a/scene/resources/capsule_shape.h
+++ b/scene/resources/capsule_shape.h
@@ -44,14 +44,14 @@ protected:
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
-
public:
void set_radius(float p_radius);
float get_radius() const;
void set_height(float p_height);
float get_height() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
CapsuleShape();
};
diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp
index b4cc38c8c0..dbc07ef591 100644
--- a/scene/resources/concave_polygon_shape.cpp
+++ b/scene/resources/concave_polygon_shape.cpp
@@ -32,7 +32,7 @@
#include "servers/physics_server.h"
-Vector<Vector3> ConcavePolygonShape::_gen_debug_mesh_lines() {
+Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() {
Set<DrawEdge> edges;
diff --git a/scene/resources/concave_polygon_shape.h b/scene/resources/concave_polygon_shape.h
index 1b8ddfc308..57362a29be 100644
--- a/scene/resources/concave_polygon_shape.h
+++ b/scene/resources/concave_polygon_shape.h
@@ -61,12 +61,13 @@ protected:
static void _bind_methods();
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
public:
void set_faces(const PoolVector<Vector3> &p_faces);
PoolVector<Vector3> get_faces() const;
+ Vector<Vector3> get_debug_mesh_lines();
+
ConcavePolygonShape();
};
diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp
index 499688a185..af459ec311 100644
--- a/scene/resources/convex_polygon_shape.cpp
+++ b/scene/resources/convex_polygon_shape.cpp
@@ -32,7 +32,7 @@
#include "core/math/quick_hull.h"
#include "servers/physics_server.h"
-Vector<Vector3> ConvexPolygonShape::_gen_debug_mesh_lines() {
+Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() {
PoolVector<Vector3> points = get_points();
diff --git a/scene/resources/convex_polygon_shape.h b/scene/resources/convex_polygon_shape.h
index 5c192476d3..e6daf1bef4 100644
--- a/scene/resources/convex_polygon_shape.h
+++ b/scene/resources/convex_polygon_shape.h
@@ -43,12 +43,12 @@ protected:
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
-
public:
void set_points(const PoolVector<Vector3> &p_points);
PoolVector<Vector3> get_points() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
ConvexPolygonShape();
};
diff --git a/scene/resources/cylinder_shape.cpp b/scene/resources/cylinder_shape.cpp
index f60f7ab376..c1a0a0ac5d 100644
--- a/scene/resources/cylinder_shape.cpp
+++ b/scene/resources/cylinder_shape.cpp
@@ -31,7 +31,7 @@
#include "cylinder_shape.h"
#include "servers/physics_server.h"
-Vector<Vector3> CylinderShape::_gen_debug_mesh_lines() {
+Vector<Vector3> CylinderShape::get_debug_mesh_lines() {
float radius = get_radius();
float height = get_height();
diff --git a/scene/resources/cylinder_shape.h b/scene/resources/cylinder_shape.h
index 58a4f5a817..411c1515ed 100644
--- a/scene/resources/cylinder_shape.h
+++ b/scene/resources/cylinder_shape.h
@@ -43,14 +43,14 @@ protected:
static void _bind_methods();
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
-
public:
void set_radius(float p_radius);
float get_radius() const;
void set_height(float p_height);
float get_height() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
CylinderShape();
};
diff --git a/scene/resources/height_map_shape.cpp b/scene/resources/height_map_shape.cpp
index f763700d52..214706626d 100644
--- a/scene/resources/height_map_shape.cpp
+++ b/scene/resources/height_map_shape.cpp
@@ -31,7 +31,7 @@
#include "height_map_shape.h"
#include "servers/physics_server.h"
-Vector<Vector3> HeightMapShape::_gen_debug_mesh_lines() {
+Vector<Vector3> HeightMapShape::get_debug_mesh_lines() {
Vector<Vector3> points;
if ((map_width != 0) && (map_depth != 0)) {
diff --git a/scene/resources/height_map_shape.h b/scene/resources/height_map_shape.h
index b062f4e893..4cf2a76213 100644
--- a/scene/resources/height_map_shape.h
+++ b/scene/resources/height_map_shape.h
@@ -46,8 +46,6 @@ protected:
static void _bind_methods();
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
-
public:
void set_map_width(int p_new);
int get_map_width() const;
@@ -56,6 +54,8 @@ public:
void set_map_data(PoolRealArray p_new);
PoolRealArray get_map_data() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
HeightMapShape();
};
diff --git a/scene/resources/plane_shape.cpp b/scene/resources/plane_shape.cpp
index 08f6ccd764..d3274ec5f8 100644
--- a/scene/resources/plane_shape.cpp
+++ b/scene/resources/plane_shape.cpp
@@ -32,7 +32,7 @@
#include "servers/physics_server.h"
-Vector<Vector3> PlaneShape::_gen_debug_mesh_lines() {
+Vector<Vector3> PlaneShape::get_debug_mesh_lines() {
Plane p = get_plane();
Vector<Vector3> points;
diff --git a/scene/resources/plane_shape.h b/scene/resources/plane_shape.h
index 87c367cfde..f853d1966b 100644
--- a/scene/resources/plane_shape.h
+++ b/scene/resources/plane_shape.h
@@ -42,12 +42,12 @@ protected:
static void _bind_methods();
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
-
public:
void set_plane(Plane p_plane);
Plane get_plane() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
PlaneShape();
};
#endif // PLANE_SHAPE_H
diff --git a/scene/resources/ray_shape.cpp b/scene/resources/ray_shape.cpp
index 0acfffdc06..5a696aee23 100644
--- a/scene/resources/ray_shape.cpp
+++ b/scene/resources/ray_shape.cpp
@@ -32,7 +32,7 @@
#include "servers/physics_server.h"
-Vector<Vector3> RayShape::_gen_debug_mesh_lines() {
+Vector<Vector3> RayShape::get_debug_mesh_lines() {
Vector<Vector3> points;
points.push_back(Vector3());
diff --git a/scene/resources/ray_shape.h b/scene/resources/ray_shape.h
index 89fc34051c..fee7475c69 100644
--- a/scene/resources/ray_shape.h
+++ b/scene/resources/ray_shape.h
@@ -41,7 +41,6 @@ class RayShape : public Shape {
protected:
static void _bind_methods();
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
public:
void set_length(float p_length);
@@ -50,6 +49,8 @@ public:
void set_slips_on_slope(bool p_active);
bool get_slips_on_slope() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
RayShape();
};
#endif // RAY_SHAPE_H
diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp
index 6ba46f066c..3500fdb4bc 100644
--- a/scene/resources/shape.cpp
+++ b/scene/resources/shape.cpp
@@ -37,7 +37,7 @@
void Shape::add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p_xform) {
- Vector<Vector3> toadd = _gen_debug_mesh_lines();
+ Vector<Vector3> toadd = get_debug_mesh_lines();
if (toadd.size()) {
@@ -64,7 +64,7 @@ Ref<ArrayMesh> Shape::get_debug_mesh() {
if (debug_mesh_cache.is_valid())
return debug_mesh_cache;
- Vector<Vector3> lines = _gen_debug_mesh_lines();
+ Vector<Vector3> lines = get_debug_mesh_lines();
debug_mesh_cache = Ref<ArrayMesh>(memnew(ArrayMesh));
diff --git a/scene/resources/shape.h b/scene/resources/shape.h
index ba763eaab1..2743fd0c65 100644
--- a/scene/resources/shape.h
+++ b/scene/resources/shape.h
@@ -50,13 +50,13 @@ protected:
_FORCE_INLINE_ RID get_shape() const { return shape; }
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; }
Ref<ArrayMesh> get_debug_mesh();
+ virtual Vector<Vector3> get_debug_mesh_lines() = 0; // { return Vector<Vector3>(); }
void add_vertices_to_array(PoolVector<Vector3> &array, const Transform &p_xform);
diff --git a/scene/resources/sphere_shape.cpp b/scene/resources/sphere_shape.cpp
index af89413ced..019bc9189a 100644
--- a/scene/resources/sphere_shape.cpp
+++ b/scene/resources/sphere_shape.cpp
@@ -31,7 +31,7 @@
#include "sphere_shape.h"
#include "servers/physics_server.h"
-Vector<Vector3> SphereShape::_gen_debug_mesh_lines() {
+Vector<Vector3> SphereShape::get_debug_mesh_lines() {
float r = get_radius();
diff --git a/scene/resources/sphere_shape.h b/scene/resources/sphere_shape.h
index 682928e885..679882fe23 100644
--- a/scene/resources/sphere_shape.h
+++ b/scene/resources/sphere_shape.h
@@ -42,12 +42,13 @@ protected:
static void _bind_methods();
virtual void _update_shape();
- virtual Vector<Vector3> _gen_debug_mesh_lines();
public:
void set_radius(float p_radius);
float get_radius() const;
+ virtual Vector<Vector3> get_debug_mesh_lines();
+
SphereShape();
};