|
@@ -856,6 +856,9 @@ void Viewport::_process_picking() {
|
|
|
|
|
|
if (send_event) {
|
|
|
co->_input_event_call(this, ev, res[i].shape);
|
|
|
+ if (physics_object_picking_first_only) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3466,6 +3469,14 @@ bool Viewport::get_physics_object_picking_sort() {
|
|
|
return physics_object_picking_sort;
|
|
|
}
|
|
|
|
|
|
+void Viewport::set_physics_object_picking_first_only(bool p_enable) {
|
|
|
+ physics_object_picking_first_only = p_enable;
|
|
|
+}
|
|
|
+
|
|
|
+bool Viewport::get_physics_object_picking_first_only() {
|
|
|
+ return physics_object_picking_first_only;
|
|
|
+}
|
|
|
+
|
|
|
Vector2 Viewport::get_camera_coords(const Vector2 &p_viewport_coords) const {
|
|
|
ERR_READ_THREAD_GUARD_V(Vector2());
|
|
|
Transform2D xf = stretch_transform * global_canvas_transform;
|
|
@@ -4616,6 +4627,8 @@ void Viewport::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("get_physics_object_picking"), &Viewport::get_physics_object_picking);
|
|
|
ClassDB::bind_method(D_METHOD("set_physics_object_picking_sort", "enable"), &Viewport::set_physics_object_picking_sort);
|
|
|
ClassDB::bind_method(D_METHOD("get_physics_object_picking_sort"), &Viewport::get_physics_object_picking_sort);
|
|
|
+ ClassDB::bind_method(D_METHOD("set_physics_object_picking_first_only", "enable"), &Viewport::set_physics_object_picking_first_only);
|
|
|
+ ClassDB::bind_method(D_METHOD("get_physics_object_picking_first_only"), &Viewport::get_physics_object_picking_first_only);
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("get_viewport_rid"), &Viewport::get_viewport_rid);
|
|
|
ClassDB::bind_method(D_METHOD("push_text_input", "text"), &Viewport::push_text_input);
|
|
@@ -4774,6 +4787,7 @@ void Viewport::_bind_methods() {
|
|
|
ADD_GROUP("Physics", "physics_");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "physics_object_picking"), "set_physics_object_picking", "get_physics_object_picking");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "physics_object_picking_sort"), "set_physics_object_picking_sort", "get_physics_object_picking_sort");
|
|
|
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "physics_object_picking_first_only"), "set_physics_object_picking_first_only", "get_physics_object_picking_first_only");
|
|
|
ADD_GROUP("GUI", "gui_");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gui_disable_input"), "set_disable_input", "is_input_disabled");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gui_snap_controls_to_pixels"), "set_snap_controls_to_pixels", "is_snap_controls_to_pixels_enabled");
|