diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-08-19 11:21:56 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-08-24 17:34:55 -0700 |
commit | 3d5dc80348b9b377f6d8a33c7101d54b337396a5 (patch) | |
tree | 70705bf5e02804bc2eaffe9315205a128d4a1c9e /scene | |
parent | aa4791735d2fe92d747a39529aebb410f96cf38f (diff) |
Rename RayShape to SeparationRayShape
Makes it clearer that it's used for special cases when picking a
collision shape.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/register_scene_types.cpp | 11 | ||||
-rw-r--r-- | scene/resources/separation_ray_shape_2d.cpp (renamed from scene/resources/ray_shape_2d.cpp) | 34 | ||||
-rw-r--r-- | scene/resources/separation_ray_shape_2d.h (renamed from scene/resources/ray_shape_2d.h) | 14 | ||||
-rw-r--r-- | scene/resources/separation_ray_shape_3d.cpp (renamed from scene/resources/ray_shape_3d.cpp) | 32 | ||||
-rw-r--r-- | scene/resources/separation_ray_shape_3d.h (renamed from scene/resources/ray_shape_3d.h) | 14 |
5 files changed, 53 insertions, 52 deletions
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index f0b799e4d2..25d3f6a3e7 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -157,11 +157,11 @@ #include "scene/resources/physics_material.h" #include "scene/resources/polygon_path_finder.h" #include "scene/resources/primitive_meshes.h" -#include "scene/resources/ray_shape_2d.h" -#include "scene/resources/ray_shape_3d.h" #include "scene/resources/rectangle_shape_2d.h" #include "scene/resources/resource_format_text.h" #include "scene/resources/segment_shape_2d.h" +#include "scene/resources/separation_ray_shape_2d.h" +#include "scene/resources/separation_ray_shape_3d.h" #include "scene/resources/skeleton_modification_2d.h" #include "scene/resources/skeleton_modification_2d_ccdik.h" #include "scene/resources/skeleton_modification_2d_fabrik.h" @@ -754,7 +754,7 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init GDREGISTER_VIRTUAL_CLASS(Shape3D); - GDREGISTER_CLASS(RayShape3D); + GDREGISTER_CLASS(SeparationRayShape3D); GDREGISTER_CLASS(SphereShape3D); GDREGISTER_CLASS(BoxShape3D); GDREGISTER_CLASS(CapsuleShape3D); @@ -843,7 +843,7 @@ void register_scene_types() { GDREGISTER_VIRTUAL_CLASS(Shape2D); GDREGISTER_CLASS(WorldMarginShape2D); GDREGISTER_CLASS(SegmentShape2D); - GDREGISTER_CLASS(RayShape2D); + GDREGISTER_CLASS(SeparationRayShape2D); GDREGISTER_CLASS(CircleShape2D); GDREGISTER_CLASS(RectangleShape2D); GDREGISTER_CLASS(CapsuleShape2D); @@ -964,7 +964,8 @@ void register_scene_types() { ClassDB::add_compatibility_class("ProceduralSky", "Sky"); ClassDB::add_compatibility_class("ProximityGroup", "ProximityGroup3D"); ClassDB::add_compatibility_class("RayCast", "RayCast3D"); - ClassDB::add_compatibility_class("RayShape", "RayShape3D"); + ClassDB::add_compatibility_class("RayShape", "SeparationRayShape3D"); + ClassDB::add_compatibility_class("RayShape2D", "SeparationRayShape2D"); ClassDB::add_compatibility_class("RemoteTransform", "RemoteTransform3D"); ClassDB::add_compatibility_class("RigidBody", "RigidBody3D"); ClassDB::add_compatibility_class("Shape", "Shape3D"); diff --git a/scene/resources/ray_shape_2d.cpp b/scene/resources/separation_ray_shape_2d.cpp index 2390a13bfa..0acd6d268d 100644 --- a/scene/resources/ray_shape_2d.cpp +++ b/scene/resources/separation_ray_shape_2d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* ray_shape_2d.cpp */ +/* separation_ray_shape_2d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "ray_shape_2d.h" +#include "separation_ray_shape_2d.h" #include "servers/physics_server_2d.h" #include "servers/rendering_server.h" -void RayShape2D::_update_shape() { +void SeparationRayShape2D::_update_shape() { Dictionary d; d["length"] = length; d["slide_on_slope"] = slide_on_slope; @@ -41,7 +41,7 @@ void RayShape2D::_update_shape() { emit_changed(); } -void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) { +void SeparationRayShape2D::draw(const RID &p_to_rid, const Color &p_color) { const Vector2 target_position = Vector2(0, get_length()); const float max_arrow_size = 6; @@ -72,7 +72,7 @@ void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) { RS::get_singleton()->canvas_item_add_primitive(p_to_rid, pts, cols, Vector<Point2>(), RID()); } -Rect2 RayShape2D::get_rect() const { +Rect2 SeparationRayShape2D::get_rect() const { Rect2 rect; rect.position = Vector2(); rect.expand_to(Vector2(0, length)); @@ -80,40 +80,40 @@ Rect2 RayShape2D::get_rect() const { return rect; } -real_t RayShape2D::get_enclosing_radius() const { +real_t SeparationRayShape2D::get_enclosing_radius() const { return length; } -void RayShape2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_length", "length"), &RayShape2D::set_length); - ClassDB::bind_method(D_METHOD("get_length"), &RayShape2D::get_length); +void SeparationRayShape2D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_length", "length"), &SeparationRayShape2D::set_length); + ClassDB::bind_method(D_METHOD("get_length"), &SeparationRayShape2D::get_length); - ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &RayShape2D::set_slide_on_slope); - ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &RayShape2D::get_slide_on_slope); + ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &SeparationRayShape2D::set_slide_on_slope); + ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &SeparationRayShape2D::get_slide_on_slope); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length"), "set_length", "get_length"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slide_on_slope"), "set_slide_on_slope", "get_slide_on_slope"); } -void RayShape2D::set_length(real_t p_length) { +void SeparationRayShape2D::set_length(real_t p_length) { length = p_length; _update_shape(); } -real_t RayShape2D::get_length() const { +real_t SeparationRayShape2D::get_length() const { return length; } -void RayShape2D::set_slide_on_slope(bool p_active) { +void SeparationRayShape2D::set_slide_on_slope(bool p_active) { slide_on_slope = p_active; _update_shape(); } -bool RayShape2D::get_slide_on_slope() const { +bool SeparationRayShape2D::get_slide_on_slope() const { return slide_on_slope; } -RayShape2D::RayShape2D() : - Shape2D(PhysicsServer2D::get_singleton()->ray_shape_create()) { +SeparationRayShape2D::SeparationRayShape2D() : + Shape2D(PhysicsServer2D::get_singleton()->separation_ray_shape_create()) { _update_shape(); } diff --git a/scene/resources/ray_shape_2d.h b/scene/resources/separation_ray_shape_2d.h index 0895605ddf..5b74e6c727 100644 --- a/scene/resources/ray_shape_2d.h +++ b/scene/resources/separation_ray_shape_2d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* ray_shape_2d.h */ +/* separation_ray_shape_2d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,13 +28,13 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef RAY_SHAPE_2D_H -#define RAY_SHAPE_2D_H +#ifndef SEPARATION_RAY_SHAPE_2D_H +#define SEPARATION_RAY_SHAPE_2D_H #include "scene/resources/shape_2d.h" -class RayShape2D : public Shape2D { - GDCLASS(RayShape2D, Shape2D); +class SeparationRayShape2D : public Shape2D { + GDCLASS(SeparationRayShape2D, Shape2D); real_t length = 20.0; bool slide_on_slope = false; @@ -55,7 +55,7 @@ public: virtual Rect2 get_rect() const override; virtual real_t get_enclosing_radius() const override; - RayShape2D(); + SeparationRayShape2D(); }; -#endif // RAY_SHAPE_2D_H +#endif // SEPARATION_RAY_SHAPE_2D_H diff --git a/scene/resources/ray_shape_3d.cpp b/scene/resources/separation_ray_shape_3d.cpp index 5d73fb8d80..376e04c844 100644 --- a/scene/resources/ray_shape_3d.cpp +++ b/scene/resources/separation_ray_shape_3d.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* ray_shape_3d.cpp */ +/* separation_ray_shape_3d.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "ray_shape_3d.h" +#include "separation_ray_shape_3d.h" #include "servers/physics_server_3d.h" -Vector<Vector3> RayShape3D::get_debug_mesh_lines() const { +Vector<Vector3> SeparationRayShape3D::get_debug_mesh_lines() const { Vector<Vector3> points; points.push_back(Vector3()); points.push_back(Vector3(0, 0, get_length())); @@ -40,11 +40,11 @@ Vector<Vector3> RayShape3D::get_debug_mesh_lines() const { return points; } -real_t RayShape3D::get_enclosing_radius() const { +real_t SeparationRayShape3D::get_enclosing_radius() const { return length; } -void RayShape3D::_update_shape() { +void SeparationRayShape3D::_update_shape() { Dictionary d; d["length"] = length; d["slide_on_slope"] = slide_on_slope; @@ -52,39 +52,39 @@ void RayShape3D::_update_shape() { Shape3D::_update_shape(); } -void RayShape3D::set_length(float p_length) { +void SeparationRayShape3D::set_length(float p_length) { length = p_length; _update_shape(); notify_change_to_owners(); } -float RayShape3D::get_length() const { +float SeparationRayShape3D::get_length() const { return length; } -void RayShape3D::set_slide_on_slope(bool p_active) { +void SeparationRayShape3D::set_slide_on_slope(bool p_active) { slide_on_slope = p_active; _update_shape(); notify_change_to_owners(); } -bool RayShape3D::get_slide_on_slope() const { +bool SeparationRayShape3D::get_slide_on_slope() const { return slide_on_slope; } -void RayShape3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_length", "length"), &RayShape3D::set_length); - ClassDB::bind_method(D_METHOD("get_length"), &RayShape3D::get_length); +void SeparationRayShape3D::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_length", "length"), &SeparationRayShape3D::set_length); + ClassDB::bind_method(D_METHOD("get_length"), &SeparationRayShape3D::get_length); - ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &RayShape3D::set_slide_on_slope); - ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &RayShape3D::get_slide_on_slope); + ClassDB::bind_method(D_METHOD("set_slide_on_slope", "active"), &SeparationRayShape3D::set_slide_on_slope); + ClassDB::bind_method(D_METHOD("get_slide_on_slope"), &SeparationRayShape3D::get_slide_on_slope); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "length", PROPERTY_HINT_RANGE, "0,4096,0.001"), "set_length", "get_length"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "slide_on_slope"), "set_slide_on_slope", "get_slide_on_slope"); } -RayShape3D::RayShape3D() : - Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_RAY)) { +SeparationRayShape3D::SeparationRayShape3D() : + Shape3D(PhysicsServer3D::get_singleton()->shape_create(PhysicsServer3D::SHAPE_SEPARATION_RAY)) { /* Code copied from setters to prevent the use of uninitialized variables */ _update_shape(); notify_change_to_owners(); diff --git a/scene/resources/ray_shape_3d.h b/scene/resources/separation_ray_shape_3d.h index 5369408185..54058b6095 100644 --- a/scene/resources/ray_shape_3d.h +++ b/scene/resources/separation_ray_shape_3d.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* ray_shape_3d.h */ +/* separation_ray_shape_3d.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,12 +28,12 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef RAY_SHAPE_H -#define RAY_SHAPE_H +#ifndef SEPARATION_RAY_SHAPE_H +#define SEPARATION_RAY_SHAPE_H #include "scene/resources/shape_3d.h" -class RayShape3D : public Shape3D { - GDCLASS(RayShape3D, Shape3D); +class SeparationRayShape3D : public Shape3D { + GDCLASS(SeparationRayShape3D, Shape3D); float length = 1.0; bool slide_on_slope = false; @@ -51,6 +51,6 @@ public: virtual Vector<Vector3> get_debug_mesh_lines() const override; virtual real_t get_enclosing_radius() const override; - RayShape3D(); + SeparationRayShape3D(); }; -#endif // RAY_SHAPE_H +#endif // SEPARATION_RAY_SHAPE_H |