Merge pull request #88164 from smix8/fix_region_signals

Fix NavigationRegion errors from signal changes
This commit is contained in:
Rémi Verschelde 2024-02-12 13:34:53 +01:00
commit effb35dfa7
No known key found for this signature in database
GPG Key ID: C3336907360768E1
4 changed files with 23 additions and 6 deletions

View File

@ -275,6 +275,14 @@ void NavigationRegion2D::_navigation_map_changed(RID p_map) {
}
#endif // DEBUG_ENABLED
#ifdef DEBUG_ENABLED
void NavigationRegion2D::_navigation_debug_changed() {
if (is_inside_tree()) {
queue_redraw();
}
}
#endif // DEBUG_ENABLED
Array NavigationRegion2D::get_configuration_warnings() const {
Array warnings = Node2D::get_configuration_warnings();
@ -374,7 +382,7 @@ NavigationRegion2D::NavigationRegion2D() {
#ifdef DEBUG_ENABLED
NavigationServer2D::get_singleton()->connect(SNAME("map_changed"), callable_mp(this, &NavigationRegion2D::_navigation_map_changed));
NavigationServer2D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion2D::_navigation_map_changed));
NavigationServer2D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion2D::_navigation_debug_changed));
#endif // DEBUG_ENABLED
}
@ -391,7 +399,7 @@ NavigationRegion2D::~NavigationRegion2D() {
#ifdef DEBUG_ENABLED
NavigationServer2D::get_singleton()->disconnect(SNAME("map_changed"), callable_mp(this, &NavigationRegion2D::_navigation_map_changed));
NavigationServer2D::get_singleton()->disconnect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion2D::_navigation_map_changed));
NavigationServer2D::get_singleton()->disconnect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion2D::_navigation_debug_changed));
#endif // DEBUG_ENABLED
}

View File

@ -59,6 +59,7 @@ private:
void _update_debug_mesh();
void _update_debug_edge_connections_mesh();
void _navigation_map_changed(RID p_map);
void _navigation_debug_changed();
#endif // DEBUG_ENABLED
protected:

View File

@ -361,6 +361,15 @@ void NavigationRegion3D::_navigation_map_changed(RID p_map) {
}
#endif // DEBUG_ENABLED
#ifdef DEBUG_ENABLED
void NavigationRegion3D::_navigation_debug_changed() {
if (is_inside_tree()) {
_update_debug_mesh();
_update_debug_edge_connections_mesh();
}
}
#endif // DEBUG_ENABLED
void NavigationRegion3D::_region_enter_navigation_map() {
if (!is_inside_tree()) {
return;
@ -426,8 +435,7 @@ NavigationRegion3D::NavigationRegion3D() {
#ifdef DEBUG_ENABLED
NavigationServer3D::get_singleton()->connect(SNAME("map_changed"), callable_mp(this, &NavigationRegion3D::_navigation_map_changed));
NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion3D::_update_debug_mesh));
NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh));
NavigationServer3D::get_singleton()->connect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion3D::_navigation_debug_changed));
#endif // DEBUG_ENABLED
}
@ -440,8 +448,7 @@ NavigationRegion3D::~NavigationRegion3D() {
#ifdef DEBUG_ENABLED
NavigationServer3D::get_singleton()->disconnect(SNAME("map_changed"), callable_mp(this, &NavigationRegion3D::_navigation_map_changed));
NavigationServer3D::get_singleton()->disconnect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion3D::_update_debug_mesh));
NavigationServer3D::get_singleton()->disconnect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion3D::_update_debug_edge_connections_mesh));
NavigationServer3D::get_singleton()->disconnect(SNAME("navigation_debug_changed"), callable_mp(this, &NavigationRegion3D::_navigation_debug_changed));
ERR_FAIL_NULL(RenderingServer::get_singleton());
if (debug_instance.is_valid()) {

View File

@ -61,6 +61,7 @@ private:
void _update_debug_mesh();
void _update_debug_edge_connections_mesh();
void _navigation_map_changed(RID p_map);
void _navigation_debug_changed();
#endif // DEBUG_ENABLED
protected: