diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2023-09-26 15:58:57 -0400 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2023-10-06 16:31:35 -0400 |
commit | 5e15586ec24126703f928954f8512f7ea330313b (patch) | |
tree | 35df4036ad428dd361f918f0cedbac1acf3271b1 /servers/physics_2d | |
parent | d31794c4a26e5e10fc30c34a1ae9722fd9f50123 (diff) | |
download | redot-engine-5e15586ec24126703f928954f8512f7ea330313b.tar.gz |
Fixes to allow object-less callables throughout Godot
This fixes #81887
Diffstat (limited to 'servers/physics_2d')
-rw-r--r-- | servers/physics_2d/godot_area_2d.cpp | 14 | ||||
-rw-r--r-- | servers/physics_2d/godot_body_2d.cpp | 8 |
2 files changed, 4 insertions, 18 deletions
diff --git a/servers/physics_2d/godot_area_2d.cpp b/servers/physics_2d/godot_area_2d.cpp index 4d2148aa07..5371bccf26 100644 --- a/servers/physics_2d/godot_area_2d.cpp +++ b/servers/physics_2d/godot_area_2d.cpp @@ -78,13 +78,6 @@ void GodotArea2D::set_space(GodotSpace2D *p_space) { } void GodotArea2D::set_monitor_callback(const Callable &p_callback) { - ObjectID id = p_callback.get_object_id(); - - if (id == monitor_callback.get_object_id()) { - monitor_callback = p_callback; - return; - } - _unregister_shapes(); monitor_callback = p_callback; @@ -100,13 +93,6 @@ void GodotArea2D::set_monitor_callback(const Callable &p_callback) { } void GodotArea2D::set_area_monitor_callback(const Callable &p_callback) { - ObjectID id = p_callback.get_object_id(); - - if (id == area_monitor_callback.get_object_id()) { - area_monitor_callback = p_callback; - return; - } - _unregister_shapes(); area_monitor_callback = p_callback; diff --git a/servers/physics_2d/godot_body_2d.cpp b/servers/physics_2d/godot_body_2d.cpp index 4a7b470768..bd472a04ae 100644 --- a/servers/physics_2d/godot_body_2d.cpp +++ b/servers/physics_2d/godot_body_2d.cpp @@ -615,7 +615,7 @@ void GodotBody2D::integrate_velocities(real_t p_step) { return; } - if (fi_callback_data || body_state_callback.get_object()) { + if (fi_callback_data || body_state_callback.is_valid()) { get_space()->body_add_to_state_query_list(&direct_state_query_list); } @@ -676,7 +676,7 @@ void GodotBody2D::call_queries() { Variant direct_state_variant = get_direct_state(); if (fi_callback_data) { - if (!fi_callback_data->callable.get_object()) { + if (!fi_callback_data->callable.is_valid()) { set_force_integration_callback(Callable()); } else { const Variant *vp[2] = { &direct_state_variant, &fi_callback_data->udata }; @@ -692,7 +692,7 @@ void GodotBody2D::call_queries() { } } - if (body_state_callback.get_object()) { + if (body_state_callback.is_valid()) { body_state_callback.call(direct_state_variant); } } @@ -719,7 +719,7 @@ void GodotBody2D::set_state_sync_callback(const Callable &p_callable) { } void GodotBody2D::set_force_integration_callback(const Callable &p_callable, const Variant &p_udata) { - if (p_callable.get_object()) { + if (p_callable.is_valid()) { if (!fi_callback_data) { fi_callback_data = memnew(ForceIntegrationCallbackData); } |