From 7f2740f7bd62fa8bbc5aa1dd3a4536f73144ada5 Mon Sep 17 00:00:00 2001 From: rafallus Date: Tue, 25 Jan 2022 17:07:17 -0600 Subject: Expose input interaction virtual functions in CollisionObject --- scene/2d/collision_object_2d.cpp | 4 ++++ scene/2d/collision_object_2d.h | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'scene/2d') diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 85de1fedee..a79c81e8bd 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -612,6 +612,10 @@ void CollisionObject2D::_bind_methods() { ClassDB::bind_method(D_METHOD("shape_find_owner", "shape_index"), &CollisionObject2D::shape_find_owner); GDVIRTUAL_BIND(_input_event, "viewport", "event", "shape_idx"); + GDVIRTUAL_BIND(_mouse_enter); + GDVIRTUAL_BIND(_mouse_exit); + GDVIRTUAL_BIND(_mouse_shape_enter, "shape_idx"); + GDVIRTUAL_BIND(_mouse_shape_exit, "shape_idx"); ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "viewport", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::INT, "shape_idx"))); ADD_SIGNAL(MethodInfo("mouse_entered")); diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h index af216edc98..48ea59e040 100644 --- a/scene/2d/collision_object_2d.h +++ b/scene/2d/collision_object_2d.h @@ -103,6 +103,10 @@ protected: void set_body_mode(PhysicsServer2D::BodyMode p_mode); GDVIRTUAL3(_input_event, Viewport *, Ref, int) + GDVIRTUAL0(_mouse_enter) + GDVIRTUAL0(_mouse_exit) + GDVIRTUAL1(_mouse_shape_enter, int) + GDVIRTUAL1(_mouse_shape_exit, int) public: void set_collision_layer(uint32_t p_layer); uint32_t get_collision_layer() const; -- cgit v1.2.3