Fix errors in mouse detection when removing collision object from tree
Now behaves the same way as ui elements, mouse exit is skipped when the object is removed from the tree.
This commit is contained in:
parent
ff132ca278
commit
b4b94ac8a0
@ -2687,6 +2687,10 @@ void Viewport::_drop_physics_mouseover(bool p_paused_only) {
|
|||||||
if (o) {
|
if (o) {
|
||||||
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
|
CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
|
||||||
if (co) {
|
if (co) {
|
||||||
|
if (!co->is_inside_tree()) {
|
||||||
|
to_erase.push_back(E);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (p_paused_only && co->can_process()) {
|
if (p_paused_only && co->can_process()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2705,7 +2709,9 @@ void Viewport::_drop_physics_mouseover(bool p_paused_only) {
|
|||||||
if (physics_object_over) {
|
if (physics_object_over) {
|
||||||
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_over));
|
CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_over));
|
||||||
if (co) {
|
if (co) {
|
||||||
if (!(p_paused_only && co->can_process())) {
|
if (!co->is_inside_tree()) {
|
||||||
|
physics_object_over = physics_object_capture = 0;
|
||||||
|
} else if (!(p_paused_only && co->can_process())) {
|
||||||
co->_mouse_exit();
|
co->_mouse_exit();
|
||||||
physics_object_over = physics_object_capture = 0;
|
physics_object_over = physics_object_capture = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user