Viewport: Fix missing tooltips w/ disabled physics object picking
Previously this option seemed to be the sole responsible for enabling physics processing in Viewport, while several other features like tooltips and debugging collision hints rely on it. All this logic is moved to internal processing (it's incorrect to let it be affected by users disabling physics/idle processing), and disabling physics object picking no longer affects the internal physics processing. Fixes #17001.
This commit is contained in:
parent
7f3024d343
commit
ce7da2c7d6
1 changed files with 18 additions and 9 deletions
|
@ -192,6 +192,7 @@ Viewport::GUI::GUI() {
|
|||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
|
||||
void Viewport::_update_stretch_transform() {
|
||||
|
||||
if (size_override_stretch && size_override) {
|
||||
|
@ -318,6 +319,11 @@ void Viewport::_notification(int p_what) {
|
|||
first->make_current();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Enable processing for tooltips, collision debugging, physics object picking, etc.
|
||||
set_process_internal(true);
|
||||
set_physics_process_internal(true);
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
|
||||
|
@ -345,15 +351,18 @@ void Viewport::_notification(int p_what) {
|
|||
VS::get_singleton()->viewport_set_active(viewport, false);
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_PHYSICS_PROCESS: {
|
||||
case NOTIFICATION_INTERNAL_PROCESS: {
|
||||
|
||||
if (gui.tooltip_timer >= 0) {
|
||||
gui.tooltip_timer -= get_physics_process_delta_time();
|
||||
gui.tooltip_timer -= get_process_delta_time();
|
||||
if (gui.tooltip_timer < 0) {
|
||||
_gui_show_tooltip();
|
||||
}
|
||||
}
|
||||
|
||||
} break;
|
||||
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
|
||||
|
||||
if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) {
|
||||
|
||||
VisualServer::get_singleton()->canvas_item_clear(contact_2d_debug);
|
||||
|
@ -2404,9 +2413,14 @@ Rect2 Viewport::get_attach_to_screen_rect() const {
|
|||
void Viewport::set_physics_object_picking(bool p_enable) {
|
||||
|
||||
physics_object_picking = p_enable;
|
||||
set_physics_process(physics_object_picking);
|
||||
if (!physics_object_picking)
|
||||
if (!physics_object_picking) {
|
||||
physics_picking_events.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool Viewport::get_physics_object_picking() {
|
||||
|
||||
return physics_object_picking;
|
||||
}
|
||||
|
||||
Vector2 Viewport::get_camera_coords(const Vector2 &p_viewport_coords) const {
|
||||
|
@ -2420,11 +2434,6 @@ Vector2 Viewport::get_camera_rect_size() const {
|
|||
return size;
|
||||
}
|
||||
|
||||
bool Viewport::get_physics_object_picking() {
|
||||
|
||||
return physics_object_picking;
|
||||
}
|
||||
|
||||
bool Viewport::gui_has_modal_stack() const {
|
||||
|
||||
return gui.modal_stack.size();
|
||||
|
|
Loading…
Reference in a new issue